Struct LogRepository

Source
pub struct LogRepository { /* private fields */ }
Expand description

Represents a devlog repository

Implementations§

Source§

impl LogRepository

Source

pub fn new(p: &Path) -> LogRepository

Creates a handle to the devlog repository at the specified path. The directory may or may not exist.

Source

pub fn initialized(&self) -> Result<bool, Error>

Checks if the repository has been initialized.

Source

pub fn init(&self) -> Result<LogPath, Error>

Initializes the repository. This creates the directory if it does not exist, as well as the first devlog entry file with sequence number one. Fails with an IOError if the first devlog entry already exists.

Source

pub fn path(&self) -> &Path

Returns the path to the repository directory, which may or may not exist.

Source

pub fn list(&self) -> Result<Vec<LogPath>, Error>

Returns all paths to devlog entry files in the repository. The paths are not necessarily ordered.

Source

pub fn tail(&self, limit: usize) -> Result<Vec<LogPath>, Error>

Returns the most recent devlog entry file paths. limit is the maximum number of paths that may be returned.

Source

pub fn latest(&self) -> Result<Option<LogPath>, Error>

Returns the most recent devlog entry file path, or None if the repository has not yet been initialized.

Source

pub fn nth_from_latest(&self, n: usize) -> Result<Option<LogPath>, Error>

Returns the “nth” most recent devlog entry file path. For example, n=0 is the most recent entry, n=1 is the second most recent entry, and so on. Returns None if the repository has not yet been initialized.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.