[][src]Struct binary_install::Cache

pub struct Cache {
    pub destination: PathBuf,
}

Global cache for wasm-pack, currently containing binaries downloaded from urls like wasm-bindgen and such.

Fields

destination: PathBuf

Implementations

impl Cache[src]

pub fn new(name: &str) -> Result<Cache, Error>[src]

Returns the global cache directory, as inferred from env vars and such.

This function may return an error if a cache directory cannot be determined.

pub fn at(path: &Path) -> Cache[src]

Creates a new cache specifically at a particular directory, useful in testing and such.

pub fn join(&self, path: &Path) -> PathBuf[src]

Joins a path to the destination of this cache, returning the result

pub fn download_version(
    &self,
    install_permitted: bool,
    name: &str,
    binaries: &[&str],
    url: &str,
    version: &str
) -> Result<Option<Download>, Error>
[src]

Downloads a tarball or zip file from the specified url, extracting it to a directory with the version number and returning the directory that the contents were extracted into.

Note that this function requries that the contents of url never change as the contents of the url are globally cached on the system and never invalidated.

The name is a human-readable name used to go into the folder name of the destination, and binaries is a list of binaries expected to be at the url. If the URL's extraction doesn't contain all the binaries this function will return an error.

pub fn download(
    &self,
    install_permitted: bool,
    name: &str,
    binaries: &[&str],
    url: &str
) -> Result<Option<Download>, Error>
[src]

Downloads a tarball or zip file from the specified url, extracting it locally and returning the directory that the contents were extracted into.

Note that this function requries that the contents of url never change as the contents of the url are globally cached on the system and never invalidated.

The name is a human-readable name used to go into the folder name of the destination, and binaries is a list of binaries expected to be at the url. If the URL's extraction doesn't contain all the binaries this function will return an error.

pub fn download_artifact(
    &self,
    name: &str,
    url: &str
) -> Result<Option<Download>, Error>
[src]

Downloads a tarball from the specified url, extracting it locally and returning the directory that the contents were extracted into.

Similar to download; use this function for languages that doesn't emit a binary.

pub fn download_artifact_version(
    &self,
    name: &str,
    url: &str,
    version: &str
) -> Result<Option<Download>, Error>
[src]

Downloads a tarball from the specified url, extracting it locally and returning the directory that the contents were extracted into.

Similar to download; use this function for languages that doesn't emit a binary.

Trait Implementations

impl Debug for Cache[src]

Auto Trait Implementations

impl RefUnwindSafe for Cache

impl Send for Cache

impl Sync for Cache

impl Unpin for Cache

impl UnwindSafe for Cache

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.