pub struct GitRepo { /* private fields */ }Expand description
Newtype wrapper around git2::Repository.
Wraps the repository in a Mutex to satisfy Send + Sync bounds
required by the storage port traits, since git2::Repository is
not Sync by default.
Usage:
ⓘ
use auths_infra_git::GitRepo;
let repo = GitRepo::open("/path/to/repo")?;Implementations§
Source§impl GitRepo
impl GitRepo
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, StorageError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, StorageError>
Opens an existing Git repository at the given path.
Args:
path: Filesystem path to the repository root.
Usage:
ⓘ
let repo = GitRepo::open("/home/user/.auths")?;Sourcepub fn init(path: impl AsRef<Path>) -> Result<Self, StorageError>
pub fn init(path: impl AsRef<Path>) -> Result<Self, StorageError>
Initializes a new Git repository at the given path.
Args:
path: Filesystem path where the repository will be created.
Usage:
ⓘ
let repo = GitRepo::init("/tmp/new-repo")?;pub fn path(&self) -> &Path
Auto Trait Implementations§
impl !Freeze for GitRepo
impl RefUnwindSafe for GitRepo
impl Send for GitRepo
impl Sync for GitRepo
impl Unpin for GitRepo
impl UnsafeUnpin for GitRepo
impl UnwindSafe for GitRepo
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