pub struct Index { /* private fields */ }Expand description
Parsed index file.
Implementations§
Source§impl Index
impl Index
Sourcepub fn parse<R>(reader: R) -> Result<Index, CliTableError>where
R: BufRead,
pub fn parse<R>(reader: R) -> Result<Index, CliTableError>where
R: BufRead,
Parse an index from a reader.
Sourcepub fn from_file<P>(path: P) -> Result<Index, CliTableError>
pub fn from_file<P>(path: P) -> Result<Index, CliTableError>
Parse an index from a file.
Sourcepub fn find_match(
&self,
attributes: &HashMap<String, String>,
) -> Option<&IndexEntry>
pub fn find_match( &self, attributes: &HashMap<String, String>, ) -> Option<&IndexEntry>
Find the first matching entry for the given attributes.
Returns the first entry where all provided attributes match. Attributes not present in the index are silently ignored.
Sourcepub fn find_all_matches(
&self,
attributes: &HashMap<String, String>,
) -> Vec<&IndexEntry>
pub fn find_all_matches( &self, attributes: &HashMap<String, String>, ) -> Vec<&IndexEntry>
Get all matching entries.
Sourcepub fn entries(&self) -> &[IndexEntry]
pub fn entries(&self) -> &[IndexEntry]
Get all entries.
Sourcepub fn all_templates(&self) -> Vec<&str>
pub fn all_templates(&self) -> Vec<&str>
Get all unique template names referenced in this index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
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