pub struct TimeFile {
pub path: PathBuf,
pub header: FileHeader,
/* private fields */
}Expand description
The complete .atime file — a temporal graph stored as a binary file.
Fields§
§path: PathBufFile path.
header: FileHeaderHeader.
Implementations§
Source§impl TimeFile
impl TimeFile
Sourcepub fn create(path: impl Into<PathBuf>) -> TimeResult<Self>
pub fn create(path: impl Into<PathBuf>) -> TimeResult<Self>
Create a new empty .atime file.
Sourcepub fn open(path: impl Into<PathBuf>) -> TimeResult<Self>
pub fn open(path: impl Into<PathBuf>) -> TimeResult<Self>
Open an existing .atime file.
Sourcepub fn save(&self) -> TimeResult<()>
pub fn save(&self) -> TimeResult<()>
Save to disk (atomic write: temp + rename).
Sourcepub fn add<T: Serialize>(
&mut self,
entity_type: EntityType,
id: TemporalId,
entity: &T,
) -> TimeResult<()>
pub fn add<T: Serialize>( &mut self, entity_type: EntityType, id: TemporalId, entity: &T, ) -> TimeResult<()>
Add or replace an entity.
Sourcepub fn get<T: for<'de> Deserialize<'de>>(
&self,
id: &TemporalId,
) -> TimeResult<Option<T>>
pub fn get<T: for<'de> Deserialize<'de>>( &self, id: &TemporalId, ) -> TimeResult<Option<T>>
Get an entity by ID.
Sourcepub fn remove(&mut self, id: &TemporalId) -> bool
pub fn remove(&mut self, id: &TemporalId) -> bool
Remove an entity by ID.
Sourcepub fn list_by_type(&self, entity_type: EntityType) -> Vec<&EntityBlock>
pub fn list_by_type(&self, entity_type: EntityType) -> Vec<&EntityBlock>
List all entity blocks of a given type.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Total number of entities.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimeFile
impl RefUnwindSafe for TimeFile
impl Send for TimeFile
impl Sync for TimeFile
impl Unpin for TimeFile
impl UnsafeUnpin for TimeFile
impl UnwindSafe for TimeFile
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