pub struct Repository { /* private fields */ }
Expand description
Git repository for a Rust advisory DB.
Implementations§
Source§impl Repository
impl Repository
Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
Location of the default advisory-db
repository for crates.io
Sourcepub fn fetch_default_repo() -> Result<Self, Error>
pub fn fetch_default_repo() -> Result<Self, Error>
Fetch the default repository.
§Locking
This function will wait for up to 5 minutes for the filesystem lock on the repository.
It will fail with rustsec::Error::LockTimeout
if the lock is still held
after that time. Use Repository::fetch if you need to configure locking behavior.
Sourcepub fn fetch<P: Into<PathBuf>>(
url: &str,
into_path: P,
ensure_fresh: bool,
lock_timeout: Duration,
) -> Result<Self, Error>
pub fn fetch<P: Into<PathBuf>>( url: &str, into_path: P, ensure_fresh: bool, lock_timeout: Duration, ) -> Result<Self, Error>
Create a new Repository
with the given URL and path, and fetch its contents.
§Locking
This function will wait for up to lock_timeout
for the filesystem lock on the repository.
It will fail with rustsec::Error::LockTimeout
if the lock is still held
after that time.
If lock_timeout
is set to std::time::Duration::from_secs(0)
, it will not wait at all,
and instead return an error immediately if it fails to aquire the lock.
Sourcepub fn open<P: Into<PathBuf>>(into_path: P) -> Result<Self, Error>
pub fn open<P: Into<PathBuf>>(into_path: P) -> Result<Self, Error>
Open a repository at the given path
Sourcepub fn latest_commit(&self) -> Result<Commit, Error>
pub fn latest_commit(&self) -> Result<Commit, Error>
Get information about the latest commit to the repo
Sourcepub fn has_relative_path(&self, path: &Path) -> bool
pub fn has_relative_path(&self, path: &Path) -> bool
Determines if the tree pointed to by HEAD
contains the specified path
Auto Trait Implementations§
impl !Freeze for Repository
impl !RefUnwindSafe for Repository
impl Send for Repository
impl !Sync for Repository
impl Unpin for Repository
impl !UnwindSafe for Repository
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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