[][src]Struct binary_install::Cache

pub struct Cache { /* fields omitted */ }

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

Methods

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(
    &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.

Trait Implementations

impl Debug for Cache[src]

Auto Trait Implementations

impl Send for Cache

impl Sync for Cache

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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