Struct rustwide::Crate

source ·
pub struct Crate(_);
Expand description

A Rust crate that can be used with rustwide.

Implementations§

source§

impl Crate

source

pub fn registry( registry: AlternativeRegistry, name: &str, version: &str ) -> Self

Load a crate from specified registry.

source

pub fn crates_io(name: &str, version: &str) -> Self

Load a crate from the crates.io registry.

source

pub fn git(url: &str) -> Self

Load a crate from a git repository. The full URL needed to clone the repo has to be provided.

source

pub fn local(path: &Path) -> Self

Load a crate from a directory in the local filesystem.

source

pub fn fetch(&self, workspace: &Workspace) -> Result<(), Error>

Fetch the crate’s source code and cache it in the workspace. This method will reach out to the network for some crate types.

source

pub fn purge_from_cache(&self, workspace: &Workspace) -> Result<(), Error>

Remove the cached copy of this crate. The method will do nothing if the crate isn’t cached.

source

pub fn git_commit(&self, workspace: &Workspace) -> Option<String>

Get this crate’s git commit. This method is best-effort, and currently works just for git crates. If the commit can’t be retrieved None will be returned.

Trait Implementations§

source§

impl Display for Crate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Crate

§

impl Send for Crate

§

impl Sync for Crate

§

impl Unpin for Crate

§

impl UnwindSafe for Crate

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.