pub struct Bookmark {
pub name: String,
pub path: Option<PathBuf>,
pub items: Vec<Bookmark>,
pub expanded: bool,
}Expand description
One entry in the bookmarks list: either a directory shortcut (has a path),
a folder grouping nested entries (non-empty items), or both.
Fields§
§name: String§path: Option<PathBuf>The directory this entry opens. None for a pure folder.
items: Vec<Bookmark>Nested entries. A non-empty list makes this a folder, expanded or
collapsed with expanded.
expanded: boolWhether a folder starts expanded. Serialized only when true.
Implementations§
Source§impl Bookmark
impl Bookmark
Sourcepub fn default_name(path: &Path) -> String
pub fn default_name(path: &Path) -> String
The default label for a bookmark pointing at path: the directory’s own
name (falling back to the full path for roots and odd spellings).
Sourcepub fn is_folder(&self) -> bool
pub fn is_folder(&self) -> bool
Whether this entry is a folder. Anything without a path is a folder (including an empty one just created); an entry with both a path and children is both clickable and a container.
Sourcepub fn contains_path(entries: &[Bookmark], path: &Path) -> bool
pub fn contains_path(entries: &[Bookmark], path: &Path) -> bool
Whether any entry in the tree points at path.
Sourcepub fn get<'a>(
entries: &'a [Bookmark],
index_path: &[usize],
) -> Option<&'a Bookmark>
pub fn get<'a>( entries: &'a [Bookmark], index_path: &[usize], ) -> Option<&'a Bookmark>
The entry at an index path (each element indexes into the next level).
Sourcepub fn get_mut<'a>(
entries: &'a mut [Bookmark],
index_path: &[usize],
) -> Option<&'a mut Bookmark>
pub fn get_mut<'a>( entries: &'a mut [Bookmark], index_path: &[usize], ) -> Option<&'a mut Bookmark>
The entry at an index path (each element indexes into the next level), mutably.
Sourcepub fn remove(entries: &mut Vec<Bookmark>, index_path: &[usize]) -> bool
pub fn remove(entries: &mut Vec<Bookmark>, index_path: &[usize]) -> bool
Remove the entry at index_path, returning whether it existed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Bookmark
impl<'de> Deserialize<'de> for Bookmark
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Bookmark
impl StructuralPartialEq for Bookmark
Auto Trait Implementations§
impl Freeze for Bookmark
impl RefUnwindSafe for Bookmark
impl Send for Bookmark
impl Sync for Bookmark
impl Unpin for Bookmark
impl UnsafeUnpin for Bookmark
impl UnwindSafe for Bookmark
Blanket Implementations§
Source§impl<C> AsyncPosition<()> for C
impl<C> AsyncPosition<()> for C
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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