Guide API
Skip to main content

SortedSearch

Trait SortedSearch 

Source
pub trait SortedSearch: ListViewer {
    // Required methods
    fn search_pos(&self) -> i32;
    fn set_search_pos(&mut self, pos: i32);
    fn shift_state(&self) -> u8;
    fn set_shift_state(&mut self, s: u8);
    fn search(&self, cur: &[char]) -> i32;
}
Expand description

The type-to-search hooks — the polymorphic parts of the incremental-search state machine. The shared machine is sorted_handle_event + sorted_cursor; concrete widgets (a sorted list box, a file list) implement these.

Required Methods§

Source

fn search_pos(&self) -> i32

The index of the last matched char in the focused item’s text; -1 = no active search.

Source

fn set_search_pos(&mut self, pos: i32)

Source

fn shift_state(&self) -> u8

The shift bits captured at the search_pos -1↔0 transition. A plain sorted list box never reads it; file/dir subclasses’ search does.

Source

fn set_shift_state(&mut self, s: u8)

Source

fn search(&self, cur: &[char]) -> i32

Given the prepared prefix chars cur (already truncated by the state machine), return the insertion index in 0..=range of the first item NOT LESS than the key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§