pub struct ItemId { /* private fields */ }Expand description
Identifier used to select a tracked item by name and index.
Use this when:
- you know the shared
nameand want the first match (ItemId::id("name")), - or when you need a specific duplicate (
ItemId::with_index("name", i)).
ItemId::database_id() is special and points to the database root itself.
§Examples
use file_database::ItemId;
let first = ItemId::id("report.txt");
let second = ItemId::with_index("report.txt", 1);
let root = ItemId::database_id();
assert_eq!(first.get_name(), "report.txt");
assert_eq!(first.get_index(), 0);
assert_eq!(second.get_index(), 1);
assert_eq!(root.get_name(), "");Implementations§
Source§impl ItemId
impl ItemId
Sourcepub fn database_id() -> Self
pub fn database_id() -> Self
Returns the ItemId::database_id() for the database itself.
§Examples
use file_database::ItemId;
let root = ItemId::database_id();
assert_eq!(root.get_name(), "");
assert_eq!(root.get_index(), 0);Sourcepub fn with_index(id: impl Into<String>, index: usize) -> Self
pub fn with_index(id: impl Into<String>, index: usize) -> Self
Trait Implementations§
Source§impl Ord for ItemId
impl Ord for ItemId
Source§impl PartialOrd for ItemId
impl PartialOrd for ItemId
impl Eq for ItemId
impl StructuralPartialEq for ItemId
Auto Trait Implementations§
impl Freeze for ItemId
impl RefUnwindSafe for ItemId
impl Send for ItemId
impl Sync for ItemId
impl Unpin for ItemId
impl UnsafeUnpin for ItemId
impl UnwindSafe for ItemId
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