pub trait RepositoryAccessor {
// Required methods
fn registry(&self) -> &Git2DB;
fn repo_id(&self) -> &RepoId;
// Provided methods
fn repo_path(&self) -> Git2DBResult<PathBuf> { ... }
fn open_repo(
&self,
) -> impl Future<Output = Git2DBResult<Repository>> + Send + '_
where Self: Sync { ... }
}Expand description
Trait for types that need to access repositories through the registry
This trait provides default implementations for common operations like getting the repository path and opening the repository.
Required Methods§
Provided Methods§
Sourcefn repo_path(&self) -> Git2DBResult<PathBuf>
fn repo_path(&self) -> Git2DBResult<PathBuf>
Get the repository worktree path
Sourcefn open_repo(
&self,
) -> impl Future<Output = Git2DBResult<Repository>> + Send + '_where
Self: Sync,
fn open_repo(
&self,
) -> impl Future<Output = Git2DBResult<Repository>> + Send + '_where
Self: Sync,
Open the git repository (async, uses spawn_blocking)
Opens a fresh Repository instance. Note that git2::Repository is not thread-safe, so each call creates a new instance.
This method uses spawn_blocking to avoid blocking the async executor,
following the pattern from CLAUDE.md for libgit2 operations.
Returns an impl Future + Send to explicitly ensure Send-safety.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.