pub struct AnniWorkspace { /* private fields */ }Implementations§
Source§impl AnniWorkspace
impl AnniWorkspace
Sourcepub unsafe fn new_unchecked(dot_anni: PathBuf) -> Self
pub unsafe fn new_unchecked(dot_anni: PathBuf) -> Self
§Safety
If you’re sure that the directory is .anni, you can use this method to avoid unnecessary checking steps.
Sourcepub fn new() -> Result<Self, WorkspaceError>
pub fn new() -> Result<Self, WorkspaceError>
Find AnniWorkspace from current working directory.
Sourcepub fn open<P>(path: P) -> Result<Self, WorkspaceError>
pub fn open<P>(path: P) -> Result<Self, WorkspaceError>
Open a AnniWorkspace from given path.
If the path is not a valid workspace, WorkspaceError::NotAWorkspace will be returned.
Sourcepub fn find<P>(path: P) -> Result<Self, WorkspaceError>
pub fn find<P>(path: P) -> Result<Self, WorkspaceError>
Find and open a AnniWorkspace from given path.
This method will try to open all parent directories until it finds a valid workspace. If workspace is not found, WorkspaceError::WorkspaceNotFound will be returned.
Sourcepub fn workspace_root(&self) -> &Path
pub fn workspace_root(&self) -> &Path
Get root path of the workspace
Sourcepub fn objects_root(&self) -> PathBuf
pub fn objects_root(&self) -> PathBuf
Get root path of internal audio files
Sourcepub fn get_album_id<P>(&self, path: P) -> Result<Uuid, WorkspaceError>
pub fn get_album_id<P>(&self, path: P) -> Result<Uuid, WorkspaceError>
Get album id from symlink target.
Returns WorkspaceError::NotAnAlbum if the symlink is not valid.
Sourcepub fn get_album_controlled_path(
&self,
album_id: &Uuid,
) -> Result<PathBuf, WorkspaceError>
pub fn get_album_controlled_path( &self, album_id: &Uuid, ) -> Result<PathBuf, WorkspaceError>
Get controlled path of an album with album id.
Sourcepub fn controlled_album_path(&self, album_id: &Uuid, layer: usize) -> PathBuf
pub fn controlled_album_path(&self, album_id: &Uuid, layer: usize) -> PathBuf
Get album path with given album_id in workspace with no extra checks.
pub fn strict_album_path( root: PathBuf, album_id: &Uuid, layer: usize, ) -> PathBuf
Sourcepub fn get_workspace_album<P>(
&self,
path: P,
) -> Result<WorkspaceAlbum, WorkspaceError>
pub fn get_workspace_album<P>( &self, path: P, ) -> Result<WorkspaceAlbum, WorkspaceError>
Try to get WorkspaceAlbum from given path
Sourcepub fn scan(&self) -> Result<Vec<WorkspaceAlbum>, WorkspaceError>
pub fn scan(&self) -> Result<Vec<WorkspaceAlbum>, WorkspaceError>
Scan the whole workspace and return all available albums
Sourcepub fn create_album<P>(
&self,
album_id: &Uuid,
userland_path: P,
discs: NonZeroU8,
) -> Result<(), WorkspaceError>
pub fn create_album<P>( &self, album_id: &Uuid, userland_path: P, discs: NonZeroU8, ) -> Result<(), WorkspaceError>
Create album with given album_id and discs at given path
Creation would fail if:
- Album with given
album_idalready exists in workspace - Directory at
pathis an album directory
pub fn to_repository_manager(&self) -> Result<RepositoryManager, WorkspaceError>
pub fn get_config(&self) -> Result<WorkspaceConfig, WorkspaceError>
Source§impl AnniWorkspace
impl AnniWorkspace
Sourcepub fn get_untracked_album_overview<P>(
&self,
album_path: P,
) -> Result<UntrackedWorkspaceAlbum, WorkspaceError>
pub fn get_untracked_album_overview<P>( &self, album_path: P, ) -> Result<UntrackedWorkspaceAlbum, WorkspaceError>
Take a overview of an untracked album directory.
If the path provided is not an UNTRACKED album directory, or the album is incomplete, an error will be returned.
Sourcepub fn commit<P, V>(
&self,
path: P,
validator: Option<V>,
) -> Result<Uuid, WorkspaceError>
pub fn commit<P, V>( &self, path: P, validator: Option<V>, ) -> Result<Uuid, WorkspaceError>
Add album to workspace
Untracked -> Committed
Import tag from committed album.
pub fn revert<P>(&self, path: P) -> Result<(), WorkspaceError>
pub fn publish<P>( &self, album_path: P, soft: bool, ) -> Result<(), WorkspaceError>
Auto Trait Implementations§
impl Freeze for AnniWorkspace
impl RefUnwindSafe for AnniWorkspace
impl Send for AnniWorkspace
impl Sync for AnniWorkspace
impl Unpin for AnniWorkspace
impl UnwindSafe for AnniWorkspace
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more