pub struct Directory {
pub sort: SortOrder,
pub defaults_offered: Vec<String>,
pub entries: Vec<Entry>,
}Fields§
§sort: SortOrderHow the list is shown.
defaults_offered: Vec<String>Default entries already offered to this directory (by
Entry::system_id), so one the user deleted does not come back.
entries: Vec<Entry>Implementations§
Source§impl Directory
impl Directory
Sourcepub fn groups(&self) -> Vec<String>
pub fn groups(&self) -> Vec<String>
The groups entries are in, in order, without repeats (ignoring case).
Sourcepub fn load(path: &Path) -> Result<Directory>
pub fn load(path: &Path) -> Result<Directory>
Load the directory, returning an empty one if the file does not exist.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Save atomically (write to a temporary file, then rename).
Sourcepub fn view(&self, filter: &str) -> Vec<usize>
pub fn view(&self, filter: &str) -> Vec<usize>
Indices of the entries to list, in self.sort order, keeping those
whose name, address or comment contains filter (ignoring case).
Sourcepub fn view_group(&self, filter: &str, group: Option<&str>) -> Vec<usize>
pub fn view_group(&self, filter: &str, group: Option<&str>) -> Vec<usize>
Directory::view, of one group’s entries.
Sourcepub fn offer_defaults(&mut self) -> bool
pub fn offer_defaults(&mut self) -> bool
Add any default entries this directory has not been offered before. Returns true if the directory changed and should be saved.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Directory
impl<'de> Deserialize<'de> for Directory
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Directory
impl StructuralPartialEq for Directory
Auto Trait Implementations§
impl Freeze for Directory
impl RefUnwindSafe for Directory
impl Send for Directory
impl Sync for Directory
impl Unpin for Directory
impl UnsafeUnpin for Directory
impl UnwindSafe for Directory
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
Mutably borrows from an owned value. Read more
Source§impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
Source§fn default_with_context(_: Ctx) -> T
fn default_with_context(_: Ctx) -> T
Creates a default value with the given context.