pub struct Inventory {
pub version: u32,
pub worktrees: Vec<PoolEntry>,
}Expand description
The pool inventory stored as JSON
Fields§
§version: u32§worktrees: Vec<PoolEntry>Implementations§
Source§impl Inventory
impl Inventory
Sourcepub fn load(path: &Path) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Load inventory from a file, or create a new one if it doesn’t exist
Sourcepub fn count_by_status(&self, status: &WorktreeStatus) -> usize
pub fn count_by_status(&self, status: &WorktreeStatus) -> usize
Count worktrees with a given status
Sourcepub fn find_available(&self) -> Option<usize>
pub fn find_available(&self) -> Option<usize>
Find the first available worktree
Sourcepub fn find_by_name_or_path(&self, identifier: &str) -> Option<usize>
pub fn find_by_name_or_path(&self, identifier: &str) -> Option<usize>
Find a worktree by name or path
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Inventory
impl<'de> Deserialize<'de> for Inventory
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
Auto Trait Implementations§
impl Freeze for Inventory
impl RefUnwindSafe for Inventory
impl Send for Inventory
impl Sync for Inventory
impl Unpin for Inventory
impl UnsafeUnpin for Inventory
impl UnwindSafe for Inventory
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