pub struct EntryRenderData<'a> {
pub illegal_char_for_hotkey: Option<char>,
pub kind: &'a EntryKind,
pub key_combo_sequence: Option<Vec<KeyCombo>>,
/* private fields */
}Expand description
This struct represents the data that will be used to render an entry in the list. It is used in conjunction with the search query to determine how to render the entry.
It holds the prefix, search hit and suffix of the entry name, the next character after the search hit, the kind of the entry and the shortcut assigned to the entry.
This allows us to render the entry in the UI with the search hit underlined and the shortcut displayed next to the entry.
For example, if the entry name is “Cargo.toml” and the search query is “ar”, the prefix will be “C”, the search hit will be “ar”, the suffix will be “go.toml”, the next character will be “g” (the character immediately after the search hit)
The shortcut is assigned at a later stage and is used to quickly jump to the entry.
Fields§
§illegal_char_for_hotkey: Option<char>The character that shouldn’t appear in a hotkey sequence for the entry. That’s normally the first character of the name or first character after the search hit. The idea is to allow the user to be able finish writing out the entry name without jumping to the entry itself.
NOTE: that the character is converted to lowercase before being stored, since our search is case insensitive.
kind: &'a EntryKindThe kind of the entry, we need to keep track of this because we render directories differently than files.
key_combo_sequence: Option<Vec<KeyCombo>>The key combo sequence assigned to the entry, it’s an optional sequence of key combos.
Implementations§
Source§impl EntryRenderData<'_>
impl EntryRenderData<'_>
pub fn from_entry<T: AsRef<str>>( entry: &Entry, search_query: T, ) -> EntryRenderData<'_>
Trait Implementations§
Source§impl<'a> Debug for EntryRenderData<'a>
impl<'a> Debug for EntryRenderData<'a>
Source§impl<'a> From<EntryRenderData<'a>> for ListItem<'a>
impl<'a> From<EntryRenderData<'a>> for ListItem<'a>
Source§fn from(value: EntryRenderData<'a>) -> Self
fn from(value: EntryRenderData<'a>) -> Self
Source§impl<'a> PartialEq for EntryRenderData<'a>
impl<'a> PartialEq for EntryRenderData<'a>
impl<'a> StructuralPartialEq for EntryRenderData<'a>
Auto Trait Implementations§
impl<'a> Freeze for EntryRenderData<'a>
impl<'a> RefUnwindSafe for EntryRenderData<'a>
impl<'a> Send for EntryRenderData<'a>
impl<'a> Sync for EntryRenderData<'a>
impl<'a> Unpin for EntryRenderData<'a>
impl<'a> UnwindSafe for EntryRenderData<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more