diff --git a/index.html b/index.html new file mode 100644 index 000000000..1ecf2cb54 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +main diff --git a/main/.lock b/main/.lock new file mode 100644 index 000000000..e69de29bb diff --git a/main/archive/all.html b/main/archive/all.html new file mode 100644 index 000000000..4f8659be1 --- /dev/null +++ b/main/archive/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Functions

\ No newline at end of file diff --git a/main/archive/enum.ArchiveError.html b/main/archive/enum.ArchiveError.html new file mode 100644 index 000000000..36ca43572 --- /dev/null +++ b/main/archive/enum.ArchiveError.html @@ -0,0 +1,20 @@ +ArchiveError in archive - Rust
pub enum ArchiveError {
+    HttpError(StatusCode),
+    MissingHeaderError(&'static HeaderName),
+    UnexpectedContentLengthError(u64),
+    IoError(Error),
+    AttohttpcError(Error),
+    ZipError(ZipError),
+}
Expand description

Error type for this crate

+

Variants§

§

HttpError(StatusCode)

§

MissingHeaderError(&'static HeaderName)

§

UnexpectedContentLengthError(u64)

§

IoError(Error)

§

AttohttpcError(Error)

§

ZipError(ZipError)

Trait Implementations§

source§

impl Debug for ArchiveError

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ArchiveError

source§

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

Formats the value using the given formatter. Read more
source§

impl Error for ArchiveError

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Error> for ArchiveError

source§

fn from(source: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for ArchiveError

source§

fn from(source: Error) -> Self

Converts to this type from the input type.
source§

impl From<ZipError> for ArchiveError

source§

fn from(source: ZipError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
\ No newline at end of file diff --git a/main/archive/enum.Origin.html b/main/archive/enum.Origin.html new file mode 100644 index 000000000..f42850968 --- /dev/null +++ b/main/archive/enum.Origin.html @@ -0,0 +1,16 @@ +Origin in archive - Rust

Enum archive::Origin

source ·
pub enum Origin {
+    Local,
+    Remote,
+}
Expand description

Metadata describing whether an archive comes from a local or remote origin.

+

Variants§

§

Local

§

Remote

Trait Implementations§

source§

impl Clone for Origin

source§

fn clone(&self) -> Origin

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Copy for Origin

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
\ No newline at end of file diff --git a/main/archive/fn.content_length.html b/main/archive/fn.content_length.html new file mode 100644 index 000000000..6fdc75bbf --- /dev/null +++ b/main/archive/fn.content_length.html @@ -0,0 +1,3 @@ +content_length in archive - Rust

Function archive::content_length

source ·
pub(crate) fn content_length(headers: &HeaderMap) -> Result<u64, ArchiveError>
Expand description

Determines the length of an HTTP response’s content in bytes, using +the HTTP "Content-Length" header.

+
\ No newline at end of file diff --git a/main/archive/fn.fetch_native.html b/main/archive/fn.fetch_native.html new file mode 100644 index 000000000..629c9a32e --- /dev/null +++ b/main/archive/fn.fetch_native.html @@ -0,0 +1,8 @@ +fetch_native in archive - Rust

Function archive::fetch_native

source ·
pub fn fetch_native(
+    url: &str,
+    cache_file: &Path
+) -> Result<Box<dyn Archive>, ArchiveError>
Expand description

Fetch a remote archive in the native OS-preferred format from the specified +URL and store its results at the specified file path.

+

On Windows, the preferred format is zip. On Unixes, the preferred format +is tarball.

+
\ No newline at end of file diff --git a/main/archive/fn.load_native.html b/main/archive/fn.load_native.html new file mode 100644 index 000000000..23f012990 --- /dev/null +++ b/main/archive/fn.load_native.html @@ -0,0 +1,4 @@ +load_native in archive - Rust

Function archive::load_native

source ·
pub fn load_native(source: File) -> Result<Box<dyn Archive>, ArchiveError>
Expand description

Load an archive in the native OS-preferred format from the specified file.

+

On Windows, the preferred format is zip. On Unixes, the preferred format +is tarball.

+
\ No newline at end of file diff --git a/main/archive/index.html b/main/archive/index.html new file mode 100644 index 000000000..402272fab --- /dev/null +++ b/main/archive/index.html @@ -0,0 +1,8 @@ +archive - Rust

Crate archive

source ·
Expand description

This crate provides types for fetching and unpacking compressed +archives in tarball or zip format.

+

Modules

  • tarball 🔒
    Provides types and functions for fetching and unpacking a Node installation +tarball in Unix operating systems.
  • zip 🔒
    Provides types and functions for fetching and unpacking a Node installation +zip file in Windows operating systems.

Structs

Enums

  • Error type for this crate
  • Metadata describing whether an archive comes from a local or remote origin.

Traits

Functions

  • Determines the length of an HTTP response’s content in bytes, using +the HTTP "Content-Length" header.
  • Fetch a remote archive in the native OS-preferred format from the specified +URL and store its results at the specified file path.
  • Load an archive in the native OS-preferred format from the specified file.
\ No newline at end of file diff --git a/main/archive/sidebar-items.js b/main/archive/sidebar-items.js new file mode 100644 index 000000000..eb95f8ac3 --- /dev/null +++ b/main/archive/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ArchiveError","Origin"],"fn":["content_length","fetch_native","load_native"],"mod":["tarball","zip"],"struct":["Tarball","Zip"],"trait":["Archive"]}; \ No newline at end of file diff --git a/main/archive/struct.Tarball.html b/main/archive/struct.Tarball.html new file mode 100644 index 000000000..6a9dd4d26 --- /dev/null +++ b/main/archive/struct.Tarball.html @@ -0,0 +1,27 @@ +Tarball in archive - Rust

Struct archive::Tarball

source ·
pub struct Tarball {
+    compressed_size: u64,
+    data: Box<dyn Read>,
+    origin: Origin,
+}
Expand description

A Node installation tarball.

+

Fields§

§compressed_size: u64§data: Box<dyn Read>§origin: Origin

Implementations§

source§

impl Tarball

source

pub fn load(source: File) -> Result<Box<dyn Archive>, ArchiveError>

Loads a tarball from the specified file.

+
source

pub fn fetch( + url: &str, + cache_file: &Path +) -> Result<Box<dyn Archive>, ArchiveError>

Initiate fetching of a tarball from the given URL, returning a +tarball that can be streamed (and that tees its data to a local +file as it streams).

+

Trait Implementations§

source§

impl Archive for Tarball

source§

fn compressed_size(&self) -> u64

source§

fn unpack( + self: Box<Self>, + dest: &Path, + progress: &mut dyn FnMut(&(), usize) +) -> Result<(), ArchiveError>

Unpacks the zip archive to the specified destination folder.
source§

fn origin(&self) -> Origin

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tarball

§

impl !Send for Tarball

§

impl !Sync for Tarball

§

impl Unpin for Tarball

§

impl !UnwindSafe for Tarball

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> Same for T

§

type Output = T

Should always be Self
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.
\ No newline at end of file diff --git a/main/archive/struct.Zip.html b/main/archive/struct.Zip.html new file mode 100644 index 000000000..945396101 --- /dev/null +++ b/main/archive/struct.Zip.html @@ -0,0 +1,25 @@ +Zip in archive - Rust

Struct archive::Zip

source ·
pub struct Zip {
+    compressed_size: u64,
+    data: Box<dyn Read>,
+    origin: Origin,
+}

Fields§

§compressed_size: u64§data: Box<dyn Read>§origin: Origin

Implementations§

source§

impl Zip

source

pub fn load(source: File) -> Result<Box<dyn Archive>, ArchiveError>

Loads a cached Node zip archive from the specified file.

+
source

pub fn fetch( + url: &str, + cache_file: &Path +) -> Result<Box<dyn Archive>, ArchiveError>

Initiate fetching of a Node zip archive from the given URL, returning +a Remote data source.

+

Trait Implementations§

source§

impl Archive for Zip

source§

fn compressed_size(&self) -> u64

source§

fn unpack( + self: Box<Self>, + dest: &Path, + progress: &mut dyn FnMut(&(), usize) +) -> Result<(), ArchiveError>

Unpacks the zip archive to the specified destination folder.
source§

fn origin(&self) -> Origin

Auto Trait Implementations§

§

impl !RefUnwindSafe for Zip

§

impl !Send for Zip

§

impl !Sync for Zip

§

impl Unpin for Zip

§

impl !UnwindSafe for Zip

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> Same for T

§

type Output = T

Should always be Self
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.
\ No newline at end of file diff --git a/main/archive/tarball/index.html b/main/archive/tarball/index.html new file mode 100644 index 000000000..0f1538eaa --- /dev/null +++ b/main/archive/tarball/index.html @@ -0,0 +1,3 @@ +archive::tarball - Rust

Module archive::tarball

source ·
Expand description

Provides types and functions for fetching and unpacking a Node installation +tarball in Unix operating systems.

+

Structs

  • A Node installation tarball.
\ No newline at end of file diff --git a/main/archive/tarball/sidebar-items.js b/main/archive/tarball/sidebar-items.js new file mode 100644 index 000000000..a2593cdef --- /dev/null +++ b/main/archive/tarball/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Tarball"]}; \ No newline at end of file diff --git a/main/archive/tarball/struct.Tarball.html b/main/archive/tarball/struct.Tarball.html new file mode 100644 index 000000000..3034bf08e --- /dev/null +++ b/main/archive/tarball/struct.Tarball.html @@ -0,0 +1,27 @@ +Tarball in archive::tarball - Rust

Struct archive::tarball::Tarball

source ·
pub struct Tarball {
+    compressed_size: u64,
+    data: Box<dyn Read>,
+    origin: Origin,
+}
Expand description

A Node installation tarball.

+

Fields§

§compressed_size: u64§data: Box<dyn Read>§origin: Origin

Implementations§

source§

impl Tarball

source

pub fn load(source: File) -> Result<Box<dyn Archive>, ArchiveError>

Loads a tarball from the specified file.

+
source

pub fn fetch( + url: &str, + cache_file: &Path +) -> Result<Box<dyn Archive>, ArchiveError>

Initiate fetching of a tarball from the given URL, returning a +tarball that can be streamed (and that tees its data to a local +file as it streams).

+

Trait Implementations§

source§

impl Archive for Tarball

source§

fn compressed_size(&self) -> u64

source§

fn unpack( + self: Box<Self>, + dest: &Path, + progress: &mut dyn FnMut(&(), usize) +) -> Result<(), ArchiveError>

Unpacks the zip archive to the specified destination folder.
source§

fn origin(&self) -> Origin

Auto Trait Implementations§

§

impl !RefUnwindSafe for Tarball

§

impl !Send for Tarball

§

impl !Sync for Tarball

§

impl Unpin for Tarball

§

impl !UnwindSafe for Tarball

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> Same for T

§

type Output = T

Should always be Self
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.
\ No newline at end of file diff --git a/main/archive/trait.Archive.html b/main/archive/trait.Archive.html new file mode 100644 index 000000000..a8debce9e --- /dev/null +++ b/main/archive/trait.Archive.html @@ -0,0 +1,15 @@ +Archive in archive - Rust

Trait archive::Archive

source ·
pub trait Archive {
+    // Required methods
+    fn compressed_size(&self) -> u64;
+    fn unpack(
+        self: Box<Self>,
+        dest: &Path,
+        progress: &mut dyn FnMut(&(), usize)
+    ) -> Result<(), ArchiveError>;
+    fn origin(&self) -> Origin;
+}

Required Methods§

source

fn compressed_size(&self) -> u64

source

fn unpack( + self: Box<Self>, + dest: &Path, + progress: &mut dyn FnMut(&(), usize) +) -> Result<(), ArchiveError>

Unpacks the zip archive to the specified destination folder.

+
source

fn origin(&self) -> Origin

Implementors§

\ No newline at end of file diff --git a/main/archive/zip/index.html b/main/archive/zip/index.html new file mode 100644 index 000000000..05ece3312 --- /dev/null +++ b/main/archive/zip/index.html @@ -0,0 +1,3 @@ +archive::zip - Rust

Module archive::zip

source ·
Expand description

Provides types and functions for fetching and unpacking a Node installation +zip file in Windows operating systems.

+

Structs

\ No newline at end of file diff --git a/main/archive/zip/sidebar-items.js b/main/archive/zip/sidebar-items.js new file mode 100644 index 000000000..73fd6a9d2 --- /dev/null +++ b/main/archive/zip/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Zip"]}; \ No newline at end of file diff --git a/main/archive/zip/struct.Zip.html b/main/archive/zip/struct.Zip.html new file mode 100644 index 000000000..8a5af80fa --- /dev/null +++ b/main/archive/zip/struct.Zip.html @@ -0,0 +1,25 @@ +Zip in archive::zip - Rust

Struct archive::zip::Zip

source ·
pub struct Zip {
+    compressed_size: u64,
+    data: Box<dyn Read>,
+    origin: Origin,
+}

Fields§

§compressed_size: u64§data: Box<dyn Read>§origin: Origin

Implementations§

source§

impl Zip

source

pub fn load(source: File) -> Result<Box<dyn Archive>, ArchiveError>

Loads a cached Node zip archive from the specified file.

+
source

pub fn fetch( + url: &str, + cache_file: &Path +) -> Result<Box<dyn Archive>, ArchiveError>

Initiate fetching of a Node zip archive from the given URL, returning +a Remote data source.

+

Trait Implementations§

source§

impl Archive for Zip

source§

fn compressed_size(&self) -> u64

source§

fn unpack( + self: Box<Self>, + dest: &Path, + progress: &mut dyn FnMut(&(), usize) +) -> Result<(), ArchiveError>

Unpacks the zip archive to the specified destination folder.
source§

fn origin(&self) -> Origin

Auto Trait Implementations§

§

impl !RefUnwindSafe for Zip

§

impl !Send for Zip

§

impl !Sync for Zip

§

impl Unpin for Zip

§

impl !UnwindSafe for Zip

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> Same for T

§

type Output = T

Should always be Self
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.
\ No newline at end of file diff --git a/main/crates.js b/main/crates.js new file mode 100644 index 000000000..3141d02d2 --- /dev/null +++ b/main/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["archive","fs_utils","progress_read","test_support","validate_npm_package_name","volta","volta_core","volta_layout","volta_layout_macro","volta_migrate","volta_shim"]; \ No newline at end of file diff --git a/main/fs_utils/all.html b/main/fs_utils/all.html new file mode 100644 index 000000000..3d901215c --- /dev/null +++ b/main/fs_utils/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/main/fs_utils/fn.ensure_containing_dir_exists.html b/main/fs_utils/fn.ensure_containing_dir_exists.html new file mode 100644 index 000000000..f7baef14d --- /dev/null +++ b/main/fs_utils/fn.ensure_containing_dir_exists.html @@ -0,0 +1,2 @@ +ensure_containing_dir_exists in fs_utils - Rust
pub fn ensure_containing_dir_exists<P: AsRef<Path>>(path: &P) -> Result<()>
Expand description

This creates the parent directory of the input path, assuming the input path is a file.

+
\ No newline at end of file diff --git a/main/fs_utils/index.html b/main/fs_utils/index.html new file mode 100644 index 000000000..5eb88563c --- /dev/null +++ b/main/fs_utils/index.html @@ -0,0 +1,3 @@ +fs_utils - Rust

Crate fs_utils

source ·
Expand description

This crate provides utilities for operating on the filesystem.

+

Functions

\ No newline at end of file diff --git a/main/fs_utils/sidebar-items.js b/main/fs_utils/sidebar-items.js new file mode 100644 index 000000000..8a68680fa --- /dev/null +++ b/main/fs_utils/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["ensure_containing_dir_exists"]}; \ No newline at end of file diff --git a/main/help.html b/main/help.html new file mode 100644 index 000000000..fd3b96d2f --- /dev/null +++ b/main/help.html @@ -0,0 +1 @@ +Help

Rustdoc help

Back
\ No newline at end of file diff --git a/main/index.html b/main/index.html new file mode 100644 index 000000000..0fcff0b86 --- /dev/null +++ b/main/index.html @@ -0,0 +1 @@ +volta diff --git a/main/progress_read/all.html b/main/progress_read/all.html new file mode 100644 index 000000000..e07e7a59c --- /dev/null +++ b/main/progress_read/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

\ No newline at end of file diff --git a/main/progress_read/index.html b/main/progress_read/index.html new file mode 100644 index 000000000..5c8f8fb93 --- /dev/null +++ b/main/progress_read/index.html @@ -0,0 +1,4 @@ +progress_read - Rust

Crate progress_read

source ·
Expand description

This crate provides an adapter for the std::io::Read trait to +allow reporting incremental progress to a callback function.

+

Structs

  • A reader that reports incremental progress while reading.
\ No newline at end of file diff --git a/main/progress_read/sidebar-items.js b/main/progress_read/sidebar-items.js new file mode 100644 index 000000000..daadabed7 --- /dev/null +++ b/main/progress_read/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["ProgressRead"]}; \ No newline at end of file diff --git a/main/progress_read/struct.ProgressRead.html b/main/progress_read/struct.ProgressRead.html new file mode 100644 index 000000000..f350e0f3c --- /dev/null +++ b/main/progress_read/struct.ProgressRead.html @@ -0,0 +1,45 @@ +ProgressRead in progress_read - Rust
pub struct ProgressRead<R: Read, T, F: FnMut(&T, usize) -> T> {
+    pub(crate) source: R,
+    pub(crate) accumulator: T,
+    pub(crate) progress: F,
+}
Expand description

A reader that reports incremental progress while reading.

+

Fields§

§source: R§accumulator: T§progress: F

Implementations§

source§

impl<R: Read, T, F: FnMut(&T, usize) -> T> ProgressRead<R, T, F>

source

pub fn new(source: R, init: T, progress: F) -> ProgressRead<R, T, F>

Construct a new progress reader with the specified underlying reader, +initial value for an accumulator, and progress callback.

+

Trait Implementations§

source§

impl<R: Read, T, F: FnMut(&T, usize) -> T> Read for ProgressRead<R, T, F>

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Read some bytes from the underlying reader into the specified buffer, +and report progress to the progress callback. The progress callback is +passed the current value of the accumulator as its first argument and +the number of bytes read as its second argument. The result of the +progress callback is stored as the updated value of the accumulator, +to be passed to the next invocation of the callback.

+
1.36.0 · source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored +implementation. Read more
1.0.0 · source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Read all bytes until EOF in this source, placing them into buf. Read more
1.0.0 · source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Read all bytes until EOF in this source, appending them to buf. Read more
1.6.0 · source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Read the exact number of bytes required to fill buf. Read more
source§

fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Read the exact number of bytes required to fill cursor. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

Creates a “by reference” adaptor for this instance of Read. Read more
1.0.0 · source§

fn bytes(self) -> Bytes<Self>where + Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · source§

fn chain<R>(self, next: R) -> Chain<Self, R>where + R: Read, + Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · source§

fn take(self, limit: u64) -> Take<Self>where + Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
source§

impl<R: Read + Seek, T, F: FnMut(&T, usize) -> T> Seek for ProgressRead<R, T, F>

source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Seek to an offset, in bytes, in a stream. Read more
1.55.0 · source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
1.51.0 · source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more

Auto Trait Implementations§

§

impl<R, T, F> RefUnwindSafe for ProgressRead<R, T, F>where + F: RefUnwindSafe, + R: RefUnwindSafe, + T: RefUnwindSafe,

§

impl<R, T, F> Send for ProgressRead<R, T, F>where + F: Send, + R: Send, + T: Send,

§

impl<R, T, F> Sync for ProgressRead<R, T, F>where + F: Sync, + R: Sync, + T: Sync,

§

impl<R, T, F> Unpin for ProgressRead<R, T, F>where + F: Unpin, + R: Unpin, + T: Unpin,

§

impl<R, T, F> UnwindSafe for ProgressRead<R, T, F>where + F: UnwindSafe, + R: UnwindSafe, + T: UnwindSafe,

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, 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.
\ No newline at end of file diff --git a/main/search-index.js b/main/search-index.js new file mode 100644 index 000000000..e4ac439c7 --- /dev/null +++ b/main/search-index.js @@ -0,0 +1,15 @@ +var searchIndex = JSON.parse('{\ +"archive":{"doc":"This crate provides types for fetching and unpacking …","t":"IENNNNNENDNDNLLLLLLKMMFMMFLLLLLLLLLFKMMLALLLLLLLLKADLLLMMLLLLLMLLLLDLLLMMLLLLLMLLLL","n":["Archive","ArchiveError","AttohttpcError","HttpError","IoError","Local","MissingHeaderError","Origin","Remote","Tarball","UnexpectedContentLengthError","Zip","ZipError","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","compressed_size","compressed_size","compressed_size","content_length","data","data","fetch_native","fmt","fmt","from","from","from","from","from","into","into","load_native","origin","origin","origin","source","tarball","to_owned","to_string","try_from","try_from","try_into","try_into","type_id","type_id","unpack","zip","Tarball","borrow","borrow_mut","compressed_size","compressed_size","data","fetch","from","into","load","origin","origin","try_from","try_into","type_id","unpack","Zip","borrow","borrow_mut","compressed_size","compressed_size","data","fetch","from","into","load","origin","origin","try_from","try_into","type_id","unpack"],"q":[[0,"archive"],[51,"archive::tarball"],[67,"archive::zip"],[83,"http::header::map"],[84,"core::result"],[85,"std::path"],[86,"alloc::boxed"],[87,"core::fmt"],[88,"core::fmt"],[89,"attohttpc::error"],[90,"zip::result"],[91,"std::fs"],[92,"core::error"],[93,"core::option"],[94,"alloc::string"],[95,"core::any"],[96,"core::ops::function"]],"d":["","Error type for this crate","","","","","","Metadata describing whether an archive comes from a local …","","A Node installation tarball.","","","","","","","","","","","","","Determines the length of an HTTP response’s content in …","","","Fetch a remote archive in the native OS-preferred format …","","","","Returns the argument unchanged.","","","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Load an archive in the native OS-preferred format from the …","","","","","Provides types and functions for fetching and unpacking a …","","","","","","","","","Unpacks the zip archive to the specified destination …","Provides types and functions for fetching and unpacking a …","A Node installation tarball.","","","","","","Initiate fetching of a tarball from the given URL, …","Returns the argument unchanged.","Calls U::from(self).","Loads a tarball from the specified file.","","","","","","","","","","","","","Initiate fetching of a Node zip archive from the given …","Returns the argument unchanged.","Calls U::from(self).","Loads a cached Node zip archive from the specified file.","","","","","",""],"i":[0,0,5,5,5,1,5,0,1,0,5,0,5,5,1,5,1,1,1,9,22,23,0,22,23,0,5,5,5,5,5,5,1,5,1,0,9,22,23,5,0,1,5,5,1,5,1,5,1,9,0,0,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,0,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[1,1],[[-1,-2],2,[],[]],[-1,3,[]],0,0,[4,[[6,[3,5]]]],0,0,[[7,8],[[6,[[10,[9]],5]]]],[[5,11],12],[[5,11],12],[13,5],[-1,-1,[]],[14,5],[15,5],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[16,[[6,[[10,[9]],5]]]],[-1,1,[]],0,0,[5,[[18,[17]]]],0,[-1,-2,[],[]],[-1,19,[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,20,[]],[-1,20,[]],[[[10,[-1]],8,21],[[6,[2,5]]],[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[22,3],0,0,[[7,8],[[6,[[10,[9]],5]]]],[-1,-1,[]],[-1,-2,[],[]],[16,[[6,[[10,[9]],5]]]],[22,1],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,20,[]],[[[10,[22]],8,21],[[6,[2,5]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[23,3],0,0,[[7,8],[[6,[[10,[9]],5]]]],[-1,-1,[]],[-1,-2,[],[]],[16,[[6,[[10,[9]],5]]]],[23,1],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,20,[]],[[[10,[23]],8,21],[[6,[2,5]]]]],"c":[],"p":[[4,"Origin",0],[15,"tuple"],[15,"u64"],[3,"HeaderMap",83],[4,"ArchiveError",0],[4,"Result",84],[15,"str"],[3,"Path",85],[8,"Archive",0],[3,"Box",86],[3,"Formatter",87],[6,"Result",87],[3,"Error",88],[3,"Error",89],[4,"ZipError",90],[3,"File",91],[8,"Error",92],[4,"Option",93],[3,"String",94],[3,"TypeId",95],[8,"FnMut",96],[3,"Tarball",51],[3,"Zip",67]],"b":[[26,"impl-Display-for-ArchiveError"],[27,"impl-Debug-for-ArchiveError"],[28,"impl-From%3CError%3E-for-ArchiveError"],[30,"impl-From%3CError%3E-for-ArchiveError"],[31,"impl-From%3CZipError%3E-for-ArchiveError"]]},\ +"fs_utils":{"doc":"This crate provides utilities for operating on the …","t":"F","n":["ensure_containing_dir_exists"],"q":[[0,"fs_utils"],[1,"std::io::error"],[2,"std::path"],[3,"core::convert"]],"d":["This creates the parent directory of the input path, …"],"i":[0],"f":[[-1,[[2,[1]]],[[4,[3]]]]],"c":[],"p":[[15,"tuple"],[6,"Result",1],[3,"Path",2],[8,"AsRef",3]],"b":[]},\ +"progress_read":{"doc":"This crate provides an adapter for the std::io::Read trait …","t":"DMLLLLLMLLMLLL","n":["ProgressRead","accumulator","borrow","borrow_mut","from","into","new","progress","read","seek","source","try_from","try_into","type_id"],"q":[[0,"progress_read"],[14,"std::io"],[15,"core::ops::function"],[16,"std::io::error"],[17,"std::io"],[18,"core::any"]],"d":["A reader that reports incremental progress while reading.","","","","Returns the argument unchanged.","Calls U::from(self).","Construct a new progress reader with the specified …","","Read some bytes from the underlying reader into the …","","","","",""],"i":[0,1,1,1,1,1,1,1,1,1,1,1,1,1],"f":[0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-2,[],[]],[[-1,-2,-3],[[1,[-1,-2,-3]]],2,[],3],0,[[[1,[-1,-2,-3]],[5,[4]]],[[7,[6]]],2,[],3],[[[1,[-1,-2,-3]],8],[[7,[9]]],[2,10],[],3],0,[-1,[[11,[-2]]],[],[]],[-1,[[11,[-2]]],[],[]],[-1,12,[]]],"c":[],"p":[[3,"ProgressRead",0],[8,"Read",14],[8,"FnMut",15],[15,"u8"],[15,"slice"],[15,"usize"],[6,"Result",16],[4,"SeekFrom",14],[15,"u64"],[8,"Seek",14],[4,"Result",17],[3,"TypeId",18]],"b":[]},\ +"test_support":{"doc":"Utilities to use with acceptance tests in Volta.","t":"AOAANDENNNNDLLLLLLLLLLLLLLLLFMMMMMMMMMMMMFMLLLLLLLLLLFLLLLLLLLLLMFLLLLLLLLLLLLLLLLLLLLLLLFNNHIEHRLLLKLFFFLKKKKFLLLLDDLLMLLLLLLLLLMMLMLLLMLLLLLLLLLLLLLMFFLMLLLLLLLLL","n":["matchers","ok_or_panic","paths","process","Exact","Execs","MatchKind","NotPresent","Partial","PartialN","Unordered","ZipAll","_with_stderr","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","diff_lines","eq","equivalent","equivalent","equivalent","execs","expect_either_contains","expect_exit_code","expect_json","expect_neither_contains","expect_stderr","expect_stderr_contains","expect_stderr_not_contains","expect_stderr_unordered","expect_stdout","expect_stdout_contains","expect_stdout_contains_n","expect_stdout_not_contains","find_mismatch","first","fmt","fmt","fmt","from","from","from","into","into","into","into_iter","lines_match","match_json","match_output","match_status","match_std","match_stderr","match_stdout","matches","matches","matches","next","second","substitute_macros","to_owned","to_owned","to_string","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","with_either_contains","with_json","with_status","with_stderr","with_stderr_contains","with_stderr_does_not_contain","with_stderr_unordered","with_stdout","with_stdout_contains","with_stdout_contains_n","with_stdout_does_not_contain","zip_all","Dir","File","NEXT_ID","PathExt","Remove","SMOKE_TEST_DIR","TASK_ID","at","borrow","borrow_mut","ensure_empty","from","global_root","home","init","into","mkdir_p","rm","rm_contents","rm_rf","root","to_str","try_from","try_into","type_id","ProcessBuilder","ProcessError","arg","args","args","args_replace","borrow","borrow","borrow_mut","borrow_mut","build_command","clone","clone_into","cwd","cwd","desc","env","env","env_remove","exec","exec_with_output","exit","fmt","fmt","fmt","fmt","from","from","get_args","get_cwd","get_env","get_envs","get_program","into","into","output","process","process_error","program","program","to_owned","to_string","to_string","try_from","try_from","try_into","try_into","type_id","type_id"],"q":[[0,"test_support"],[4,"test_support::matchers"],[90,"test_support::paths"],[115,"test_support::process"],[164,"alloc::string"],[165,"core::str::iter"],[166,"alloc::string"],[167,"serde_json::value"],[168,"core::option"],[169,"core::fmt"],[170,"core::fmt"],[171,"std::process"],[172,"core::iter::traits::iterator"],[173,"core::result"],[174,"core::any"],[175,"std::path"],[176,"std::path"],[177,"core::convert"],[178,"std::process"],[179,"std::process"]],"d":["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Compare a line with an expected pattern.","","","","","","","","","","","","","","","","","","","","","","","","","Verify that either stdout or stderr contains the given …","Verify the JSON output matches the given JSON. Typically …","Verify the exit code from the process.","Verify that stderr is equal to the given lines. See …","Verify that stderr contains the given contiguous lines …","Verify that stderr does not contain the given contiguous …","Verify that all of the stderr output is equal to the given …","Verify that stdout is equal to the given lines. See …","Verify that stdout contains the given contiguous lines …","Verify that stdout contains the given contiguous lines …","Verify that stdout does not contain the given contiguous …","","","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","","","","","","","","","A builder object for an external process, similar to …","","(chainable) Add an arg to the args list.","(chainable) Add many args to the args list.","A list of arguments to pass to the program.","(chainable) Replace args with new args list","","","","","Converts ProcessBuilder into a std::process::Command","","","(chainable) Set the current working directory of the …","Which directory to run the program from.","","(chainable) Set an environment variable for the process.","Any environment variables that should be set for the …","(chainable) Unset an environment variable for the process.","Run the process, waiting for completion, and mapping …","Execute the process, returning the stdio output, or an …","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Get the program arguments","Get the current working directory for the process","Get an environment variable as the process will see it …","Get all environment variables explicitly set or unset for …","Get the executable name.","Calls U::from(self).","Calls U::from(self).","","A helper function to create a ProcessBuilder.","","(chainable) Set the executable for the process.","The program to execute.","","","","","","","","",""],"i":[0,0,0,0,4,0,0,4,4,4,4,0,1,19,1,4,19,1,4,1,4,1,4,1,4,4,4,4,0,1,1,1,1,1,1,1,1,1,1,1,1,0,19,1,1,4,19,1,4,19,1,4,19,0,1,1,1,1,1,1,1,1,1,19,19,0,1,4,1,19,1,4,19,1,4,19,1,4,1,1,1,1,1,1,1,1,1,1,1,0,25,25,0,0,0,0,0,25,25,25,35,25,0,0,0,25,35,35,35,35,0,25,25,25,25,0,0,18,18,18,18,18,31,18,31,18,18,18,18,18,31,18,18,18,18,18,31,18,18,31,31,18,31,18,18,18,18,18,18,31,31,0,0,18,18,18,18,31,18,31,18,31,18,31],"f":[0,0,0,0,0,0,0,0,0,0,0,0,[[1,2],3],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[1,1],[4,4],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[1,5,5,6],[[8,[7]]]],[[4,4],6],[[-1,-2],6,[],[]],[[-1,-2],6,[],[]],[[-1,-2],6,[],[]],[[],1],0,0,0,0,0,0,0,0,0,0,0,0,[[9,9],[[10,[[3,[9,9]]]]]],0,[[1,11],12],[[1,11],12],[[4,11],12],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[13,13],6],[[1,9,13],14],[[1,15],14],[[1,15],14],[[1,[10,[7]],[17,[16]],13,[17,[16]],4],14],[[1,15],14],[[1,15],14],[[1,18],14],[[1,18],14],[[1,15],14],[[[19,[-1,-2]]],[[10,[[3,[[10,[-3]],[10,[-3]]]]]]],20,20,[]],0,[13,7],[-1,-2,[],[]],[-1,-2,[],[]],[-1,7,[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,22,[]],[-1,22,[]],[-1,22,[]],[[1,-1],1,2],[[1,13],1],[[1,23],1],[[1,-1],1,2],[[1,-1],1,2],[[1,-1],1,2],[[1,-1],1,2],[[1,-1],1,2],[[1,-1],1,2],[[1,-1,24],1,2],[[1,-1],1,2],[[-1,-2],[[19,[-1,-2]]],20,20],0,0,0,0,0,0,0,[[25,26],3],[-1,-2,[],[]],[-1,-2,[],[]],[-1,3,[]],[-1,-1,[]],[[],27],[[],27],[[],3],[-1,-2,[],[]],[-1,3,[]],[-1,3,[]],[-1,3,[]],[-1,3,[]],[[],27],[25,13],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,22,[]],0,0,[[18,-1],18,[[29,[28]]]],[[18,[17,[-1]]],18,[[29,[28]]]],0,[[18,[17,[-1]]],18,[[29,[28]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[18,30],[18,18],[[-1,-2],3,[],[]],[[18,-1],18,[[29,[28]]]],0,0,[[18,13,-1],18,[[29,[28]]]],0,[[18,13],18],[18,[[21,[3,31]]]],[18,[[21,[15,31]]]],0,[[18,11],12],[[18,11],12],[[31,11],12],[[31,11],12],[-1,-1,[]],[-1,-1,[]],[18,[[17,[32]]]],[18,[[10,[26]]]],[[18,13],[[10,[32]]]],[18,[[33,[7,[10,[32]]]]]],[18,32],[-1,-2,[],[]],[-1,-2,[],[]],0,[-1,18,[[29,[28]]]],[[13,[10,[34]],[10,[15]]],31],[[18,-1],18,[[29,[28]]]],0,[-1,-2,[],[]],[-1,7,[]],[-1,7,[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,[[21,[-2]]],[],[]],[-1,22,[]],[-1,22,[]]],"c":[],"p":[[3,"Execs",4],[8,"ToString",164],[15,"tuple"],[4,"MatchKind",4],[3,"Lines",165],[15,"bool"],[3,"String",164],[3,"Vec",166],[4,"Value",167],[4,"Option",168],[3,"Formatter",169],[6,"Result",169],[15,"str"],[6,"MatchResult",170],[3,"Output",171],[15,"u8"],[15,"slice"],[3,"ProcessBuilder",115],[3,"ZipAll",4],[8,"Iterator",172],[4,"Result",173],[3,"TypeId",174],[15,"i32"],[15,"usize"],[4,"Remove",90],[3,"Path",175],[3,"PathBuf",175],[3,"OsStr",176],[8,"AsRef",177],[3,"Command",171],[3,"ProcessError",115],[3,"OsString",176],[3,"HashMap",178],[3,"ExitStatus",171],[8,"PathExt",90]],"b":[[43,"impl-Debug-for-Execs"],[44,"impl-Display-for-Execs"],[60,"impl-HamcrestMatcher%3C%26mut+ProcessBuilder%3E-for-Execs"],[61,"impl-HamcrestMatcher%3CProcessBuilder%3E-for-Execs"],[62,"impl-HamcrestMatcher%3COutput%3E-for-Execs"],[137,"impl-Debug-for-ProcessBuilder"],[138,"impl-Display-for-ProcessBuilder"],[139,"impl-Display-for-ProcessError"],[140,"impl-Debug-for-ProcessError"]]},\ +"validate_npm_package_name":{"doc":"A Rust implementation of the validation rules from the …","t":"RRHNHHNNELLFLLLLLLLLLFMMM","n":["BLACKLIST","BUILTINS","ENCODE_URI_SET","Invalid","SCOPED_PACKAGE","SPECIAL_CHARS","Valid","ValidForOldPackages","Validity","borrow","borrow_mut","done","eq","fmt","from","into","try_from","try_into","type_id","valid_for_new_packages","valid_for_old_packages","validate","errors","warnings","warnings"],"q":[[0,"validate_npm_package_name"],[22,"validate_npm_package_name::Validity"],[25,"alloc::string"],[26,"alloc::vec"],[27,"core::fmt"],[28,"core::fmt"],[29,"core::any"]],"d":["","","The set of characters to encode, matching the characters …","Not valid for new or old packages","","","Valid for new and old packages","Valid only for old packages","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","",""],"i":[0,0,0,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,3,0,10,11,10],"f":[0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[[[2,[1]],[2,[1]]],3],[[3,3],4],[[3,5],6],[-1,-1,[]],[-1,-2,[],[]],[-1,[[7,[-2]]],[],[]],[-1,[[7,[-2]]],[],[]],[-1,8,[]],[3,4],[3,4],[9,3],0,0,0],"c":[],"p":[[3,"String",25],[3,"Vec",26],[4,"Validity",0],[15,"bool"],[3,"Formatter",27],[6,"Result",27],[4,"Result",28],[3,"TypeId",29],[15,"str"],[13,"Invalid",22],[13,"ValidForOldPackages",22]],"b":[]},\ +"volta":{"doc":"","t":"AAAFNNNNNNNENNDNLLLLLLLLLMLLLLLLLLLLLMLLFLLLLLLLLLLMMMLLIAAAAAAKAAAADLLLLLMLLLLLMLMLLLLLLDLLLLLLLLLLMLLLLLLDLLLLLLLLLLMLLLLLLNNNNNNEENDDNNNNNEDDENNNNNNEENNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMLLLLLLLLLMLLLLLLLLLLLLLLLALLLLLLLLLLMMLLLALLMMMLLLLLLLLLALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMMMLLLLLLLLLLMMMMMMMHHHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFNNENNNNNNNENLLLLLLLLLLLLLLLFLLLLLLLLLLLMMMMMMMMMMDLLLLLLLLLLMLLLLLLDLLLLMMMLLLLLLMMMMLLMLLLLLLLMDLLLLLLLLLALLLLLLLFFFFFFFFFDLLLLLLLLLLMLLLLLLRRDMLLLLLLLLLLLLLLLLDLLMLLLLLLLLLLLLLLEINNLLFLLKLLLL","n":["cli","command","common","main","Completions","Fetch","Install","List","Pin","Run","Setup","Subcommand","Uninstall","Use","Volta","Which","augment_args","augment_args_for_update","augment_subcommands","augment_subcommands_for_update","borrow","borrow","borrow_mut","borrow_mut","command","command","command_for_update","from","from","from_arg_matches","from_arg_matches","from_arg_matches_mut","from_arg_matches_mut","group_id","has_subcommand","into","into","quiet","run","run","styles","try_from","try_from","try_into","try_into","type_id","type_id","update_from_arg_matches","update_from_arg_matches","update_from_arg_matches_mut","update_from_arg_matches_mut","verbose","version","very_verbose","vzip","vzip","Command","completions","fetch","install","list","pin","run","run","setup","uninstall","use","which","Completions","augment_args","augment_args_for_update","borrow","borrow_mut","fmt","force","from","from_arg_matches","from_arg_matches_mut","group_id","into","out_file","run","shell","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Fetch","augment_args","augment_args_for_update","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","run","tools","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Install","augment_args","augment_args_for_update","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","run","tools","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","All","Current","Default","Default","Default","Fetched","Filter","Format","Human","List","Node","Node","None","None","Npm","Npm","Package","PackageDetails","PackageManager","PackageManagerKind","PackageOrTool","Plain","Pnpm","Pnpm","Project","Project","Source","Subcommand","Yarn","Yarn","allowed_with","augment_args","augment_args_for_update","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cmp","compare","current","default","eq","eq","equivalent","equivalent","equivalent","equivalent","fmt","fmt","fmt","format","from","from","from","from","from","from","from","from","from","from","from_arg_matches","from_arg_matches_mut","from_inventory_and_project","from_str","group_id","human","into","into","into","into","into","into","into","into","into","into","kind","name","new","output_format","partial_cmp","plain","run","source","source","source","subcommand","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_possible_value","to_string","to_string","toolchain","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","update_from_arg_matches","update_from_arg_matches_mut","value_variants","version","version","version","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","details","name","node","path","tools","tools","name","INDENTATION","NO_RUNTIME","TEXT_WIDTH","display_active","display_all","display_node","display_npms","display_package_managers","display_packages","display_tool","format","format_package","format_package_list","format_package_manager","format_package_manager_kind","format_package_manager_list_condensed","format_package_manager_list_verbose","format_runtime","format_runtime_list","format_tool","format_tool_list","list_package_source","wrap","describe_package_managers","describe_packages","describe_runtimes","describe_tool_set","display_node","display_package","display_package_manager","display_tool","format","package_source","Active","All","Lookup","Node","Npm","PackageManagers","Packages","Pnpm","Runtime","Tool","Toolchain","Yarn","active","active_tool","all","borrow","borrow","borrow_mut","borrow_mut","from","from","into","into","node","npm","package_or_tool","pnpm","tool_source","try_from","try_from","try_into","try_into","type_id","type_id","version_from_spec","version_source","vzip","vzip","yarn","host_packages","kind","managers","name","package_managers","package_managers","packages","packages","runtime","runtimes","Pin","augment_args","augment_args_for_update","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","run","tools","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Run","augment_args","augment_args_for_update","borrow","borrow_mut","bundled_npm","command_and_args","envs","fmt","from","from_arg_matches","from_arg_matches_mut","group_id","into","no_pnpm","no_yarn","node","npm","parse_envs","parse_platform","pnpm","run","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","yarn","Setup","augment_args","augment_args_for_update","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","os","run","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","add_bash_profiles","add_fish_profile","add_zsh_profile","determine_profiles","format_home","read_profile_without_volta","setup_environment","write_profile_fish","write_profile_sh","Uninstall","augment_args","augment_args_for_update","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","run","tool","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","ADVICE","USAGE","Use","anything","augment_args","augment_args_for_update","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","run","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Which","augment_args","augment_args_for_update","binary","borrow","borrow_mut","from","from_arg_matches","from_arg_matches_mut","group_id","into","run","try_from","try_into","type_id","update_from_arg_matches","update_from_arg_matches_mut","vzip","Error","IntoResult","Tool","Volta","borrow","borrow_mut","ensure_layout","from","into","into_result","try_from","try_into","type_id","vzip"],"q":[[0,"volta"],[4,"volta::cli"],[56,"volta::command"],[68,"volta::command::completions"],[89,"volta::command::fetch"],[107,"volta::command::install"],[125,"volta::command::list"],[297,"volta::command::list::Package"],[303,"volta::command::list::Subcommand"],[304,"volta::command::list::human"],[327,"volta::command::list::plain"],[337,"volta::command::list::toolchain"],[376,"volta::command::list::toolchain::Toolchain"],[386,"volta::command::pin"],[404,"volta::command::run"],[433,"volta::command::setup"],[451,"volta::command::setup::os"],[460,"volta::command::uninstall"],[478,"volta::command::use"],[498,"volta::command::which"],[516,"volta::common"],[530,"clap_builder::builder::command"],[531,"clap_builder::parser::matches::arg_matches"],[532,"clap_builder"],[533,"core::result"],[534,"clap_builder::util::id"],[535,"core::option"],[536,"volta_core::session"],[537,"volta_core::error"],[538,"volta_core::error"],[539,"core::any"],[540,"core::fmt"],[541,"core::fmt"],[542,"volta_core::project"],[543,"alloc::vec"],[544,"volta_core::tool::package::metadata"],[545,"clap_builder::builder::possible_value"],[546,"alloc::string"],[547,"alloc::boxed"],[548,"core::convert"],[549,"node_semver"],[550,"volta_core::platform"],[551,"core::ops::function"],[552,"std::collections::hash::map"],[553,"volta_core::platform"],[554,"std::path"]],"d":["","","","The entry point for the volta CLI.","Generates Volta completions","Fetches a tool to the local machine","Installs a tool in your toolchain","Displays the current toolchain","Pins your project’s runtime or package manager","Run a command with custom Node, npm, pnpm, and/or Yarn …","Enables Volta for the current user / shell","","Uninstalls a tool from your toolchain","","","Locates the actual binary that will be called by Volta","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","","Calls U::from(self).","Calls U::from(self).","Prevents unnecessary output","","","","","","","","","","","","","","Enables verbose diagnostics","Prints the current version of Volta","Enables trace-level diagnostics.","","","A Volta command.","","","","","","","Executes the command. Returns Ok(true) if the process …","","","","","","","","","","","Write over an existing file, if any.","Returns the argument unchanged.","","","","Calls U::from(self).","File to write generated completions to","","Shell to generate completions for","","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","Tools to fetch, like node, yarn@latest or …","","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","Tools to install, like node, yarn@latest or …","","","","","","","Show every item in the toolchain.","Display only the currently active tool(s).","","Show only the user’s default tool(s).","The item is the user’s default.","","How (if at all) should the list query be narrowed?","","","","","Show locally cached Node versions.","Do not filter at all. Show all tool(s) matching the query.","The item is one that has been fetched but is not installed …","","Show locally cached npm versions.","","A package and its associated tools, for displaying to the …","","","Show locally cached versions of a package or a package …","","","Show locally cached pnpm versions.","","The item is from a project. The wrapped PathBuf is the …","The source of a given item, from the perspective of a user.","Which tool should we look up?","","Show locally cached Yarn versions.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Show the currently-active tool(s).","Show your default tool(s).","","","","","","","","","","Specify the output format.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","","","","Define the “human” format style for list commands.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","The name of the package.","","","","Define the “plain” format style for list commands.","","","","","The tool to lookup - all, node, npm, yarn, pnpm, or the …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The package’s own version.","","","","","","","","","","","","","","","The version of Node the package is installed against.","","The names of the tools associated with the package.","The names of the tools associated with the package.","","","","","Format the output for Toolchain::Active.","Format the output for Toolchain::All.","Format a set of Toolchain::Nodes.","Format a set of Toolchain::PackageManagers for …","Format a set of Toolchain::PackageManagers.","Format a set of Toolchain::Packages and their associated …","Format a single Toolchain::Tool with associated …","","Format a single Toolchain::Package and its associated …","format a list of Toolchain::Packages and their associated …","format a single Toolchain::PackageManager.","format the title for a kind of package manager","format a list of Toolchain::PackageManagers in condensed …","format a list of Toolchain::PackageManagers in verbose form","format a single version of Toolchain::Node.","format a list of Toolchain::Nodes.","Format a single Toolchain::Package without detail …","Format a list of Toolchain::Packages without detail …","List a the source from a Toolchain::Package.","Wrap and indent the output","","","","","","","","","","","","","Lightweight rule for which item to get the Source for.","","Look up the npm package manager","","","Look up the pnpm package manager","Look up the Node runtime","","","Look up the Yarn package manager","","Determine the Source for a given kind of tool (Lookup).","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","Look up the Source for a tool with a given name.","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","Tools to pin, like node@lts or yarn@^1.14.","","","","","","","","","","","","Forces npm to be the version bundled with Node","The command to run, along with any arguments","Set an environment variable (can be used multiple times)","","Returns the argument unchanged.","","","","Calls U::from(self).","Disables pnpm","Disables Yarn","Set the custom Node version","Set the custom npm version","Convert the environment variable settings passed to the …","Builds a CliPlatform from the provided cli options","Set the custon pnpm version","","","","","","","","Set the custom Yarn version","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","","","","","","","","Add bash profile scripts, if necessary","Add fish profile scripts, if necessary","Add zsh profile script, if necessary","Returns a list of profile files to modify / create.","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","The tool to uninstall, like ember-cli-update, typescript, …","","","","","","","","","","","","","","","Returns the argument unchanged.","","","","Calls U::from(self).","","","","","","","","","","","The binary to find, e.g. node or npm","","","Returns the argument unchanged.","","","","Calls U::from(self).","","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","",""],"i":[0,0,0,0,7,7,7,7,7,7,7,0,7,7,0,7,4,4,7,7,4,7,4,7,4,4,4,4,7,4,7,4,7,4,7,4,7,4,4,7,0,4,7,4,7,4,7,4,7,4,7,4,4,4,4,7,0,0,0,0,0,0,0,57,0,0,0,0,0,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,0,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,0,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,28,23,32,23,22,32,0,0,24,0,0,28,23,22,26,28,0,0,0,0,28,24,26,28,32,22,0,0,26,28,22,30,30,58,32,23,24,22,25,26,27,30,28,58,32,23,24,22,25,26,27,30,28,24,22,25,26,27,28,24,22,25,26,27,28,26,26,30,30,22,26,26,26,26,26,22,22,26,30,58,32,23,24,22,25,26,27,30,28,30,30,32,28,30,0,58,32,23,24,22,25,26,27,30,28,27,58,32,30,26,0,30,32,25,27,30,24,22,25,26,27,28,24,22,26,0,58,32,23,24,22,25,26,27,30,28,58,32,23,24,22,25,26,27,30,28,58,32,23,24,22,25,26,27,30,28,30,30,24,58,25,27,58,32,23,24,22,25,26,27,30,28,59,60,59,60,59,60,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,39,0,39,43,39,39,43,43,39,0,43,39,43,39,39,43,39,43,39,43,39,43,39,39,39,39,0,39,43,39,43,39,43,43,43,39,43,39,62,63,63,62,64,65,64,65,64,65,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,0,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,0,49,49,49,49,49,49,49,49,49,0,49,49,49,49,49,49,49,0,0,0,0,0,0,0,0,0,0,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,0,0,0,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,0,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,0,0,56,56,56,56,0,56,56,66,56,56,56,56],"f":[0,0,0,[[],1],0,0,0,0,0,0,0,0,0,0,0,0,[2,2],[2,2],[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],2],0,[[],2],[-1,-1,[]],[-1,-1,[]],[3,[[6,[4,5]]]],[3,[[6,[7,5]]]],[3,[[6,[4,5]]]],[3,[[6,[7,5]]]],[[],[[9,[8]]]],[10,11],[-1,-2,[],[]],[-1,-2,[],[]],0,[[4,12],[[14,[13]]]],[[7,12],[[14,[13]]]],[[],15],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[-1,16,[]],[[4,3],[[6,[1,5]]]],[[7,3],[[6,[1,5]]]],[[4,3],[[6,[1,5]]]],[[7,3],[[6,[1,5]]]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,[[-1,12],[[14,[13]]],[]],0,0,0,0,0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[[17,18],19],0,[-1,-1,[]],[3,[[6,[17,5]]]],[3,[[6,[17,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],0,[[17,12],[[14,[13]]]],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[17,3],[[6,[1,5]]]],[[17,3],[[6,[1,5]]]],[-1,-2,[],[]],0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[20,5]]]],[3,[[6,[20,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],[[20,12],[[14,[13]]]],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[20,3],[[6,[1,5]]]],[[20,3],[[6,[1,5]]]],[-1,-2,[],[]],0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[21,5]]]],[3,[[6,[21,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],[[21,12],[[14,[13]]]],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[21,3],[[6,[1,5]]]],[[21,3],[[6,[1,5]]]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[22,23],11],[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[24,24],[22,22],[25,25],[26,26],[27,27],[28,28],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[-1,-2],1,[],[]],[[26,26],29],[[-1,-2],29,[],[]],0,0,[[22,22],11],[[26,26],11],[[-1,-2],11,[],[]],[[-1,-2],11,[],[]],[[-1,-2],11,[],[]],[[-1,-2],11,[],[]],[[22,18],19],[[22,18],19],[[26,18],19],0,[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[3,[[6,[30,5]]]],[3,[[6,[30,5]]]],[[[9,[31]]],[[14,[[33,[32]]]]]],[10,[[6,[28]]]],[[],[[9,[8]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[[34,22],32],[30,24],[[26,26],[[9,[29]]]],0,[[30,12],[[14,[13]]]],[[10,[9,[31]]],22],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[24,[[9,[35]]]],[-1,36,[]],[-1,36,[]],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[-1,16,[]],[[30,3],[[6,[1,5]]]],[[30,3],[[6,[1,5]]]],[[],[[37,[24]]]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,[[[9,[[38,[25]]]],[37,[27]],[37,[32]]],36],[[[37,[25]],[37,[27]],[37,[32]]],36],[[[37,[25]]],36],[[[37,[27]]],36],[[26,[37,[27]]],36],[[[37,[32]]],36],[[10,[37,[32]]],36],[39,[[9,[36]]]],[32,36],[[[37,[32]]],36],[27,36],[26,36],[[[37,[27]]],36],[[[37,[27]]],36],[25,36],[[[37,[25]]],36],[32,36],[[[37,[32]]],36],[32,36],[-1,36,[[40,[10]]]],[[[37,[27]]],[[9,[36]]]],[[[37,[32]]],[[9,[36]]]],[[[37,[25]]],[[9,[36]]]],[[10,[37,[32]]],36],[[22,41],36],[32,36],[27,36],[[10,32],[[9,[36]]]],[39,[[9,[36]]]],[32,36],0,0,0,0,0,0,0,0,0,0,0,0,[[[9,[31]],[9,[42]]],[[14,[39]]]],[[43,[9,[31]],[9,[42]]],[[9,[[1,[22,41]]]]]],[[[9,[31]],[9,[42]]],[[14,[39]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[9,[31]],[9,[42]],23],[[14,[39]]]],[[[9,[31]],[9,[42]],23],[[14,[39]]]],[[10,[9,[31]],23],[[14,[39]]]],[[[9,[31]],[9,[42]],23],[[14,[39]]]],[[10,[9,[31]]],[[14,[22]]]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[-1,16,[]],[43,[[0,[44]]]],[[43,[9,[31]],[9,[42]],41],22],[-1,-2,[],[]],[-1,-2,[],[]],[[[9,[31]],[9,[42]],23],[[14,[39]]]],0,0,0,0,0,0,0,0,0,0,0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[45,5]]]],[3,[[6,[45,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],[[45,12],[[14,[13]]]],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[45,3],[[6,[1,5]]]],[[45,3],[[6,[1,5]]]],[-1,-2,[],[]],0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,[[46,18],19],[-1,-1,[]],[3,[[6,[46,5]]]],[3,[[6,[46,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],0,0,0,0,[46,[[47,[10,10]]]],[[46,12],[[14,[48]]]],0,[[46,12],[[14,[13]]]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[46,3],[[6,[1,5]]]],[[46,3],[[6,[1,5]]]],[-1,-2,[],[]],0,0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[49,5]]]],[3,[[6,[49,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],0,[[49,12],[[14,[13]]]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[49,3],[[6,[1,5]]]],[[49,3],[[6,[1,5]]]],[-1,-2,[],[]],[[50,10,[33,[51]]],1],[[50,10,[33,[51]]],1],[[50,10,[33,[51]]],1],[[],[[14,[[33,[51]]]]]],[50,36],[50,[[9,[36]]]],[[],[[14,[1]]]],[[50,36,10],[[52,[1]]]],[[50,36,10],[[52,[1]]]],0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[53,5]]]],[3,[[6,[53,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],[[53,12],[[14,[13]]]],0,[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[53,3],[[6,[1,5]]]],[[53,3],[[6,[1,5]]]],[-1,-2,[],[]],0,0,0,0,[2,2],[2,2],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[54,5]]]],[3,[[6,[54,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],[[54,12],[[14,[13]]]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[54,3],[[6,[1,5]]]],[[54,3],[[6,[1,5]]]],[-1,-2,[],[]],0,[2,2],[2,2],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[3,[[6,[55,5]]]],[3,[[6,[55,5]]]],[[],[[9,[8]]]],[-1,-2,[],[]],[[55,12],[[14,[13]]]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[[55,3],[[6,[1,5]]]],[[55,3],[[6,[1,5]]]],[-1,-2,[],[]],0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[[],[[6,[1,56]]]],[-1,-1,[]],[-1,-2,[],[]],[-1,[[6,[-2,56]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,[[6,[-2]]],[],[]],[-1,16,[]],[-1,-2,[],[]]],"c":[],"p":[[15,"tuple"],[3,"Command",530],[3,"ArgMatches",531],[3,"Volta",4],[6,"Error",532],[4,"Result",533],[4,"Subcommand",4],[3,"Id",534],[4,"Option",535],[15,"str"],[15,"bool"],[3,"Session",536],[4,"ExitCode",537],[6,"Fallible",537],[3,"Styles",538],[3,"TypeId",539],[3,"Completions",68],[3,"Formatter",540],[6,"Result",540],[3,"Fetch",89],[3,"Install",107],[4,"Source",125],[4,"Filter",125],[4,"Format",125],[3,"Node",125],[4,"PackageManagerKind",125],[3,"PackageManager",125],[4,"Subcommand",125],[4,"Ordering",541],[3,"List",125],[3,"Project",542],[4,"Package",125],[3,"Vec",543],[3,"PackageConfig",544],[3,"PossibleValue",545],[3,"String",546],[15,"slice"],[3,"Box",547],[4,"Toolchain",337],[8,"AsRef",548],[3,"Version",549],[3,"PlatformSpec",550],[4,"Lookup",337],[8,"Fn",551],[3,"Pin",386],[3,"Run",404],[3,"HashMap",552],[3,"CliPlatform",550],[3,"Setup",433],[3,"Path",553],[3,"PathBuf",553],[6,"Result",554],[3,"Uninstall",460],[3,"Use",478],[3,"Which",498],[4,"Error",516],[8,"Command",56],[3,"PackageDetails",125],[13,"Default",297],[13,"Project",297],[13,"PackageOrTool",303],[13,"Tool",376],[13,"PackageManagers",376],[13,"Active",376],[13,"All",376],[8,"IntoResult",516]],"b":[[200,"impl-Debug-for-Source"],[201,"impl-Display-for-Source"]]},\ +"volta_core":{"doc":"The main implementation crate for the core of Volta.","t":"RAAAAAAAAAAAAAAAAAAAAFNNNNNNNNNNINNNNNNNNNNNNNNENNNENNGNNNNNDNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNDNNNNNNNNNNLLLLLLLLLLLLLLLLLLLMLLLALMFALMLLLLLLLLLLLLLLKMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNENNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNRNNNNNNNNNNNNNNNNNNNNNNNRNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMFFFFNNNDDEDNNLLLLLLMLLLLLLLLLLLLLLLLLLLLLMMMLLLLLLFLLLLLLMMMMLLLLMLLLLLLLLLLLLFLLLLMMMMMMFFFFFFFFFFFFFNDNDDNEEDNDLLLLLLLLLLLLLLLMMLLLLLLLLLLLMLLLLLLLLLLLLLMMLLLLLLLLMMLLLLOLMLMMLMMAMALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMDDDDDDDMMMLLLLLLLLLLLLLLLLLLLLLMMMMLLLLLLLMMLLLLLLLLLLLLLLMMMMMMMMMLLLLLLLMMLLLLLLLLLLLLLLLLLLLLLMLLLLLLLMRNNERRERNNHHNNRDLLLLLLFLLLLLLLLLLLLLLLFLLLMLLLLLLMLLLLLLLLLLLLLLLMMMMFFFFFFFFFFHHFFAFFFFRNREEDRRNNRRNRNNNRRLLLLLLLLMLLLLLLLLLLMFLLLLLLLLLLLLLLLLLFFFFNDNNDNENDDNNEDDLLLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLALLLLLLLLLMMMMMMMMLMMMMMALLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLLLMMMMDLLLLLMMLMLLLLLMDLLLLLLLLLDDDLLLLLLMLFLLLLLLLLLLLLLLFFFFLMLLMMLLLLLMMMALLLLLLLLLLLLMLMGDENNNDDNMMLLLLLLLLLMMLLMMMLLLLLLLLLLLMMLMMLLLLLLLLLLLLLLFMLLLLMRRAFFFFAFFFAAAAAFADMLLFFLLLLFMFLLLLNNENDNNNNNDNDNDNNNDENDNLLLLLLLLLLLLLLLLLLLLLLMMMMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLMLLLLLLMMMMMMMLLLLLLLLLLLLLLLLLLLLLLLLMLLLLLLLLFFFFFHFFENENDNENDRRRRRRRNRNDNNDLLLLLLLLLLLLLLMMMLLLLLLLLLLLLLLLLFLLLLLLLFFMMMMMMLLLLLLLLLLLLLLLLLLLLLLLLLLLLFFFFFFENNNNNNNNNNNNNNNDNNNNNNNNLLLLLLLLLLLLLLLLLLMLLLLLLMLLLLLMLLLLLLMLLLLLLLLLNNNNELLFFLLLLLLFLAFLLLLFFRHFFRRFFFFFFFFRHDDMLLLLLMLMLLLLLLLLLLLLNCCNECCCCNCNRCNCDCCNEICNLLLLLFFFFKFLLLLLLFFFFKLLCLAAAKAAFLALLLLLLLLLLMLLARRRRDDLLLLLLLLLALLLLLLLLLFALMLAFMLLLLLLLLLMLLDLLLFFFLLFFFFFLLLFLMLDDDDLLLLLLLLLLMMLLLLLLLLLLMMFMLLLLLLLLLLLLMMLLLLFFFFFFFFFDDLLLLLLLALLLLLLLLLLLLLAFLLLLLLLLMLLFFFFFFFFFFDDDENNDDEDNNNMMLLLLLLLLLLLLLLAMLLLLLLLLALLLLLFAMMMMAMMMMMLLLMMFLMMLLLFMMLLLLLLLLLLLLLLAFMMMMLLLLLFFFFNENNLLLLLLLLLLLLLLLLFFFLLLLLLLLLLLDDDDDMMLLLLLLLLLLLLFMLLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMLMMMALLLLLLLLLLLLLLLLLLMMMLLLLLLLMDLLFLLLLLLLLLLFFFFDLLLLLALLLLLLLAFLLLLMLFFFFFFFFFFRDDDDDLLLLLLLLLLLLLLLMMMFFLLLLLLLLLLLLLLLMFFFMMMLLLLLLLLLLLLLLLLMMMLLLLLHHFDLLLLLALLLLLALLAFLLLLMLFFFFFFDDDDMLLLLLLLLLLLMLLLLLLLLLLMMLLLLLLLLLLLLLLLLFFFFFFFFFDDLLLLLLLLLLLLLMLALLLLMLLLLLLLLDDLLLLLLLLLLLLLLLLLLLLLLLMMLMMLLLLLLLLLLLMNNNNNNNEELLLLLLLLLLLLLALLAFFALLFLLLLLLALLDLLFLLLLLLLFFFDLLFLLLLFLLLLL","n":["VOLTA_FEATURE_PNPM","command","error","event","fs","hook","inventory","layout","log","monitor","platform","project","run","session","shim","signal","style","sync","tool","toolchain","version","create_command","BinaryAlreadyInstalled","BinaryExecError","BinaryNotFound","BuildPathError","BypassError","CannotFetchPackage","CannotPinPackage","CompletionsOutFileError","ConfigurationError","ContainingDirError","Context","CouldNotDetermineTool","CouldNotStartMigration","CreateDirError","CreateLayoutFileError","CreateSharedLinkError","CreateTempDirError","CreateTempFileError","CurrentDirError","DeleteDirectoryError","DeleteFileError","DeprecatedCommandError","DownloadToolNetworkError","EnvironmentError","Err","ErrorKind","ExecutableNotFound","ExecuteHookError","ExecutionFailure","ExitCode","ExtensionCycleError","ExtensionPathError","Fallible","FileSystemError","HookCommandFailed","HookMultipleFieldsSpecified","HookNoFieldsSpecified","HookPathError","Inner","InstalledPackageNameError","InvalidArguments","InvalidHookCommand","InvalidHookOutput","InvalidInvocation","InvalidInvocationOfBareVersion","InvalidRegistryFormat","InvalidToolName","LockAcquireError","NetworkError","NoBundledNpm","NoCommandLinePnpm","NoCommandLineYarn","NoDefaultNodeVersion","NoDefaultPnpm","NoDefaultYarn","NoHomeEnvironmentVar","NoInstallDir","NoLocalDataDir","NoPinnedNodeVersion","NoPlatform","NoProjectNodeInManifest","NoProjectPnpm","NoProjectYarn","NoShellProfile","NoVersionMatch","NodeVersionNotFound","NotInPackage","NotYetImplemented","NpmLinkMissingPackage","NpmLinkWrongManager","NpmVersionNotFound","NpxNotAvailable","Ok","PackageInstallFailed","PackageManifestParseError","PackageManifestReadError","PackageNotFound","PackageParseError","PackageReadError","PackageUnpackError","PackageWriteError","ParseBinConfigError","ParseHooksError","ParseNodeIndexCacheError","ParseNodeIndexError","ParseNodeIndexExpiryError","ParseNpmManifestError","ParsePackageConfigError","ParsePlatformError","ParseToolSpecError","PersistInventoryError","PnpmVersionNotFound","ProjectLocalBinaryExecError","ProjectLocalBinaryNotFound","PublishHookBothUrlAndBin","PublishHookNeitherUrlNorBin","ReadBinConfigDirError","ReadBinConfigError","ReadDefaultNpmError","ReadDirError","ReadHooksError","ReadNodeIndexCacheError","ReadNodeIndexExpiryError","ReadNpmManifestError","ReadPackageConfigError","ReadPlatformError","RegistryFetchError","RunShimDirectly","SetToolExecutable","SetupToolImageError","ShimCreateError","ShimRemoveError","StringifyBinConfigError","StringifyPackageConfigError","StringifyPlatformError","Success","Unimplemented","UnknownError","UnpackArchiveError","UpgradePackageNotFound","UpgradePackageWrongManager","VersionParseError","VoltaError","WriteBinConfigError","WriteDefaultNpmError","WriteLauncherError","WriteNodeIndexCacheError","WriteNodeIndexExpiryError","WritePackageConfigError","WritePlatformError","Yarn2NotSupported","YarnLatestFetchError","YarnVersionNotFound","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","exit","exit_code","fmt","fmt","fmt","fmt","from","from","from","from","from_source","inner","into","into","into","kind","kind","kind","report_error","reporter","source","source","to_owned","to_string","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","vzip","vzip","vzip","with_context","action","action","advice","bin_dir","bin_name","command","command","command","command","command","command","command","command","command","command","dir","dir","dir","dir","directory","duplicate","env_profile","errors","existing_package","feature","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","format","from_url","from_url","from_url","from_url","in_dir","in_dir","manager","manager","matching","matching","matching","matching","name","name","name","name","name","name","new_package","package","package","package","package","package","package","package","package","package","package","path","path","path","paths","tool","tool","tool","tool","tool","tool","tool","tool","tool","tool_spec","version","version","version","version","version","version","BinaryAlreadyInstalled","BinaryExecError","BinaryNotFound","BuildPathError","BypassError","CannotFetchPackage","CannotPinPackage","CompletionsOutFileError","ContainingDirError","CouldNotDetermineTool","CouldNotStartMigration","CreateDirError","CreateLayoutFileError","CreateSharedLinkError","CreateTempDirError","CreateTempFileError","CurrentDirError","DeleteDirectoryError","DeleteFileError","DeprecatedCommandError","DownloadToolNetworkError","ErrorKind","ExecuteHookError","ExtensionCycleError","ExtensionPathError","HookCommandFailed","HookMultipleFieldsSpecified","HookNoFieldsSpecified","HookPathError","InstalledPackageNameError","InvalidHookCommand","InvalidHookOutput","InvalidInvocation","InvalidInvocationOfBareVersion","InvalidRegistryFormat","InvalidToolName","LockAcquireError","NoBundledNpm","NoCommandLinePnpm","NoCommandLineYarn","NoDefaultNodeVersion","NoDefaultPnpm","NoDefaultYarn","NoHomeEnvironmentVar","NoInstallDir","NoLocalDataDir","NoPinnedNodeVersion","NoPlatform","NoProjectNodeInManifest","NoProjectPnpm","NoProjectYarn","NoShellProfile","NodeVersionNotFound","NotInPackage","NpmLinkMissingPackage","NpmLinkWrongManager","NpmVersionNotFound","NpxNotAvailable","PERMISSIONS_CTA","PackageInstallFailed","PackageManifestParseError","PackageManifestReadError","PackageNotFound","PackageParseError","PackageReadError","PackageUnpackError","PackageWriteError","ParseBinConfigError","ParseHooksError","ParseNodeIndexCacheError","ParseNodeIndexError","ParseNodeIndexExpiryError","ParseNpmManifestError","ParsePackageConfigError","ParsePlatformError","ParseToolSpecError","PersistInventoryError","PnpmVersionNotFound","ProjectLocalBinaryExecError","ProjectLocalBinaryNotFound","PublishHookBothUrlAndBin","PublishHookNeitherUrlNorBin","REPORT_BUG_CTA","ReadBinConfigDirError","ReadBinConfigError","ReadDefaultNpmError","ReadDirError","ReadHooksError","ReadNodeIndexCacheError","ReadNodeIndexExpiryError","ReadNpmManifestError","ReadPackageConfigError","ReadPlatformError","RegistryFetchError","RunShimDirectly","SetToolExecutable","SetupToolImageError","ShimCreateError","ShimRemoveError","StringifyBinConfigError","StringifyPackageConfigError","StringifyPlatformError","Unimplemented","UnpackArchiveError","UpgradePackageNotFound","UpgradePackageWrongManager","VersionParseError","WriteBinConfigError","WriteDefaultNpmError","WriteLauncherError","WriteNodeIndexCacheError","WriteNodeIndexExpiryError","WritePackageConfigError","WritePlatformError","Yarn2NotSupported","YarnLatestFetchError","YarnVersionNotFound","borrow","borrow_mut","exit_code","fmt","fmt","from","into","to_string","try_from","try_into","type_id","vzip","action","action","advice","bin_dir","bin_name","command","command","command","command","command","command","command","command","command","command","dir","dir","dir","dir","directory","duplicate","env_profile","errors","existing_package","feature","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","file","format","from_url","from_url","from_url","from_url","in_dir","in_dir","manager","manager","matching","matching","matching","matching","name","name","name","name","name","name","new_package","package","package","package","package","package","package","package","package","package","package","path","path","path","paths","tool","tool","tool","tool","tool","tool","tool","tool","tool","tool_spec","version","version","version","version","version","version","collect_arguments","compose_error_details","report_error","write_error_log","Args","End","Error","ErrorEnv","Event","EventKind","EventLog","Start","ToolEnd","add_event","add_event_args","add_event_end","add_event_error","add_event_start","add_event_tool_end","argv","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","deserialize","deserialize","deserialize","eq","eq","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","event","events","exec_path","fmt","fmt","from","from","from","from","get_error_env","init","into","into","into","into","into_event","name","path","platform","platform_version","publish","serialize","serialize","serialize","timestamp","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","unix_timestamp","vzip","vzip","vzip","vzip","argv","env","error","exit_code","exit_code","exit_code","create_staging_dir","create_staging_file","dir_entry_match","ok_if_not_found","read_dir_eager","read_file","remove_dir_if_exists","remove_file_if_exists","rename","set_executable","symlink_dir","symlink_file","touch","Bin","EventHooks","Github","HookConfig","LazyHookConfig","Npm","Publish","RegistryFormat","ToolHooks","Url","YarnHooks","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","current","distro","distro","eq","eq","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","events","events","fmt","fmt","from","from","from","from","from","from","from","from_file","from_paths","from_str","get","index","index","init","into","into","into","into","into","into","into","latest","latest","merge","merge","merge","merge","merge_hooks","node","node","npm","npm","phantom","pnpm","pnpm","publish","serial","settings","tool","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","vzip","vzip","vzip","vzip","vzip","vzip","vzip","yarn","yarn","RawEventHooks","RawHookConfig","RawIndexHook","RawPublishHook","RawResolveHook","RawToolHooks","RawYarnHooks","bin","bin","bin","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","deserialize","deserialize","deserialize","deserialize","deserialize","deserialize","deserialize","distro","distro","events","format","from","from","from","from","from","from","from","index","index","into","into","into","into","into","into","into","into_distro_hook","into_hook","into_hook_config","into_index_hook","into_metadata_hook","into_tool_hooks","into_yarn_hooks","latest","latest","node","npm","phantom","pnpm","prefix","prefix","publish","serialize","serialize","serialize","serialize","serialize","serialize","serialize","template","template","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","url","vzip","vzip","vzip","vzip","vzip","vzip","vzip","yarn","ARCH_TEMPLATE","Bin","Bin","DistroHook","EXTENSION_TEMPLATE","FILENAME_TEMPLATE","MetadataHook","OS_TEMPLATE","Prefix","Prefix","REL_PATH","REL_PATH_PARENT","Template","Template","VERSION_TEMPLATE","YarnIndexHook","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","calculate_extension","eq","eq","eq","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","execute_binary","fmt","fmt","fmt","format","from","from","from","into","into","into","metadata","resolve","resolve","resolve","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","vzip","vzip","vzip","base_path","bin","base_path","bin","node_available","node_versions","npm_available","npm_versions","package_configs","pnpm_available","pnpm_versions","read_versions","yarn_available","yarn_versions","VOLTA_HOME","VOLTA_INSTALL","default_install_dir","env_paths","unix","volta_home","volta_install","default_home_dir","env_paths","ALLOWED_PREFIXES","Default","ERROR_PREFIX","LogContext","LogVerbosity","Logger","MIGRATION_ERROR_PREFIX","MIGRATION_WARNING_PREFIX","Migration","Quiet","SHIM_ERROR_PREFIX","SHIM_WARNING_PREFIX","Shim","VOLTA_LOGLEVEL","Verbose","VeryVerbose","Volta","WARNING_PREFIX","WRAP_INDENT","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","context","enabled","flush","fmt","from","from","from","init","into","into","into","level","level_from_env","log","log_error","log_warning","new","to_owned","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","vzip","vzip","vzip","wrap_content","send_events","spawn_process","write_events_file","Binary","CliPlatform","CommandLine","Default","Image","Inherit","InheritOption","None","Platform","PlatformSpec","Project","Some","Source","Sourced","System","as_binary","as_default","as_project","as_ref","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","build_path_error","checkout","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cloned","cmp","compare","current","default","eq","equivalent","equivalent","equivalent","equivalent","fmt","from","from","from","from","from","from","image","inherit","into","into","into","into","into","into","map","merge","node","node","node","node","npm","npm","npm","npm","partial_cmp","pnpm","pnpm","pnpm","pnpm","source","system","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_string","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","value","vzip","vzip","vzip","vzip","vzip","vzip","with_binary","with_command_line","with_default","with_project","yarn","yarn","yarn","yarn","Image","bins","borrow","borrow_mut","from","into","node","npm","path","pnpm","resolve_npm","try_from","try_into","type_id","vzip","yarn","System","borrow","borrow_mut","from","into","path","try_from","try_into","type_id","vzip","LazyProject","PartialPlatform","Project","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","dependencies","find_bin","find_closest_root","for_current_dir","for_dir","from","from","from","from_file","get","get_mut","has_direct_bin","has_direct_dependency","init","into","into","into","is_dependency","is_node_modules","is_node_root","is_project_root","manifest_file","manifest_file","merge","needs_yarn_run","node","npm","pin_node","pin_npm","pin_pnpm","pin_yarn","platform","platform","pnpm","project","serial","try_from","try_from","try_from","try_into","try_into","try_into","type_id","type_id","type_id","vzip","vzip","vzip","workspace_manifests","workspace_roots","yarn","DependencyMapIterator","Manifest","ManifestKey","Node","Npm","Pnpm","RawManifest","ToolchainSpec","Yarn","a","b","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","default","dependencies","dependency_maps","deserialize","deserialize","dev_dependencies","extends","extends","fmt","from","from","from","from","from_file","from_file","into","into","into","into","node","npm","parse_split","platform","pnpm","serialize","to_string","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","update_manifest","volta","vzip","vzip","vzip","vzip","yarn","RECURSION_ENV_VAR","VOLTA_BYPASS","binary","debug_active_image","debug_no_platform","execute_shim","execute_tool","executor","format_tool_version","get_executor","get_tool_name","node","npm","npx","parser","pnpm","tool_name_from_file_name","yarn","DefaultBinary","bin_path","borrow","borrow_mut","command","default_execution_context","from","from_config","from_name","into","local_execution_context","platform","shared_module_path","try_from","try_into","type_id","vzip","Bypass","DefaultBinary","Executor","InternalInstall","InternalInstallCommand","Multiple","Node","Npm","Npx","PackageInstall","PackageInstallCommand","PackageLink","PackageLinkCommand","PackageUpgrade","PackageUpgradeCommand","Pnpm","ProjectLocalBinary","Tool","ToolCommand","ToolKind","Uninstall","UninstallCommand","Yarn","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","check_linked_package","cli_platform","cli_platform","cli_platform","cli_platform","cli_platform","command","command","command","command","env","envs","envs","envs","envs","envs","execute","execute","execute","execute","execute","execute","execute","for_npm_link","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","installer","into","into","into","into","into","into","into","into","kind","new","new","new","new","new","new","platform","platform","platform","platform","tool","tool","tool","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","upgrader","vzip","vzip","vzip","vzip","vzip","vzip","vzip","vzip","command","execution_context","command","current_project_name","execution_context","REQUIRED_NPM_VERSION","command","execution_context","CommandArg","Global","GlobalCommand","Install","InstallArgs","Intercepted","InterceptedCommand","Link","LinkArgs","NPM_INSTALL_ALIASES","NPM_LINK_ALIASES","NPM_UNINSTALL_ALIASES","NPM_UPDATE_ALIASES","PNPM_LINK_ALIASES","PNPM_UNINSTALL_ALIASES","PNPM_UPDATE_ALIASES","Standard","UNSAFE_GLOBAL","Uninstall","UninstallArgs","Unlink","Upgrade","UpgradeArgs","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","common_args","common_args","common_args","executor","executor","executor","executor","executor","executor_all_packages","for_npm","for_pnpm","for_yarn","from","from","from","from","from","from","from","has_global_without_prefix","into","into","into","into","into","into","into","is_flag","is_positional","manager","manager","tools","tools","tools","tools","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","type_id","vzip","vzip","vzip","vzip","vzip","vzip","vzip","command","execution_context","validate_platform_pnpm","command","execution_context","validate_platform_yarn","ActivityKind","Args","Binary","Completions","Current","Default","Fetch","Help","Install","List","Node","Npm","Npx","Pin","Pnpm","Run","Session","Setup","Shim","Tool","Uninstall","Version","Volta","Which","Yarn","add_event_end","add_event_error","add_event_start","add_event_tool_end","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","cmp","compare","default_platform","eq","equivalent","equivalent","equivalent","equivalent","event_log","exit","exit_tool","fmt","from","from","hooks","hooks","init","into","into","partial_cmp","project","project","project_mut","project_platform","publish_to_event_log","to_owned","to_string","toolchain","toolchain","toolchain_mut","try_from","try_from","try_into","try_into","type_id","type_id","vzip","vzip","AlreadyExists","Created","Deleted","DoesntExist","ShimResult","borrow","borrow_mut","create","delete","eq","equivalent","equivalent","equivalent","equivalent","from","get_shim_list_deduped","into","platform","regenerate_shims_for_dir","try_from","try_into","type_id","vzip","create","entry_to_shim_name","INTERRUPTED_EXIT_CODE","SHIM_HAS_CONTROL","pass_control_to_shim","setup_signal_handler","MAX_PROGRESS_WIDTH","MAX_WIDTH","action_str","format_error_cause","note_prefix","progress_bar","progress_spinner","success_prefix","text_width","tool_version","LOCK_FILE","LOCK_STATE","LockState","VoltaLock","_private","acquire","borrow","borrow","borrow_mut","borrow_mut","count","drop","file","from","from","into","into","try_from","try_from","try_into","try_into","type_id","type_id","vzip","vzip","AlreadyFetched","BinConfig","BundledNpm","FetchNeeded","FetchStatus","NODE_DISTRO_ARCH","NODE_DISTRO_EXTENSION","NODE_DISTRO_OS","Node","Node","Npm","Npm","PATH_VAR_NAME","Package","Package","PackageConfig","PackageDetails","PackageManifest","Pnpm","Pnpm","Spec","Tool","Yarn","Yarn","borrow","borrow","borrow_mut","borrow_mut","check_args","check_fetched","check_shim_reachable","debug_already_fetched","download_tool_error","fetch","find_expected_shim_dir","fmt","fmt","from","from","from_str_and_version","from_strings","info_fetched","info_installed","info_pinned","info_project_version","install","into","into","load_default_npm_version","name","node","npm","package","pin","pnpm","registry","registry_fetch_error","resolve","serial","sort_comparator","to_string","try_from","try_from","try_from_str","try_into","try_into","type_id","type_id","uninstall","version","vzip","vzip","yarn","NODE_DISTRO_ARCH","NODE_DISTRO_EXTENSION","NODE_DISTRO_IDENTIFIER","NODE_DISTRO_OS","Node","NodeVersion","archive_basename","archive_filename","borrow","borrow","borrow_mut","borrow_mut","clone","clone_into","ensure_fetched","fetch","fetch","fmt","fmt","fmt","from","from","install","into","into","load_default_npm_version","metadata","new","npm","pin","resolve","resolve","runtime","to_owned","to_string","to_string","try_from","try_from","try_into","try_into","type_id","type_id","version","vzip","vzip","Manifest","borrow","borrow_mut","deserialize","determine_remote_url","fetch","fetch_remote_distro","from","into","load_cached_distro","load_default_npm_version","npm_manifest_path","public_node_server_root","save_default_npm_version","try_from","try_into","type_id","unpack_archive","version","version","vzip","NodeEntry","NodeIndex","RawNodeEntry","RawNodeIndex","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","deserialize","deserialize","entries","files","fmt","from","from","from","from","from","into","into","into","into","lts","lts","lts_version_serde","npm","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","version","version","vzip","vzip","vzip","vzip","match_node_version","max_age","public_node_version_index","read_cached_opt","resolve","resolve_latest","resolve_lts","resolve_node_versions","resolve_semver","BundledNpm","Npm","archive_basename","archive_filename","borrow","borrow","borrow_mut","borrow_mut","ensure_fetched","fetch","fetch","fetch","fmt","fmt","from","from","install","install","into","into","new","pin","pin","resolve","resolve","to_string","to_string","try_from","try_from","try_into","try_into","type_id","type_id","version","vzip","vzip","determine_remote_url","fetch","fetch_remote_distro","load_cached_distro","overwrite_launcher","unpack_archive","fetch_npm_index","resolve","resolve_semver","resolve_tag","BinConfig","DirectInstall","InPlaceUpgrade","NeedsScope","No","Npm","Package","PackageConfig","PackageManager","PackageManifest","Pnpm","Yarn","Yes","bin","bins","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","check_upgraded_package","clone","clone_into","complete_install","complete_install","complete_upgrade","configure","directory","eq","fetch","fmt","from","from","from","from","from","install","install","into","into","into","into","link_package_to_shared_dir","manager","manager","manager","manager","manager","metadata","name","name","name","name","name","new","new","new","package","package","persist_install","pin","platform","platform","run_install","setup_command","setup_command","setup_staging_directory","staging","staging","to_owned","to_string","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","uninstall","uninstall","version","version","version","version","vzip","vzip","vzip","vzip","with_name","parse_manifest","validate_bins","write_config_and_shims","run_global_install","Npm","PackageManager","Pnpm","Yarn","binary_dir","borrow","borrow_mut","clone","clone_into","cmp","compare","deserialize","eq","equivalent","equivalent","equivalent","equivalent","fmt","from","get_installed_package","get_npm_package_name","get_pnpm_or_yarn_package_name","get_single_directory_name","into","partial_cmp","serialize","setup_global_command","source_dir","source_root","to_owned","try_from","try_into","type_id","vzip","BinConfig","GlobalYarnManifest","PackageConfig","PackageManifest","RawPlatformSpec","bin","bins","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","cmp","compare","default_binary_name","dependencies","deserialize","deserialize","deserialize","deserialize","deserialize","eq","equivalent","equivalent","equivalent","equivalent","for_dir","from","from","from","from","from","from_file","from_file","from_file_if_exists","from_file_if_exists","into","into","into","into","into","manager","manager","name","name","name","node","npm","package","partial_cmp","platform","platform","pnpm","serde_bins","serialize","serialize","serialize","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","version","version","version","vzip","vzip","vzip","vzip","vzip","write","write","yarn","BinMapVisitor","borrow","borrow_mut","deserialize","expecting","fmt","from","into","try_from","try_into","type_id","visit_map","visit_str","vzip","binaries_from_package","remove_config_and_shim","remove_shared_link_dir","uninstall","Pnpm","archive_basename","archive_filename","borrow","borrow_mut","ensure_fetched","fetch","fetch","fmt","from","install","into","new","pin","resolve","resolve","to_string","try_from","try_into","type_id","version","vzip","determine_remote_url","fetch","fetch_remote_distro","load_cached_distro","unpack_archive","write_launcher","fetch_pnpm_index","resolve","resolve_semver","resolve_tag","NPM_ABBREVIATED_ACCEPT_HEADER","PackageDetails","PackageIndex","RawDistInfo","RawPackageMetadata","RawPackageVersionInfo","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone_into","deserialize","deserialize","deserialize","dist","dist_tags","entries","fetch_npm_registry","find_unpack_dir","fmt","fmt","fmt","fmt","from","from","from","from","from","from","into","into","into","into","into","name","public_registry_index","public_registry_package","scoped_public_registry_package","shasum","tags","tarball","to_owned","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","version","version","versions","vzip","vzip","vzip","vzip","vzip","HAS_VERSION","TOOL_SPEC_PATTERN","is_version_like","Yarn","archive_basename","archive_filename","borrow","borrow_mut","ensure_fetched","fetch","fetch","fmt","from","install","into","metadata","new","pin","resolve","resolve","to_string","try_from","try_into","type_id","version","vzip","determine_remote_url","ensure_bin_is_executable","fetch","fetch_remote_distro","load_cached_distro","unpack_archive","RawYarnAsset","RawYarnEntry","RawYarnIndex","YarnIndex","assets","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","deserialize","deserialize","deserialize","entries","from","from","from","from","from","into","into","into","into","is_full_release","name","tag_name","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","vzip","vzip","vzip","vzip","fetch_yarn_index","resolve","resolve_custom_tag","resolve_latest_legacy","resolve_semver","resolve_semver_from_registry","resolve_semver_legacy","resolve_semver_npm","resolve_tag","LazyToolchain","Toolchain","borrow","borrow","borrow_mut","borrow_mut","current","from","from","get","get_mut","init","into","into","platform","platform","save","serial","set_active_node","set_active_npm","set_active_pnpm","set_active_yarn","toolchain","try_from","try_from","try_into","try_into","type_id","type_id","vzip","vzip","NodeVersion","Platform","borrow","borrow","borrow_mut","borrow_mut","deserialize","deserialize","eq","eq","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","equivalent","fmt","fmt","from","from","into","into","into_json","node","npm","of","pnpm","runtime","serialize","serialize","try_from","try_from","try_from","try_into","try_into","type_id","type_id","vzip","vzip","yarn","Custom","Exact","Latest","Lts","None","Semver","Tag","VersionSpec","VersionTag","borrow","borrow","borrow_mut","borrow_mut","default","fmt","fmt","fmt","fmt","from","from","from_str","from_str","hashmap_version_serde","into","into","option_version_serde","parse_requirements","parse_version","serial","to_string","to_string","trim_version","try_from","try_from","try_into","try_into","type_id","type_id","version_serde","vzip","vzip","Wrapper","borrow","borrow_mut","deserialize","deserialize","from","into","try_from","try_into","type_id","vzip","deserialize","serialize","parse_requirements","VersionVisitor","borrow","borrow_mut","deserialize","expecting","fmt","from","into","serialize","try_from","try_into","type_id","visit_str","vzip"],"q":[[0,"volta_core"],[21,"volta_core::command"],[22,"volta_core::error"],[200,"volta_core::error::ErrorKind"],[294,"volta_core::error::kind"],[423,"volta_core::error::kind::ErrorKind"],[517,"volta_core::error::reporter"],[521,"volta_core::event"],[600,"volta_core::event::EventKind"],[606,"volta_core::fs"],[619,"volta_core::hook"],[732,"volta_core::hook::serial"],[838,"volta_core::hook::tool"],[903,"volta_core::hook::tool::DistroHook"],[905,"volta_core::hook::tool::MetadataHook"],[907,"volta_core::inventory"],[917,"volta_core::layout"],[924,"volta_core::layout::unix"],[926,"volta_core::log"],[984,"volta_core::monitor"],[987,"volta_core::platform"],[1115,"volta_core::platform::image"],[1131,"volta_core::platform::system"],[1141,"volta_core::project"],[1201,"volta_core::project::serial"],[1265,"volta_core::run"],[1283,"volta_core::run::binary"],[1300,"volta_core::run::executor"],[1434,"volta_core::run::node"],[1436,"volta_core::run::npm"],[1439,"volta_core::run::npx"],[1442,"volta_core::run::parser"],[1542,"volta_core::run::pnpm"],[1545,"volta_core::run::yarn"],[1548,"volta_core::session"],[1621,"volta_core::shim"],[1644,"volta_core::shim::platform"],[1646,"volta_core::signal"],[1650,"volta_core::style"],[1660,"volta_core::sync"],[1685,"volta_core::tool"],[1758,"volta_core::tool::node"],[1803,"volta_core::tool::node::fetch"],[1824,"volta_core::tool::node::metadata"],[1872,"volta_core::tool::node::resolve"],[1881,"volta_core::tool::npm"],[1917,"volta_core::tool::npm::fetch"],[1923,"volta_core::tool::npm::resolve"],[1927,"volta_core::tool::package"],[2024,"volta_core::tool::package::configure"],[2027,"volta_core::tool::package::install"],[2028,"volta_core::tool::package::manager"],[2062,"volta_core::tool::package::metadata"],[2150,"volta_core::tool::package::metadata::serde_bins"],[2164,"volta_core::tool::package::uninstall"],[2168,"volta_core::tool::pnpm"],[2190,"volta_core::tool::pnpm::fetch"],[2196,"volta_core::tool::pnpm::resolve"],[2200,"volta_core::tool::registry"],[2272,"volta_core::tool::serial"],[2275,"volta_core::tool::yarn"],[2298,"volta_core::tool::yarn::fetch"],[2304,"volta_core::tool::yarn::metadata"],[2349,"volta_core::tool::yarn::resolve"],[2358,"volta_core::toolchain"],[2389,"volta_core::toolchain::serial"],[2431,"volta_core::version"],[2472,"volta_core::version::hashmap_version_serde"],[2483,"volta_core::version::option_version_serde"],[2485,"volta_core::version::serial"],[2486,"volta_core::version::version_serde"],[2500,"std::process"],[2501,"std::ffi::os_str"],[2502,"core::convert"],[2503,"core::fmt"],[2504,"core::fmt"],[2505,"alloc::boxed"],[2506,"core::convert"],[2507,"alloc::string"],[2508,"core::result"],[2509,"core::any"],[2510,"core::ops::function"],[2511,"std::path"],[2512,"serde::de"],[2513,"serde::ser"],[2514,"tempfile::dir"],[2515,"tempfile::file"],[2516,"std::path"],[2517,"std::io::error"],[2518,"core::ops::function"],[2519,"core::iter::traits::iterator"],[2520,"std::fs"],[2521,"core::iter::traits::collect"],[2522,"node_semver"],[2523,"alloc::collections::btree::set"],[2524,"volta_layout::v4"],[2525,"volta_layout::v1"],[2526,"log"],[2527,"log"],[2528,"core::cmp"],[2529,"std::ffi::os_str"],[2530,"std::env"],[2531,"core::fmt"],[2532,"std::fs"],[2533,"console::utils"],[2534,"indicatif::progress_bar"],[2535,"alloc::borrow"],[2536,"core::marker"],[2537,"core::ops::function"],[2538,"core::time"],[2539,"node_semver::range"],[2540,"serde::de"]],"d":["","","","Events for the sessions in executables and shims and …","Provides utilities for operating on the filesystem.","Provides types for working with Volta hooks.","Provides types for working with Volta’s inventory, the …","","This module provides a custom Logger implementation for …","","","Provides the Project type, which represents a Node project …","","Provides the Session type, which represents the user’s …","Provides utilities for modifying shims for 3rd-party …","","The view layer of Volta, with utilities for styling …","Inter-process locking on the Volta directory","","","","","Thrown when package tries to install a binary that is …","Thrown when executing an external binary fails","Thrown when a binary could not be found in the local …","Thrown when building the virtual environment path fails","Thrown when unable to launch a command with VOLTA_BYPASS …","Thrown when a user tries to volta fetch something other …","Thrown when a user tries to volta pin something other than …","Thrown when the Completions out-dir is not a directory","Package configuration is missing or incorrect.","Thrown when the containing directory could not be …","Trait providing the with_context method to easily convert …","","Thrown when unable to start the migration executable","","Thrown when unable to create the layout file","Thrown when unable to create a link to the shared global …","Thrown when creating a temporary directory fails","Thrown when creating a temporary file fails","","Thrown when deleting a directory fails","Thrown when deleting a file fails","","","A required environment variable was unset or invalid.","Contains the error value","","The requested executable is not available.","Thrown when unable to execute a hook command","The requested executable could not be run.","Exit codes supported by Volta Errors","Thrown when volta.extends keys result in an infinite cycle","Thrown when determining the path to an extension manifest …","","A file could not be read or written.","Thrown when a hook command returns a non-zero exit code","Thrown when a hook contains multiple fields (prefix, …","Thrown when a hook doesn’t contain any of the known …","Thrown when determining the path to a hook fails","","Thrown when determining the name of a newly-installed …","An invalid combination of command-line arguments was …","","Thrown when output from a hook command could not be read","Thrown when a user does e.g. volta install node 12 instead …","Thrown when a user does e.g. volta install 12 instead of …","Thrown when a format other than “npm” or “github” …","Thrown when a tool name is invalid per npm’s rules.","Thrown when unable to acquire a lock on the Volta directory","A network error occurred.","Thrown when pinning or installing npm@bundled and couldn’…","Thrown when pnpm is not set at the command-line","Thrown when Yarn is not set at the command-line","Thrown when a user tries to install a Yarn or npm version …","Thrown when default pnpm is not set","Thrown when default Yarn is not set","","Thrown when the install dir could not be determined","","Thrown when a user tries to pin a npm, pnpm, or Yarn …","Thrown when the platform (Node version) could not be …","Thrown when parsing the project manifest and there is a …","Thrown when pnpm is not set in a project","Thrown when Yarn is not set in a project","Thrown when no shell profiles could be found","No match could be found for the requested version string.","Thrown when there is no Node version matching a requested …","Thrown when the user tries to pin Node or Yarn versions …","The command or feature is not yet implemented.","Thrown when npm link is called with a package that isn’t …","Thrown when npm link is called with a package that was not …","Thrown when there is no npm version matching the requested …","","Contains the success value","Thrown when the command to install a global package is not …","Thrown when parsing the package manifest fails","Thrown when reading the package manifest fails","Thrown when a specified package could not be found on the …","Thrown when parsing a package manifest fails","Thrown when reading a package manifest fails","Thrown when a package has been unpacked but is not formed …","Thrown when writing a package manifest fails","Thrown when unable to parse a bin config file","Thrown when unable to parse a hooks.json file","Thrown when unable to parse the node index cache","Thrown when unable to parse the node index","Thrown when unable to parse the node index cache expiration","Thrown when unable to parse the npm manifest file from a …","Thrown when unable to parse a package configuration","Thrown when unable to parse the platform.json file","Thrown when unable to parse a tool spec (<tool>[@<version>]…","Thrown when persisting an archive to the inventory fails","Thrown when there is no pnpm version matching a requested …","Thrown when executing a project-local binary fails","Thrown when a project-local binary could not be found","Thrown when a publish hook contains both the url and bin …","Thrown when a publish hook contains neither url nor bin …","Thrown when there was an error reading the user bin …","Thrown when there was an error reading the config for a …","Thrown when unable to read the default npm version file","Thrown when unable to read the contents of a directory","Thrown when there was an error opening a hooks.json file","Thrown when there was an error reading the Node Index Cache","Thrown when there was an error reading the Node Index …","Thrown when there was an error reading the npm manifest …","Thrown when there was an error reading a package …","Thrown when there was an error opening the user platform …","Thrown when the public registry for Node or Yarn could not …","Thrown when the shim binary is called directly, not …","Thrown when there was an error setting a tool to executable","Thrown when there was an error copying an unpacked tool to …","Thrown when Volta is unable to create a shim","Thrown when Volta is unable to remove a shim","Thrown when serializing a bin config to JSON fails","Thrown when serializing a package config to JSON fails","Thrown when serializing the platform to JSON fails","No error occurred.","Thrown when a given feature has not yet been implemented","An unknown error occurred.","Thrown when unpacking an archive (tarball or zip) fails","Thrown when a package to upgrade was not found","Thrown when a package to upgrade was installed with a …","","Error type for Volta","Thrown when there was an error writing a bin config file","Thrown when there was an error writing the default npm to …","Thrown when there was an error writing the npm launcher","Thrown when there was an error writing the node index cache","Thrown when there was an error writing the node index …","Thrown when there was an error writing a package config","Thrown when writing the platform.json file fails","Thrown when a user attempts to install a version of Yarn2","Thrown when there is an error fetching the latest version …","Thrown when there is no Yarn version matching a requested …","","","","","","","","","","The exit code Volta should use when this error stops …","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Create a new VoltaError instance including a source error","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Get a reference to the ErrorKind for this error","","Report an error, both to the console and to error logs","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Thrown when package tries to install a binary that is …","Thrown when executing an external binary fails","Thrown when a binary could not be found in the local …","Thrown when building the virtual environment path fails","Thrown when unable to launch a command with VOLTA_BYPASS …","Thrown when a user tries to volta fetch something other …","Thrown when a user tries to volta pin something other than …","Thrown when the Completions out-dir is not a directory","Thrown when the containing directory could not be …","","Thrown when unable to start the migration executable","","Thrown when unable to create the layout file","Thrown when unable to create a link to the shared global …","Thrown when creating a temporary directory fails","Thrown when creating a temporary file fails","","Thrown when deleting a directory fails","Thrown when deleting a file fails","","","","Thrown when unable to execute a hook command","Thrown when volta.extends keys result in an infinite cycle","Thrown when determining the path to an extension manifest …","Thrown when a hook command returns a non-zero exit code","Thrown when a hook contains multiple fields (prefix, …","Thrown when a hook doesn’t contain any of the known …","Thrown when determining the path to a hook fails","Thrown when determining the name of a newly-installed …","","Thrown when output from a hook command could not be read","Thrown when a user does e.g. volta install node 12 instead …","Thrown when a user does e.g. volta install 12 instead of …","Thrown when a format other than “npm” or “github” …","Thrown when a tool name is invalid per npm’s rules.","Thrown when unable to acquire a lock on the Volta directory","Thrown when pinning or installing npm@bundled and couldn’…","Thrown when pnpm is not set at the command-line","Thrown when Yarn is not set at the command-line","Thrown when a user tries to install a Yarn or npm version …","Thrown when default pnpm is not set","Thrown when default Yarn is not set","","Thrown when the install dir could not be determined","","Thrown when a user tries to pin a npm, pnpm, or Yarn …","Thrown when the platform (Node version) could not be …","Thrown when parsing the project manifest and there is a …","Thrown when pnpm is not set in a project","Thrown when Yarn is not set in a project","Thrown when no shell profiles could be found","Thrown when there is no Node version matching a requested …","Thrown when the user tries to pin Node or Yarn versions …","Thrown when npm link is called with a package that isn’t …","Thrown when npm link is called with a package that was not …","Thrown when there is no npm version matching the requested …","","","Thrown when the command to install a global package is not …","Thrown when parsing the package manifest fails","Thrown when reading the package manifest fails","Thrown when a specified package could not be found on the …","Thrown when parsing a package manifest fails","Thrown when reading a package manifest fails","Thrown when a package has been unpacked but is not formed …","Thrown when writing a package manifest fails","Thrown when unable to parse a bin config file","Thrown when unable to parse a hooks.json file","Thrown when unable to parse the node index cache","Thrown when unable to parse the node index","Thrown when unable to parse the node index cache expiration","Thrown when unable to parse the npm manifest file from a …","Thrown when unable to parse a package configuration","Thrown when unable to parse the platform.json file","Thrown when unable to parse a tool spec (<tool>[@<version>]…","Thrown when persisting an archive to the inventory fails","Thrown when there is no pnpm version matching a requested …","Thrown when executing a project-local binary fails","Thrown when a project-local binary could not be found","Thrown when a publish hook contains both the url and bin …","Thrown when a publish hook contains neither url nor bin …","","Thrown when there was an error reading the user bin …","Thrown when there was an error reading the config for a …","Thrown when unable to read the default npm version file","Thrown when unable to read the contents of a directory","Thrown when there was an error opening a hooks.json file","Thrown when there was an error reading the Node Index Cache","Thrown when there was an error reading the Node Index …","Thrown when there was an error reading the npm manifest …","Thrown when there was an error reading a package …","Thrown when there was an error opening the user platform …","Thrown when the public registry for Node or Yarn could not …","Thrown when the shim binary is called directly, not …","Thrown when there was an error setting a tool to executable","Thrown when there was an error copying an unpacked tool to …","Thrown when Volta is unable to create a shim","Thrown when Volta is unable to remove a shim","Thrown when serializing a bin config to JSON fails","Thrown when serializing a package config to JSON fails","Thrown when serializing the platform to JSON fails","Thrown when a given feature has not yet been implemented","Thrown when unpacking an archive (tarball or zip) fails","Thrown when a package to upgrade was not found","Thrown when a package to upgrade was installed with a …","","Thrown when there was an error writing a bin config file","Thrown when there was an error writing the default npm to …","Thrown when there was an error writing the npm launcher","Thrown when there was an error writing the node index cache","Thrown when there was an error writing the node index …","Thrown when there was an error writing a package config","Thrown when writing the platform.json file fails","Thrown when a user attempts to install a version of Yarn2","Thrown when there is an error fetching the latest version …","Thrown when there is no Yarn version matching a requested …","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Combines all the arguments into a single String","","Report an error, both to the console and to error logs","Write an error log with all details about the error","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Constructs a new ‘EventLog’","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Creates a staging directory in the Volta tmp directory","Creates a NamedTempFile in the Volta tmp directory","Reads the contents of a directory and returns a Vec of the …","Converts a failure because of file not found into a …","Reads the full contents of a directory, eagerly extracting …","Reads a file, if it exists.","Removes the target directory, if it exists. If the …","Removes the target file, if it exists. If the file doesn’…","Rename a file or directory to a new name, retrying if the …","Ensure that a given file has ‘executable’ permissions, …","Create a directory symlink. The dst path will be a …","Create a file symlink. The dst path will be a symbolic …","Opens a file, creating it if it doesn’t exist","Reports an event by forking a process and sending the …","Volta hooks related to events.","","Volta hook configuration","Lazily loaded Volta hook configuration","","A hook for publishing Volta events.","Format of the registry used for Yarn (Npm or Github)","Volta hooks for an individual tool","Reports an event by sending a POST request to a URL.","Volta hooks for Yarn","","","","","","","","","","","","","","","Returns the current hooks, which are a merge between the …","The hook for resolving the URL for a distro version","The hook for resolving the URL for a distro version","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the merged hooks loaded from an iterator of …","","Forces the loading of the hook configuration from both …","The hook for resolving the Tool Index URL","The hook for resolving the Tool Index URL","Constructs a new LazyHookConfig","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","The hook for resolving the URL for the latest version","The hook for resolving the URL for the latest version","Merges this HookConfig with another, giving precedence to …","Extends this ToolHooks with another, giving precendence to …","Extends this YarnHooks with another, giving precendence to …","Merges this EventHooks with another, giving precedence to …","","","","","","","","","The hook for publishing events, if any.","","","Types representing Volta Tool Hooks.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","A hook for resolving the distro URL for a given tool …","","","A hook for resolving the URL for metadata about a tool","","","","","","","","","A hook for resolving the URL for the Yarn index","","","","","","","Use the expected filename to determine the extension for …","","","","","","","","","","","","","","","","Execute a shell command and return the trimmed stdout from …","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Performs resolution of the distro URL based on the given …","Performs resolution of the metadata URL based on the given …","Performs resolution of the metadata URL based on the given …","","","","","","","","","","","","","","","","","Checks if a given Node version image is available on the …","Collects a set of all Node versions fetched on the local …","Checks if a given npm version image is available on the …","Collects a set of all npm versions fetched on the local …","Collects a set of all Package Configs on the local machine","Checks if a given pnpm version image is available on the …","Collects a set of all pnpm versions fetched on the local …","Reads the contents of a directory and returns the set of …","Checks if a given Yarn version image is available on the …","Collects a set of all Yarn versions fetched on the local …","","","Determine the binary install directory from the currently …","","","","","","","","","","Represents the context from which the logger was created","Represents the level of verbosity that was requested by …","","","","Log messages from the migration","","","","Log messages from one of the shims","","","","Log messages from the volta executable","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Initialize the global logger with a Logger instance Will …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Determines the correct logging level based on the …","","","","","","","","","","","","","","","","","","Wraps the supplied content to the terminal width, if we …","Send event to the spawned command process","","","Represents a version from a pinned Binary platform","Represents a (maybe) platform with values from the command …","Represents a version from the command line (via volta run)","Represents a version from the user default platform","A platform image.","","Represents 3 possible states: Having a value, not having a …","","Represents a real Platform, with Versions pulled from one …","Represents the specification of a single Platform, …","Represents a version from a project manifest","","The source with which a version is associated","","A lightweight namespace type representing the system …","Convert this PlatformSpec into a Platform with all sources …","Convert this PlatformSpec into a Platform with all sources …","Convert this PlatformSpec into a Platform with all sources …","","","","","","","","","","","","","","","Check out a Platform into a fully-realized Image","","","","","","","","","","","","","","","","Returns the user’s currently active platform, if any","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Converts the InheritOption into a regular Option by …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Applies a function to the contained value (if any)","Merges the CliPlatform with a Platform, inheriting from …","The pinned version of Node.","","","","The custom version of npm, if any. None represents using …","","","","","The pinned version of pnpm, if any.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The pinned version of Yarn, if any.","","","","A platform image.","","","","Returns the argument unchanged.","Calls U::from(self).","The pinned version of Node.","The custom version of npm, if any. None represents using …","Produces a modified version of the current PATH …","The pinned version of pnpm, if any.","Determines the sourced version of npm that will be …","","","","","The pinned version of Yarn, if any.","A lightweight namespace type representing the system …","","","Returns the argument unchanged.","Calls U::from(self).","Produces a modified version of the current PATH …","","","","","A lazily loaded Project","","A Node project workspace in the filesystem","","","","","","","","Searches the project roots to find the path to a …","Starts at base_dir and walks up the directory tree until a …","Creates an optional Project instance from the current …","Creates an optional Project instance from the specified …","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Creates a Project instance from the given package manifest …","","","Returns true if the input binary name is a direct …","Returns true if the project dependency map contains the …","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","Returns a reference to the manifest file for the current …","","","Yarn projects that are using PnP or pnpm linker need to …","","","Pins the Node version in this project’s manifest file","Pins the npm version in this project’s manifest file","Pins the pnpm version in this project’s manifest file","Pins the Yarn version in this project’s manifest file","Returns a reference to the Project’s PlatformSpec, if …","","","","","","","","","","","","","","","","","","Returns an iterator of paths to all of the workspace roots","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","Moves the tool versions into a PartialPlatform and returns …","","","","","","","","","","","","","","","","","Updates the volta hash in the specified manifest with the …","","","","","","","Environment variable set internally when a shim has been …","","","Write a debug message with the full image that will be …","Write a debug message that there is no platform available","Execute a shim command, based on the command-line …","Execute a tool with the provided arguments","","","Get the appropriate Tool command, based on the requested …","Determine the name of the command to run by inspecting the …","","","","","","","","Information about the location and execution context of …","","","","Determine the correct command to run for a 3rd-party binary","Determine the execution context (PATH and failure error …","Returns the argument unchanged.","","Load information about a default binary by name, if …","Calls U::from(self).","Determine the execution context (PATH and failure error …","","Determine the value for NODE_PATH, with the shared lib …","","","","","","","","","Executor for running an internal install (installing Node, …","","","","","","Process builder for launching a package install command …","","Process builder for launching a npm link <package> command","","Process builder for launching a global package upgrade …","","","","Process builder for launching a Volta-managed tool","The kind of tool being executed, used to determine the …","","Executor for running a tool uninstall command.","","","","","","","","","","","","","","","","","","Check for possible failure cases with the linked package: …","","Updates the Platform for the command to include values …","Updates the Platform for the command to include values …","Updates the Platform for the command to include values …","Updates the Platform for the command to include values …","","The command that will ultimately be executed","The command that will ultimately be executed","The command that will ultimately be executed","Adds or updates a single environment variable that the …","","Adds or updates environment variables that the command …","Adds or updates environment variables that the command …","Adds or updates environment variables that the command …","Adds or updates environment variables that the command …","","Runs the command, returning the ExitStatus if it …","Runs the install command, applying the necessary …","Runs the link command, applying the necessary …","Runs the upgrade command, applying the necessary …","Runs the install, using Volta’s internal install logic …","Runs the uninstall with Volta’s internal uninstall logic","","","","Returns the argument unchanged.","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","The installer that modifies the command as necessary and …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","The platform to use when running the command.","The platform to use when running the command","The platform to run the command under","The tool the user wants to link","","","","","","","","","","","","","","","","","","","","","","","","","","","Helper utility to modify the command and provide the …","","","","","","","","","Build a ToolCommand for Node","Determine the execution context (PATH and failure error …","Build an Executor for npm","Determine the name of the current project, if possible","Determine the execution context (PATH and failure error …","","Build a ToolCommand for npx","Determine the execution context (PATH and failure error …","","","","","The arguments passed to a global install command","","An intercepted local command","","The arguments passed to an npm link command","Aliases that npm supports for the ‘install’ command","Aliases that npm supports for the ‘link’ command","Aliases that npm supports for the ‘uninstall’ command","Aliases that npm supports for the update command","Aliases that pnpm supports for the ‘link’ command see: …","Aliases that pnpm supports for the ‘remove’ command, …","Aliases that pnpm supports for the ‘update’ command, …","","","","The list of tools passed to an uninstall command","","","The list of tools passed to an upgrade command","","","","","","","","","","","","","","","Common arguments that apply to each tool (e.g. flags)","Common arguments that apply to each tool (e.g. flags)","The common arguments that apply to each tool","","Convert these global install arguments into an executor …","Convert the tools into an executor for the uninstall …","Convert these global upgrade arguments into an executor …","","Build an executor to upgrade all global packages that were …","Parse the given set of arguments to see if they correspond …","Parse the given set of arguments to see if they correspond …","Parse the given set of arguments to see if they correspond …","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Check if the provided argument list includes a global flag …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","The package manager being used","The package manager being used","The individual tool arguments","","The individual tool arguments","The list of tools to link (if any)","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Determine the execution context (PATH and failure error …","","Build an Executor for Yarn","Determine the execution context (PATH and failure error …","","","","","","","","","","","","","","","","","","Represents the user’s state during an execution of a …","","","","","","","","","","","","","","","","","","","","","Returns the user’s default platform, if any","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Produces a reference to the hook configuration","","Constructs a new Session.","Calls U::from(self).","Calls U::from(self).","","Produces a reference to the current Node project, if any.","","Produces a mutable reference to the current Node project, …","Returns the current project’s pinned platform image, if …","","","","Produces a reference to the current toolchain (default …","","Produces a mutable reference to the current toolchain","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","","Calls U::from(self).","Unix-specific shim utilities","","","","","","","","","","","","","","Determines the string to display based on the Origin of …","Format the underlying cause of an error","Generate the styled prefix for a note","Constructs a command-line progress bar based on the …","Constructs a command-line progress spinner with the …","Generate the styled prefix for a success message","Get the width of the terminal, limited to a maximum of …","","","","The current state of locks for this process.","An RAII implementation of a process lock on the Volta …","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","Represents the result of checking if a tool is available …","","","","","","","","","","","","Details about a package in the npm Registry","","","","Specification for a tool and its associated version.","Trait representing all of the actions that can be taken …","","","","","","","Check the args for the bad patterns of","Uses the supplied already_fetched predicate to determine …","Check if a newly-installed shim is first on the PATH. If …","","","Fetch a Tool into the local inventory","Locate the base directory for the relevant shim in the …","","","Returns the argument unchanged.","Returns the argument unchanged.","","Get a valid, sorted Vec<Spec> given a Vec<String>.","","","","","Install a tool, making it the default so it is available …","Calls U::from(self).","Calls U::from(self).","","The name of the tool, without the version, used for …","","","","Pin a tool in the local project so that it is usable …","","","","Resolve a tool spec into a fully realized Tool that can be …","","Compare Specs for sorting when converting from strings","","","","Try to parse a tool and version from a string like `[@].","","","","","Uninstall a tool, removing it from the local inventory","","","","","The architecture component of a Node distro filename","The extension for Node distro files","The file identifier in the Node index files array","The OS component of a Node distro filename","The Tool implementation for fetching and installing Node","A full Node version including not just the version of Node …","","","","","","","","","","Provides fetcher for Node distributions","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","Calls U::from(self).","Calls U::from(self).","Load the local npm version file to determine the default …","","","The npm version globally installed with the Node distro.","","Provides resolution of Node requirements into specific …","","The version of Node itself.","","","","","","","","","","","","","The portion of npm’s package.json file that we care about","","","","Determine the remote URL to download from, using the hooks …","","Fetch the distro archive from the internet","Returns the argument unchanged.","Calls U::from(self).","Return the archive if it is valid. It may have been …","Load the local npm version file to determine the default …","","","Save the default npm version to the filesystem for a given …","","","","Unpack the node archive into the image directory so that …","Parse the version out of a package.json file","","","","The index of the public Node server.","","","","","","","","","","","","","","","","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","Get the cache max-age of an HTTP response.","Returns the URL of the index of available Node versions on …","Reads a public index from the Node cache, if it exists and …","","","","","","The Tool implementation for setting npm to the version …","The Tool implementation for fetching and installing npm","","","","","","","","Provides fetcher for npm distributions","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","","","","Provides resolution of npm Version requirements into …","","","","","","","","","","","","","Determine the remote URL to download from, using the hooks …","","Fetch the distro archive from the internet","Return the archive if it is valid. It may have been …","Overwrite the launcher script","Unpack the npm archive into the image directory so that it …","","","","","Configuration information about a single installed binary …","Helper struct for direct installs through npm i -g or …","Helper struct for direct in-place upgrades using …","","","","The Tool implementation for installing 3rd-party global …","Configuration information about an installed package","The package manager used to install a given package","The relevant information we need out of a package’s …","","","","The bin section, containing a map of binary names to …","The binaries installed by this package","","","","","","","","","Check for possible failure cases with the package to be …","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","The package manager that was used to install this package","The package manager used to install this binary","","","","The package name","The binary name","The name of the package","","","","","The package that installed the binary","","","The platform used to install this package","The platform used to install this binary","","","","Create the temporary staging directory we will use to …","","","","","","","","","","","","","","","","","","Uninstalls the specified package.","","The package version","The package version","The version of the package","","","","","","Read the manifest for the package being installed","Validate that we aren’t attempting to install a bin that …","Generate configuration files and shims for the package and …","Use npm install --global to install the package","","The package manager used to install a given package","","","Given the package_root, returns the directory where …","","","","","","","","","","","","","","Returns the argument unchanged.","Determine the name of the package that was installed into …","Determine the package name for an npm global install","Determine the package name for a pnpm or Yarn global …","Return the name of the single subdirectory (if any) to the …","Calls U::from(self).","","","Modify a given Command to be set up for global installs, …","Given the package_root, returns the directory where the …","Given the package_root, returns the root of the source …","","","","","","Configuration information about a single installed binary …","Struct to read the dependencies out of Yarn’s global …","Configuration information about an installed package","The relevant information we need out of a package’s …","","The bin section, containing a map of binary names to …","The binaries installed by this package","","","","","","","","","","","","","Determine the default binary name from the package name","","","","","","","","","","","","Parse the package.json for a given package directory","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Parse a PackageConfig instance from a config file","Parse a BinConfig instance from the given config file","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","The package manager that was used to install this package","The package manager used to install this binary","The package name","The binary name","The name of the package","","","The package that installed the binary","","The platform used to install this package","The platform used to install this binary","","","","","","","","","","","","","","","","","","","","","The package version","The package version","The version of the package","","","","","","Write this PackageConfig into the appropriate config file","Write this BinConfig to the appropriate config file","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","Reads the contents of a directory and returns a Vec …","Remove a shim and its associated configuration file","Remove the link to the package in the shared lib directory","Uninstalls the specified package.","The Tool implementation for fetching and installing pnpm","","","","","","Provides fetcher for pnpm distributions","","","Returns the argument unchanged.","","Calls U::from(self).","","","","","","","","","","","Determine the remote URL to download from, using the hooks …","","Fetch the distro archive from the internet","Return the archive if it is valid. It may have been …","Unpack the pnpm archive into the image directory so that …","Create executable launchers for the pnpm and pnpx binaries","Fetch the index of available pnpm versions from the npm …","","","","","Details about a package in the npm Registry","Index of versions of a specific package from the npm …","","Package Metadata Response","","","","","","","","","","","","","","","","","","","","","Figure out the unpacked package directory name dynamically","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Determine if a given string is “version-like”.","The Tool implementation for fetching and installing Yarn","","","","","","Provides fetcher for Yarn distributions","","","Returns the argument unchanged.","","Calls U::from(self).","","","","Provides resolution of Yarn requirements into specific …","","","","","","","","Determine the remote URL to download from, using the hooks …","","","Fetch the distro archive from the internet","Return the archive if it is valid. It may have been …","Unpack the yarn archive into the image directory so that …","","","","The public Yarn index.","The GitHub API provides a list of assets. Some Yarn …","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Is this entry a full release, i.e., does this entry’s …","The filename of an asset included in a Yarn GitHub release.","Yarn releases are given a tag name of the form “v$version…","","","","","","","","","","","","","","","","","","","","","","","","","","Lazily loaded toolchain","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Forces loading of the toolchain and returns an immutable …","Forces loading of the toolchain and returns a mutable …","Creates a new LazyToolchain","Calls U::from(self).","Calls U::from(self).","","","","","Set the active Node version in the default platform file.","Set the active Npm version in the default platform file.","Set the active pnpm version in the default platform file.","Set the active Yarn version in the default platform file.","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Serialize the Platform to a JSON String","","","","","","","","","","","","","","","","","","An arbitrary tag version","Exact Version","The ‘latest’ tag, a special case that exists for all …","The ‘lts’ tag, a special case for Node","No version specified (default)","SemVer Range","Arbitrary Version Tag","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","","","","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,11,11,11,11,11,11,11,4,11,0,11,11,11,11,11,11,11,11,11,11,11,11,4,20,0,4,11,4,0,11,11,0,4,11,11,11,11,0,11,4,11,11,11,11,11,11,11,4,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,4,11,11,4,11,11,11,11,20,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,4,11,4,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,7,10,4,7,10,4,4,4,4,7,7,7,10,4,7,7,10,4,7,7,7,10,4,0,7,10,0,0,7,10,4,7,7,10,4,7,10,4,7,10,4,7,10,4,172,173,174,175,176,177,178,175,179,180,181,182,183,184,185,186,187,188,189,190,191,192,176,193,177,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,173,193,229,230,177,231,232,233,234,235,236,237,238,221,222,239,240,241,192,215,242,243,244,217,245,190,246,247,248,173,174,249,190,246,250,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,173,174,175,176,177,178,175,179,180,181,182,183,184,185,186,187,188,189,190,191,192,176,193,177,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,173,193,229,230,177,231,232,233,234,235,236,237,238,221,222,239,240,241,192,215,242,243,244,217,245,190,246,247,248,173,174,249,190,246,250,0,0,0,0,24,24,24,0,0,0,0,24,24,23,23,23,23,23,23,29,23,27,29,24,23,27,29,24,27,29,24,29,24,29,29,29,29,24,24,24,24,27,23,29,29,24,23,27,29,24,0,23,23,27,29,24,24,27,29,29,29,23,27,29,24,27,23,27,29,24,23,27,29,24,23,27,29,24,0,23,27,29,24,251,252,252,253,252,254,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,46,0,0,46,0,0,0,31,0,49,45,50,52,47,31,46,49,45,50,52,47,31,46,45,50,52,31,46,31,31,31,31,46,46,46,46,45,45,31,46,49,45,50,52,47,31,46,45,45,46,49,50,52,49,49,45,50,52,47,31,46,50,52,45,50,52,47,0,45,45,45,45,50,45,45,47,0,49,0,49,45,50,52,47,47,31,31,46,49,45,50,52,47,31,46,49,45,50,52,47,31,46,49,45,50,52,47,31,46,45,45,0,0,0,0,0,0,0,58,59,57,58,59,57,60,56,61,62,58,59,57,60,56,61,62,58,59,57,60,56,61,62,61,62,60,59,58,59,57,60,56,61,62,61,62,58,59,57,60,56,61,62,58,58,60,59,58,61,62,61,62,60,60,61,60,58,59,56,58,59,57,60,56,61,62,58,59,58,59,57,60,56,61,62,58,59,57,60,56,61,62,58,59,57,60,56,61,62,57,58,59,57,60,56,61,62,60,0,63,65,0,0,0,0,0,63,65,0,0,63,65,0,0,63,65,64,63,65,64,0,63,65,64,63,63,63,63,65,65,65,65,64,64,64,64,0,63,65,64,64,63,65,64,63,65,64,64,63,65,64,63,65,64,63,65,64,63,65,64,63,65,64,255,255,256,256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,0,0,0,0,0,0,74,71,0,0,74,0,71,71,74,0,0,74,72,71,74,72,71,71,71,72,72,72,71,74,72,71,72,74,72,71,72,0,72,72,72,72,71,74,72,71,74,72,71,74,72,71,74,72,71,0,0,0,0,87,0,87,87,0,88,0,88,0,0,87,88,0,0,0,81,81,81,83,83,87,88,81,89,82,83,87,88,81,89,82,0,82,83,87,88,81,89,82,83,87,88,81,89,82,83,81,81,82,88,81,81,81,81,81,87,83,87,88,81,89,82,0,88,83,87,88,81,89,82,88,89,85,81,89,82,85,81,89,82,81,85,81,89,82,83,0,83,87,88,81,89,82,87,83,87,88,81,81,89,82,83,87,88,81,89,82,83,87,88,81,89,82,83,83,87,88,81,89,82,83,83,83,83,85,81,89,82,0,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,0,257,257,257,257,257,257,257,257,257,0,0,0,93,44,91,93,44,91,44,44,0,44,44,93,44,91,44,93,93,44,44,93,93,44,91,0,0,0,0,44,44,91,44,91,91,44,44,44,44,44,44,91,93,0,93,44,91,93,44,91,93,44,91,93,44,91,44,44,91,0,0,0,96,96,96,0,0,96,258,258,97,96,95,94,97,96,95,94,94,95,97,95,94,95,97,94,96,97,96,95,94,97,95,97,96,95,94,94,94,94,97,94,94,96,97,96,95,94,97,96,95,94,97,96,95,94,0,95,97,96,95,94,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,103,103,0,0,103,103,103,103,0,103,0,103,103,103,103,110,110,0,100,0,100,110,110,110,100,0,100,0,100,0,110,110,100,0,0,100,0,110,100,105,110,106,104,107,108,109,100,105,110,106,104,107,108,109,104,100,105,106,104,107,105,106,104,107,105,100,105,106,104,107,100,105,106,104,107,108,109,106,100,100,100,100,100,100,100,100,105,110,106,104,107,108,109,106,100,105,110,106,104,107,108,109,105,105,106,104,107,108,109,105,106,104,107,104,108,109,100,105,110,106,104,107,108,109,100,105,110,106,104,107,108,109,100,105,110,106,104,107,108,109,107,100,105,110,106,104,107,108,109,0,0,0,0,0,0,0,0,0,118,0,113,0,118,0,259,0,0,0,0,0,0,0,0,118,0,113,0,259,113,0,118,113,114,115,116,259,117,118,113,114,115,116,259,117,114,116,117,113,114,115,116,117,116,118,118,118,118,113,114,115,116,259,117,0,118,113,114,115,116,259,117,0,0,114,116,114,115,116,117,118,113,114,115,116,259,117,118,113,114,115,116,259,117,118,113,114,115,116,259,117,118,113,114,115,116,259,117,0,0,0,0,0,0,0,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,0,25,25,25,25,25,25,25,25,84,84,84,84,84,25,84,25,25,25,25,25,84,25,25,25,25,25,84,84,84,25,84,25,84,84,84,84,25,25,84,84,84,84,84,25,25,84,84,84,84,25,84,25,84,25,84,25,121,121,121,121,0,121,121,0,0,121,121,121,121,121,121,0,121,0,0,121,121,121,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,131,131,260,131,260,131,260,131,260,260,131,260,131,260,131,260,131,260,131,260,131,132,0,0,132,0,0,0,0,0,112,0,112,0,0,112,0,0,0,0,112,0,0,0,112,132,112,132,112,112,0,0,0,0,51,0,112,112,132,112,112,112,0,0,0,0,51,132,112,0,112,0,0,0,51,0,0,0,112,0,112,112,132,112,112,132,112,132,112,112,159,132,112,0,0,0,0,0,0,0,53,53,53,135,53,135,135,135,53,0,53,53,135,135,53,135,53,53,135,0,0,53,135,53,0,0,135,135,53,135,53,135,53,135,53,135,53,53,135,0,136,136,136,0,0,0,136,136,0,0,0,0,0,136,136,136,0,136,136,136,0,0,0,0,141,140,138,139,141,140,138,139,138,139,141,139,140,141,141,140,138,139,141,140,138,139,140,139,0,139,141,140,138,139,141,140,138,139,141,140,138,139,140,139,141,140,138,139,0,0,0,0,0,0,0,0,0,0,0,54,54,54,145,54,145,54,0,54,145,54,145,54,145,54,145,54,145,54,54,145,0,0,54,145,54,145,54,145,54,145,54,54,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,111,0,0,0,0,111,111,148,150,68,149,151,147,148,149,151,147,148,147,148,148,149,151,147,0,147,148,149,149,149,151,147,148,148,0,149,149,151,147,148,0,0,151,147,68,102,0,149,151,68,102,150,149,151,147,147,102,0,149,68,102,149,151,147,0,149,151,148,149,149,151,147,148,149,151,147,148,149,151,147,148,0,0,149,68,102,150,149,151,147,148,151,0,0,0,0,111,0,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,0,0,0,111,111,111,111,111,111,111,111,111,111,111,0,0,0,0,0,150,68,68,102,261,150,152,68,102,261,150,152,68,68,0,152,68,102,261,150,152,68,68,68,68,68,150,68,102,261,150,152,68,102,68,102,68,102,261,150,152,68,102,68,102,150,261,261,102,68,68,102,261,0,68,102,261,68,102,261,150,152,68,102,261,150,152,68,102,261,150,152,68,102,150,68,102,261,150,152,68,102,261,0,153,153,0,153,153,153,153,153,153,153,153,153,153,0,0,0,0,0,55,55,55,55,55,0,55,55,55,55,55,55,55,0,0,55,55,55,55,55,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,146,159,157,158,156,146,159,157,158,156,156,156,157,158,156,158,157,146,0,0,159,157,158,156,146,146,159,157,158,156,146,159,157,158,156,157,0,0,0,156,146,156,156,146,159,157,158,156,146,159,157,158,156,146,159,157,158,156,159,158,157,146,159,157,158,156,0,0,0,0,160,160,160,160,160,0,160,160,160,160,160,0,160,160,0,0,160,160,160,160,160,160,0,0,0,0,0,0,0,0,0,0,162,164,161,162,163,164,161,162,163,161,162,163,164,164,164,161,162,163,164,161,162,163,162,163,162,164,161,162,163,164,161,162,163,164,161,162,163,164,161,162,163,0,0,0,0,0,0,0,0,0,0,0,166,120,166,120,120,166,120,166,166,166,166,120,120,120,120,0,120,120,120,120,166,166,120,166,120,166,120,166,120,0,0,167,168,167,168,167,168,167,168,167,167,167,167,168,168,168,168,167,168,167,168,167,168,168,168,167,168,168,167,167,168,167,168,168,167,168,167,168,167,168,168,165,134,165,165,134,134,134,0,0,134,165,134,165,134,134,134,165,165,134,165,134,165,0,134,165,0,0,0,0,134,165,0,134,165,134,165,134,165,0,134,165,0,169,169,0,169,169,169,169,169,169,169,0,0,0,0,171,171,0,171,171,171,171,0,171,171,171,171,171],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,1,[[3,[2]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[4,4],[[-1,-2],5,[],[]],[4,6],[7,4],[[7,8],9],[[7,8],9],[[10,8],9],[[4,8],9],[11,7],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[-1,11],7,[[14,[[13,[12]]]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[7,11],0,[[15,7],5],0,[7,[[16,[12]]]],0,[-1,-2,[],[]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[-1,-2],[[20,[-3]]],[],21,[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[11,4],[[11,8],9],[[11,8],9],[-1,-1,[]],[-1,-2,[],[]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],17],[7,[[16,[17]]]],[[15,7],5],[[15,17,17],[[18,[22,[13,[12]]]]]],0,0,0,0,0,0,0,0,0,[[23,24,25],5],[23,5],[[23,25,4],5],[[23,25,7],5],[[23,25],5],[[23,25,26],5],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[27]]],28],[-1,[[18,[29]]],28],[-1,[[18,[24]]],28],[[29,29],30],[[24,24],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],0,0,0,[[29,8],9],[[24,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[],29],[[],23],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[24,25],27],0,0,0,0,[[23,[16,[31]]],5],[[27,-1],18,32],[[29,-1],18,32],[[24,-1],18,32],0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[[],33],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,[[],[[20,[34]]]],[[],[[20,[35]]]],[[36,-1],[[38,[[37,[-2]]]]],39,[]],[40,[[38,[-1]]],41],[36,[[38,[[0,[42]]]]]],[-1,[[38,[[16,[17]]]]],[[3,[36]]]],[-1,[[20,[5]]],[[3,[36]]]],[-1,[[20,[5]]],[[3,[36]]]],[[-1,-2],[[38,[5]]],[[3,[36]]],[[3,[36]]]],[36,[[38,[5]]]],[[-1,-2],[[38,[5]]],[[3,[36]]],[[3,[36]]]],[[-1,-2],[[38,[5]]],[[3,[36]]],[[3,[36]]]],[36,[[38,[43]]]],0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[16,[44]]],[[20,[45]]]],0,0,[[31,31],30],[[46,46],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[45,[[16,[47]]]],0,[[31,8],9],[[46,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[36,[[20,[[16,[45]]]]]],[-1,[[20,[45]]],48],[15,[[20,[46]]]],[[49,[16,[44]]],[[20,[45]]]],0,0,[[],49],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[[45,45],45],[[[50,[-1]],[50,[-1]]],[[50,[-1]]],51],[[52,52],52],[[47,47],47],0,[45,[[16,[[50,[53]]]]]],0,[45,[[16,[[50,[54]]]]]],0,0,[45,[[16,[[50,[55]]]]]],0,0,0,0,0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[56,[[20,[47]]]],[-1,[[18,[-2]]],[],[]],[57,[[20,[31]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[45,[[16,[52]]]],0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[58]]],28],[-1,[[18,[59]]],28],[-1,[[18,[57]]],28],[-1,[[18,[60]]],28],[-1,[[18,[56]]],28],[-1,[[18,[[61,[-2]]]]],28,51],[-1,[[18,[62]]],28],0,0,0,0,[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[58,36],[[20,[63]]]],[[58,-1,-2,-3],[[20,[-4]]],21,21,21,[]],[[60,36],[[20,[45]]]],[[59,36],[[20,[64]]]],[[58,36],[[20,[65]]]],[[[61,[-1]],36],[[20,[[50,[-1]]]]],51],[[62,36],[[20,[52]]]],0,0,0,0,0,0,0,0,0,[[58,-1],18,32],[[59,-1],18,32],[[57,-1],18,32],[[60,-1],18,32],[[56,-1],18,32],[[[61,[-1]],-2],18,51,32],[[62,-1],18,32],0,0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[15,[[16,[15]]]],[[63,63],30],[[65,65],30],[[64,64],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[15,36,[16,[17]]],[[20,[17]]]],[[63,8],9],[[65,8],9],[[64,8],9],0,[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[[63,66,15],[[20,[17]]]],[[65,15],[[20,[17]]]],[[64,15],[[20,[17]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,[66,[[20,[30]]]],[[],[[20,[[67,[66]]]]]],[66,[[20,[30]]]],[[],[[20,[[67,[66]]]]]],[[],[[20,[[67,[68]]]]]],[66,[[20,[30]]]],[[],[[20,[[67,[66]]]]]],[36,[[20,[[67,[66]]]]]],[66,[[20,[30]]]],[[],[[20,[[67,[66]]]]]],0,0,[[],[[20,[22]]]],[[],[[20,[[37,[22]]]]]],0,[[],[[20,[69]]]],[[],[[20,[70]]]],[[],[[20,[22]]]],[[],[[20,[[37,[22]]]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[71,71],[[-1,-2],5,[],[]],0,[[72,73],30],[72,5],[[71,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[74,71],[[18,[5,75]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[[],76],[[72,77],5],[[72,-1],5,78],[[72,-1],5,78],[[74,71],72],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[15,-1],17,78],[[15,[79,[27]]],5],[[15,[16,[22]]],[[16,[80]]]],[17,[[16,[22]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[81,82],[81,82],[81,82],[[[83,[-1]]],[[83,[-1]]],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],11],[[82,84],[[20,[85]]]],[[[83,[-1]]],[[83,[-1]]],86],[87,87],[[[88,[-1]]],[[88,[-1]]],86],[81,81],[89,89],[82,82],[[-1,-2],5,[],[]],[[-1,-2],5,[],[]],[[-1,-2],5,[],[]],[[-1,-2],5,[],[]],[[-1,-2],5,[],[]],[[-1,-2],5,[],[]],[[[83,[-1]]],[[83,[-1]]],86],[[81,81],90],[[-1,-2],90,[],[]],[84,[[20,[[16,[82]]]]]],[[],[[88,[-1]]],[]],[[81,81],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[87,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],0,[[[88,[-1]],[16,[-1]]],[[16,[-1]]],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[88,[-1]],-2],[[88,[-3]]],[],21,[]],[[89,82],82],0,0,0,0,0,0,0,0,[[81,81],[[16,[90]]]],0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[91,[[20,[81]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[83,[-1]]],[]],[-1,[[83,[-1]]],[]],[-1,[[83,[-1]]],[]],[-1,[[83,[-1]]],[]],0,0,0,0,0,[85,[[20,[[37,[22]]]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-2,[],[]],0,0,[85,[[20,[92]]]],0,[85,[[20,[[83,[66]]]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-2,[],[]],[[],[[20,[92]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[[44,-1],[[16,[22]]],[[3,[36]]]],[22,[[16,[22]]]],[[],[[20,[[16,[44]]]]]],[22,[[20,[[16,[44]]]]]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[22,[[20,[44]]]],[93,[[20,[[16,[44]]]]]],[93,[[20,[[16,[44]]]]]],[[44,2],[[20,[30]]]],[[44,15],30],[[],93],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[36,30],[36,30],[36,30],[36,30],[44,36],0,[[91,91],91],[44,30],0,0,[[44,66],[[20,[5]]]],[[44,[16,[66]]],[[20,[5]]]],[[44,[16,[66]]],[[20,[5]]]],[[44,[16,[66]]],[[20,[5]]]],[44,[[16,[81]]]],0,0,0,0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[44,[[0,[42]]]],0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],94],0,0,[-1,[[18,[95]]],28],[-1,[[18,[94]]],28],0,0,0,[[96,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[36,[[20,[97]]]],[36,[[20,[95]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[94,[[20,[[5,[91,[16,[22]]]]]]]],0,0,[[94,-1],18,32],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[[36,96,[16,[66]]],[[20,[5]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,[85,5],[[],5],[84,[[20,[98]]]],[[2,[79,[92]],[99,[-1,-2,-3]],89,84],[[20,[98]]],[[3,[2]]],[[3,[2]]],[]],0,[[[83,[66]]],17],[[2,[79,[92]],84],[[20,[100]]]],[101,[[20,[92]]]],0,0,0,0,0,[2,92],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[[2,[79,[92]],84],[[20,[100]]]],[[17,[16,[82]],84],[[20,[[5,[92,11]]]]]],[-1,-1,[]],[[102,84],[[20,[103]]]],[[2,84],[[20,[[16,[103]]]]]],[-1,-2,[],[]],[[17,[16,[82]],84],[[20,[[5,[92,11]]]]]],0,[[],[[20,[92]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[104,84],[[20,[5]]]],[[100,89],5],[[105,89],5],[[106,89],5],[[104,89],5],[[107,89],5],0,0,0,0,[[105,-1,-2],5,[[3,[2]]],[[3,[2]]]],[[100,[99,[-1,-2,-3]]],5,[[3,[2]]],[[3,[2]]],[]],[[105,-1],5,48],[[106,-1],5,48],[[104,-1],5,48],[[107,-1],5,48],[[100,84],[[20,[98]]]],[[105,84],[[20,[98]]]],[[106,84],[[20,[98]]]],[[104,84],[[20,[98]]]],[[107,84],[[20,[98]]]],[[108,84],[[20,[98]]]],[109,[[20,[98]]]],[[-1,82,17],[[20,[106]]],48],[106,100],[104,100],[-1,-1,[]],[105,100],[107,100],[109,100],[108,100],[[[37,[100]]],100],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[[-1,-2,[16,[82]],110],105,[[3,[2]]],48],[[-1,82,111],[[20,[106]]],48],[[-1,82,17],104,48],[[-1,17,82,111],[[20,[107]]],48],[112,108],[112,109],0,0,0,0,0,0,0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[79,[92]],84],[[20,[100]]]],[[[16,[82]],84],[[20,[[5,[92,11]]]]]],[[[79,[92]],84],[[20,[100]]]],[84,[[16,[17]]]],[[[16,[82]],84],[[20,[[5,[92,11]]]]]],0,[[[79,[92]],84],[[20,[100]]]],[[[16,[82]],84],[[20,[[5,[92,11]]]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,[[113,81],[[20,[100]]]],[[114,81],[[20,[100]]]],[115,[[20,[100]]]],[[116,81],[[20,[100]]]],[[117,82,[16,[17]]],[[20,[100]]]],[[116,81],[[20,[100]]]],[[[79,[-1]]],118,[[3,[2]]]],[[[79,[-1]]],118,[[3,[2]]]],[[[79,[-1]]],118,[[3,[2]]]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[[79,[-1]]],30,[[3,[2]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,30,[[3,[2]]]],[-1,30,[[3,[2]]]],0,0,0,0,0,0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[79,[92]],84],[[20,[100]]]],[[[16,[82]],84],[[20,[[5,[92,11]]]]]],[82,[[20,[5]]]],[[[79,[92]],84],[[20,[100]]]],[[[16,[82]],84],[[20,[[5,[92,11]]]]]],[82,[[20,[5]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[84,25,4],5],[[84,25,7],5],[[84,25],5],[[84,25,26],5],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[25,25],[[-1,-2],5,[],[]],[[25,25],90],[[-1,-2],90,[],[]],[84,[[20,[[16,[81]]]]]],[[25,25],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],0,[[84,4],6],[[84,26],6],[[25,8],[[18,[5,119]]]],[-1,-1,[]],[-1,-1,[]],[84,[[20,[45]]]],0,[[],84],[-1,-2,[],[]],[-1,-2,[],[]],[[25,25],[[16,[90]]]],[84,[[20,[[16,[44]]]]]],0,[84,[[20,[[16,[44]]]]]],[84,[[20,[[16,[81]]]]]],[84,5],[-1,-2,[],[]],[-1,17,[]],[84,[[20,[120]]]],0,[84,[[20,[120]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[15,[[20,[121]]]],[15,[[20,[121]]]],[[121,121],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[-1,-1,[]],[36,[[20,[[122,[17]]]]]],[-1,-2,[],[]],0,[36,[[20,[5]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],[15,[[20,[121]]]],[[[5,[123,124]]],[[16,[17]]]],0,0,[[],5],[[],5],0,0,[125,15],[12,17],[[],[[126,[15]]]],[[125,15,33],127],[-1,127,[[14,[[128,[15]]]]]],[[],[[126,[15]]]],[[],[[16,[129]]]],[[-1,-2],17,[78,130],[78,130]],0,0,0,0,0,[[],[[20,[131]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[131,5],0,[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[[79,[-1]],15],[[20,[5]]],[[3,[15]]]],[-1,[[20,[132]]],133],[15,5],[-1,5,78],[[112,-1],[[0,[21]]],[[3,[15]]]],[[[13,[-1]],84],[[20,[5]]],[]],[15,[[16,[22]]]],[[112,8],9],[[112,8],9],[-1,-1,[]],[-1,-1,[]],[[15,134],112],[[[79,[-1]],15],[[20,[[37,[112]]]]],[[3,[15]]]],[-1,5,78],[-1,5,78],[-1,5,78],[[-1,-2],5,78,78],[[[13,[-1]],84],[[20,[5]]],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[112,15],0,0,0,[[[13,[-1]],84],[[20,[5]]],[]],0,0,[[-1,-2],[[0,[21]]],[[3,[15]]],[[3,[15]]]],[[112,84],[[20,[[13,[51]]]]]],0,[[112,112],90],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[15,[[20,[112]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[112,[[20,[5]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,[66,17],[66,17],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[135,135],[[-1,-2],5,[],[]],[[53,84],[[20,[135]]]],0,[[[13,[53]],84],[[20,[5]]]],[[53,8],9],[[135,8],9],[[135,8],9],[-1,-1,[]],[-1,-1,[]],[[[13,[53]],84],[[20,[5]]]],[-1,-2,[],[]],[-1,-2,[],[]],[66,[[20,[66]]]],0,[66,53],0,[[[13,[53]],84],[[20,[5]]]],0,[[134,84],[[20,[66]]]],0,[-1,-2,[],[]],[-1,17,[]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[136]]],28],[[66,[16,[[50,[53]]]]],[[20,[17]]]],[[66,[16,[[50,[53]]]]],[[20,[135]]]],[[66,15,36],[[20,[[13,[137]]]]]],[-1,-1,[]],[-1,-2,[],[]],[36,[[16,[[13,[137]]]]]],[66,[[20,[66]]]],[66,22],[[],17],[[66,66],[[20,[5]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[[[13,[137]],66],[[20,[135]]]],[36,[[20,[66]]]],0,[-1,-2,[],[]],0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[138]]],28],[-1,[[18,[139]]],28],0,0,[[140,8],9],[-1,-1,[]],[138,141],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[-1,[[18,[30]]],28],0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[15,-1],[[20,[[16,[66]]]]],133],[142,143],[[],17],[15,[[20,[[16,[138]]]]]],[[134,84],[[20,[66]]]],[[[16,[[50,[53]]]]],[[20,[66]]]],[[[16,[[50,[53]]]]],[[20,[66]]]],[15,[[20,[138]]]],[[144,[16,[[50,[53]]]]],[[20,[66]]]],0,0,[15,17],[15,17],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[54,84],[[20,[5]]]],0,[[[13,[54]],84],[[20,[5]]]],[[[13,[145]],84],[[20,[5]]]],[[54,8],9],[[145,8],9],[-1,-1,[]],[-1,-1,[]],[[[13,[54]],84],[[20,[5]]]],[[[13,[145]],84],[[20,[5]]]],[-1,-2,[],[]],[-1,-2,[],[]],[66,54],[[[13,[54]],84],[[20,[5]]]],[[[13,[145]],84],[[20,[5]]]],0,[[134,84],[[20,[[16,[66]]]]]],[-1,17,[]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[[66,[16,[[50,[54]]]]],[[20,[17]]]],[[66,[16,[[50,[54]]]]],[[20,[5]]]],[[66,15,36],[[20,[[13,[137]]]]]],[36,[[16,[[13,[137]]]]]],[[36,15],[[20,[5]]]],[[[13,[137]],66],[[20,[5]]]],[[[16,[[50,[54]]]]],[[20,[[5,[17,146]]]]]],[[134,84],[[20,[[16,[66]]]]]],[[144,[16,[[50,[54]]]]],[[20,[66]]]],[[15,[16,[[50,[54]]]]],[[20,[66]]]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[147,[[20,[5]]]],[148,148],[[-1,-2],5,[],[]],[[149,85],[[20,[150]]]],[[151,85],[[20,[5]]]],[[147,85],[[20,[5]]]],0,0,[[148,148],30],[[[13,[149]],84],[[20,[5]]]],[[149,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[30,148],[-1,-1,[]],0,[[[13,[149]],84],[[20,[5]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[15,111],[[20,[5]]]],0,0,0,0,0,0,0,0,0,0,0,[[17,134],[[20,[149]]]],[111,[[20,[151]]]],[[17,111],[[20,[147]]]],0,0,[[15,-1,36],[[20,[5]]],78],[[[13,[149]],84],[[20,[5]]]],0,0,[[149,85],[[20,[5]]]],[[151,1],5],[[147,1],5],[[111,148],[[20,[34]]]],0,0,[-1,-2,[],[]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,[15,[[20,[5]]]],0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[111,17],[[20,[151]]]],[[15,22,111],[[20,[150]]]],[[15,150],[[20,[5]]]],[[15,150,85,111],[[20,[5]]]],[[17,22,85],[[20,[5]]]],0,0,0,0,[[111,22],22],[-1,-2,[],[]],[-1,-2,[],[]],[111,111],[[-1,-2],5,[],[]],[[111,111],90],[[-1,-2],90,[],[]],[-1,[[18,[111]]],28],[[111,111],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[111,8],9],[-1,-1,[]],[[111,22],[[16,[17]]]],[22,[[16,[17]]]],[22,[[16,[17]]]],[36,[[16,[17]]]],[-1,-2,[],[]],[[111,111],[[16,[90]]]],[[111,-1],18,32],[[111,1,22],5],[[111,22],22],[[111,22],22],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[68,68],90],[[-1,-2],90,[],[]],[15,17],0,[-1,[[18,[68]]],28],[-1,[[18,[102]]],28],[-1,[[18,[81]]],28],[-1,[[18,[150]]],28],[-1,[[18,[152]]],28],[[68,68],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[15,36],[[20,[150]]]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,[[20,[68]]],[[3,[36]]]],[-1,[[20,[102]]],[[3,[36]]]],[-1,[[20,[[16,[68]]]]],[[3,[36]]]],[-1,[[20,[[16,[102]]]]],[[3,[36]]]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,[[68,68],[[16,[90]]]],0,0,0,0,[[68,-1],18,32],[[102,-1],18,32],[[81,-1],18,32],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[68,[[20,[5]]]],[102,[[20,[5]]]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[[37,[17]]]]],28],[[153,8],9],[[-1,8],[[18,[5,119]]],[]],[-1,-1,[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[[153,-1],18,154],[[153,15],[[18,[-1]]],155],[-1,-2,[],[]],[15,[[20,[[37,[17]]]]]],[[15,15],[[20,[5]]]],[15,[[20,[5]]]],[15,[[20,[5]]]],0,[15,17],[15,17],[-1,-2,[],[]],[-1,-2,[],[]],[[55,84],[[20,[5]]]],0,[[[13,[55]],84],[[20,[5]]]],[[55,8],9],[-1,-1,[]],[[[13,[55]],84],[[20,[5]]]],[-1,-2,[],[]],[66,55],[[[13,[55]],84],[[20,[5]]]],0,[[134,84],[[20,[66]]]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,[-1,-2,[],[]],[[66,[16,[[50,[55]]]]],[[20,[17]]]],[[66,[16,[[50,[55]]]]],[[20,[5]]]],[[66,15,36],[[20,[[13,[137]]]]]],[36,[[16,[[13,[137]]]]]],[[[13,[137]],66],[[20,[5]]]],[[36,15],[[20,[5]]]],[[[16,[[50,[55]]]]],[[20,[[5,[17,146]]]]]],[[134,84],[[20,[66]]]],[[144,[16,[[50,[55]]]]],[[20,[66]]]],[[15,[16,[[50,[55]]]]],[[20,[66]]]],0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[156,156],[[-1,-2],5,[],[]],[-1,[[18,[157]]],28],[-1,[[18,[158]]],28],[-1,[[18,[156]]],28],0,0,0,[[17,15],[[20,[[5,[17,146]]]]]],[36,[[20,[22]]]],[[159,8],9],[[157,8],9],[[158,8],9],[[156,8],9],[157,146],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[15,17],[[15,15],17],[[15,15,15],17],0,0,0,[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[15,30],0,[15,17],[15,17],[-1,-2,[],[]],[-1,-2,[],[]],[[160,84],[[20,[5]]]],0,[[[13,[160]],84],[[20,[5]]]],[[160,8],9],[-1,-1,[]],[[[13,[160]],84],[[20,[5]]]],[-1,-2,[],[]],0,[66,160],[[[13,[160]],84],[[20,[5]]]],0,[[134,84],[[20,[66]]]],[-1,17,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,[-1,-2,[],[]],[[66,[16,[52]]],[[20,[17]]]],[[36,15],[[20,[5]]]],[[66,[16,[52]]],[[20,[5]]]],[[66,15,36],[[20,[[13,[137]]]]]],[36,[[16,[[13,[137]]]]]],[[[13,[137]],66],[[20,[5]]]],0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[161]]],28],[-1,[[18,[162]]],28],[-1,[[18,[163]]],28],0,[161,164],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[162,30],0,0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[15,[[20,[[5,[17,146]]]]]],[[134,84],[[20,[66]]]],[17,[[20,[66]]]],[17,[[20,[66]]]],[[144,[16,[52]]],[[20,[66]]]],[144,[[20,[66]]]],[[144,17],[[20,[66]]]],[[144,17],[[20,[66]]]],[[165,[16,[52]]],[[20,[66]]]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],[[20,[120]]]],[-1,-1,[]],[-1,-1,[]],[166,[[20,[120]]]],[166,[[20,[120]]]],[[],166],[-1,-2,[],[]],[-1,-2,[],[]],[120,[[16,[81]]]],0,[120,[[20,[5]]]],0,[[120,66],[[20,[5]]]],[[120,[16,[66]]],[[20,[5]]]],[[120,[16,[66]]],[[20,[5]]]],[[120,[16,[66]]],[[20,[5]]]],0,[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[167]]],28],[-1,[[18,[168]]],28],[[167,167],30],[[168,168],30],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[-1,-2],30,[],[]],[[167,8],9],[[168,8],9],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[168,[[20,[17]]]],0,0,[81,168],0,0,[[167,-1],18,32],[[168,-1],18,32],[-1,[[18,[-2]]],[],[]],[17,[[20,[168]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[[],134],[[134,8],9],[[134,8],9],[[165,8],9],[[165,8],9],[-1,-1,[]],[-1,-1,[]],[15,[[20,[134]]]],[15,[[20,[165]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],0,[-1,[[20,[144]]],[[3,[15]]]],[-1,[[20,[66]]],[[3,[15]]]],0,[-1,17,[]],[-1,17,[]],[15,15],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[[99,[17,66]]]]],28],[-1,[[18,[169]]],28],[-1,-1,[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,-2,[],[]],[-1,[[18,[[16,[66]]]]],28],[[[16,[66]],-1],18,32],[15,[[18,[144,170]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[66]]],28],[[171,8],9],[[-1,8],[[18,[5,119]]],[]],[-1,-1,[]],[-1,-2,[],[]],[[66,-1],18,32],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[[171,15],[[18,[-1]]],155],[-1,-2,[],[]]],"c":[],"p":[[3,"Command",2500],[3,"OsStr",2501],[8,"AsRef",2502],[4,"ExitCode",22],[15,"tuple"],[15,"never"],[3,"VoltaError",22],[3,"Formatter",2503],[6,"Result",2503],[3,"Inner",22],[4,"ErrorKind",294],[8,"Error",2504],[3,"Box",2505],[8,"Into",2502],[15,"str"],[4,"Option",2506],[3,"String",2507],[4,"Result",2508],[3,"TypeId",2509],[6,"Fallible",22],[8,"FnOnce",2510],[3,"PathBuf",2511],[3,"EventLog",521],[4,"EventKind",521],[4,"ActivityKind",1548],[15,"i32"],[3,"Event",521],[8,"Deserializer",2512],[3,"ErrorEnv",521],[15,"bool"],[4,"Publish",619],[8,"Serializer",2513],[15,"u64"],[3,"TempDir",2514],[3,"NamedTempFile",2515],[3,"Path",2511],[3,"Vec",2516],[6,"Result",2517],[8,"FnMut",2510],[3,"Error",2517],[8,"Default",2518],[8,"Iterator",2519],[3,"File",2520],[3,"Project",1141],[3,"HookConfig",619],[4,"RegistryFormat",619],[3,"EventHooks",619],[8,"IntoIterator",2521],[3,"LazyHookConfig",619],[3,"ToolHooks",619],[8,"Tool",1685],[3,"YarnHooks",619],[3,"Node",1758],[3,"Npm",1881],[3,"Pnpm",2168],[3,"RawEventHooks",732],[3,"RawPublishHook",732],[3,"RawResolveHook",732],[3,"RawIndexHook",732],[3,"RawHookConfig",732],[3,"RawToolHooks",732],[3,"RawYarnHooks",732],[4,"DistroHook",838],[3,"YarnIndexHook",838],[4,"MetadataHook",838],[3,"Version",2522],[3,"BTreeSet",2523],[3,"PackageConfig",2062],[3,"VoltaHome",2524],[3,"VoltaInstall",2525],[4,"LogVerbosity",926],[3,"Logger",926],[3,"Metadata",2526],[4,"LogContext",926],[3,"SetLoggerError",2526],[4,"LevelFilter",2526],[3,"Record",2526],[8,"Display",2503],[15,"slice"],[3,"Child",2500],[3,"PlatformSpec",987],[3,"Platform",987],[3,"Sourced",987],[3,"Session",1548],[3,"Image",1115],[8,"Clone",2527],[4,"Source",987],[4,"InheritOption",987],[3,"CliPlatform",987],[4,"Ordering",2528],[3,"PartialPlatform",1141],[3,"OsString",2501],[3,"LazyProject",1141],[3,"ToolchainSpec",1201],[3,"RawManifest",1201],[4,"ManifestKey",1201],[3,"Manifest",1201],[3,"ExitStatus",2500],[3,"HashMap",2529],[4,"Executor",1300],[3,"ArgsOs",2530],[3,"BinConfig",2062],[3,"DefaultBinary",1283],[3,"PackageLinkCommand",1300],[3,"ToolCommand",1300],[3,"PackageInstallCommand",1300],[3,"PackageUpgradeCommand",1300],[3,"InternalInstallCommand",1300],[3,"UninstallCommand",1300],[4,"ToolKind",1300],[4,"PackageManager",2028],[4,"Spec",1685],[4,"GlobalCommand",1442],[3,"InstallArgs",1442],[3,"UninstallArgs",1442],[3,"UpgradeArgs",1442],[3,"LinkArgs",1442],[4,"CommandArg",1442],[3,"Error",2503],[3,"Toolchain",2358],[4,"ShimResult",1621],[3,"HashSet",2531],[3,"DirEntry",2520],[3,"Metadata",2520],[4,"Origin",2532],[3,"StyledObject",2533],[3,"ProgressBar",2534],[4,"Cow",2535],[15,"usize"],[8,"Sized",2536],[3,"VoltaLock",1660],[4,"FetchStatus",1685],[8,"Fn",2510],[4,"VersionSpec",2431],[3,"NodeVersion",1758],[3,"Manifest",1803],[8,"Archive",2532],[3,"RawNodeIndex",1824],[3,"RawNodeEntry",1824],[3,"NodeEntry",1824],[3,"NodeIndex",1824],[3,"HeaderMap",2537],[3,"Duration",2538],[3,"Range",2539],[3,"BundledNpm",1881],[3,"PackageIndex",2200],[3,"InPlaceUpgrade",1927],[4,"NeedsScope",1927],[3,"Package",1927],[3,"PackageManifest",2062],[3,"DirectInstall",1927],[3,"GlobalYarnManifest",2062],[3,"BinMapVisitor",2150],[8,"MapAccess",2512],[8,"Error",2512],[3,"RawDistInfo",2200],[3,"RawPackageMetadata",2200],[3,"RawPackageVersionInfo",2200],[3,"PackageDetails",2200],[3,"Yarn",2275],[3,"RawYarnIndex",2304],[3,"RawYarnEntry",2304],[3,"RawYarnAsset",2304],[3,"YarnIndex",2304],[4,"VersionTag",2431],[3,"LazyToolchain",2358],[3,"NodeVersion",2389],[3,"Platform",2389],[3,"Wrapper",2472],[3,"SemverError",2522],[3,"VersionVisitor",2486],[8,"Context",22],[13,"InvalidInvocation",423],[13,"InvalidInvocationOfBareVersion",423],[13,"DeprecatedCommandError",423],[13,"NoShellProfile",423],[13,"BinaryAlreadyInstalled",423],[13,"BypassError",423],[13,"ExecuteHookError",423],[13,"HookCommandFailed",423],[13,"HookPathError",423],[13,"InvalidHookCommand",423],[13,"InvalidHookOutput",423],[13,"NoBundledNpm",423],[13,"ProjectLocalBinaryExecError",423],[13,"ProjectLocalBinaryNotFound",423],[13,"CreateDirError",423],[13,"ReadBinConfigDirError",423],[13,"ReadDirError",423],[13,"SetupToolImageError",423],[13,"DeleteDirectoryError",423],[13,"ExtensionCycleError",423],[13,"InvalidToolName",423],[13,"Unimplemented",423],[13,"CreateLayoutFileError",423],[13,"DeleteFileError",423],[13,"PackageParseError",423],[13,"PackageReadError",423],[13,"PackageWriteError",423],[13,"ParseHooksError",423],[13,"ReadBinConfigError",423],[13,"ReadDefaultNpmError",423],[13,"ReadHooksError",423],[13,"ReadNodeIndexCacheError",423],[13,"ReadNodeIndexExpiryError",423],[13,"ReadPackageConfigError",423],[13,"ReadPlatformError",423],[13,"WriteBinConfigError",423],[13,"WriteDefaultNpmError",423],[13,"WriteNodeIndexCacheError",423],[13,"WriteNodeIndexExpiryError",423],[13,"WritePackageConfigError",423],[13,"WritePlatformError",423],[13,"InvalidRegistryFormat",423],[13,"DownloadToolNetworkError",423],[13,"ParseNodeIndexError",423],[13,"RegistryFetchError",423],[13,"YarnLatestFetchError",423],[13,"CreateTempDirError",423],[13,"CreateTempFileError",423],[13,"UpgradePackageNotFound",423],[13,"UpgradePackageWrongManager",423],[13,"NodeVersionNotFound",423],[13,"NpmVersionNotFound",423],[13,"PnpmVersionNotFound",423],[13,"YarnVersionNotFound",423],[13,"BinaryNotFound",423],[13,"CreateSharedLinkError",423],[13,"ShimCreateError",423],[13,"ShimRemoveError",423],[13,"CannotFetchPackage",423],[13,"CannotPinPackage",423],[13,"NpmLinkMissingPackage",423],[13,"NpmLinkWrongManager",423],[13,"PackageInstallFailed",423],[13,"PackageManifestParseError",423],[13,"PackageManifestReadError",423],[13,"PackageNotFound",423],[13,"CompletionsOutFileError",423],[13,"ContainingDirError",423],[13,"ExtensionPathError",423],[13,"NoDefaultNodeVersion",423],[13,"NoPinnedNodeVersion",423],[13,"PersistInventoryError",423],[13,"SetToolExecutable",423],[13,"UnpackArchiveError",423],[13,"WriteLauncherError",423],[13,"ParseToolSpecError",423],[13,"NpxNotAvailable",423],[13,"VersionParseError",423],[13,"Args",600],[13,"Error",600],[13,"End",600],[13,"ToolEnd",600],[13,"Bin",903],[13,"Bin",905],[3,"System",1131],[6,"DependencyMapIterator",1201],[4,"InterceptedCommand",1442],[3,"LockState",1660],[3,"RawPlatformSpec",2062]],"b":[[165,"impl-Display-for-VoltaError"],[166,"impl-Debug-for-VoltaError"],[414,"impl-Debug-for-ErrorKind"],[415,"impl-Display-for-ErrorKind"],[1363,"impl-From%3CPackageInstallCommand%3E-for-Executor"],[1364,"impl-From%3CPackageLinkCommand%3E-for-Executor"],[1366,"impl-From%3CToolCommand%3E-for-Executor"],[1367,"impl-From%3CPackageUpgradeCommand%3E-for-Executor"],[1368,"impl-From%3CUninstallCommand%3E-for-Executor"],[1369,"impl-From%3CInternalInstallCommand%3E-for-Executor"],[1370,"impl-From%3CVec%3CExecutor%3E%3E-for-Executor"],[1720,"impl-Debug-for-Spec"],[1721,"impl-Display-for-Spec"],[1776,"impl-Debug-for-NodeVersion"],[1777,"impl-Display-for-NodeVersion"],[2445,"impl-Display-for-VersionSpec"],[2446,"impl-Debug-for-VersionSpec"],[2447,"impl-Display-for-VersionTag"],[2448,"impl-Debug-for-VersionTag"]]},\ +"volta_layout":{"doc":"","t":"FAAAAAAODDLLLLLMLLLMLMLLMLMLLMLLLMLLLMLMLLLMLLLMLMLMLMLLLLLMLMLLMMLMLMLLMLMLLLLLLLLLMLMDDLLLLLMLLLMLMLLMLMLLMLLLMLLLMLMLMLMLMLLLMLLLMLMLMLMLLLLLMLMLLMMLMLMLLMLMLLLLLLLLLMLMDCLLLMLLMLMLLMLMLLMLLMLLMLMLMLLMLLLMLMLMLMLLLLMLMLLLLMLMLMLMLLMLMLLLLLLMLMDCLLLMLLMLMLLMLMLLMLLMLLMLMLMLLMLLLMLMLMLMLLLLMLMLLMLLLMLMLMLLMLMLLMLMLLLLLLMLMDCLLLMLLMLMLLMLMLLMLLMLLMLMLMLLMLLLMLMLMLMLLLLMLMLLMLLLMLMLMLLMLMLLMLMLLLLLLMLM","n":["executable","macros","v0","v1","v2","v3","v4","path_buf","VoltaHome","VoltaInstall","borrow","borrow","borrow_mut","borrow_mut","cache_dir","cache_dir","create","create","default_bin_dir","default_bin_dir","default_hooks_file","default_hooks_file","default_package_config_file","default_package_dir","default_package_dir","default_platform_file","default_platform_file","default_tool_bin_config","default_toolchain_dir","default_toolchain_dir","from","from","image_dir","image_dir","into","into","inventory_dir","inventory_dir","log_dir","log_dir","new","new","node_cache_dir","node_cache_dir","node_image_bin_dir","node_image_dir","node_image_root_dir","node_image_root_dir","node_index_expiry_file","node_index_expiry_file","node_index_file","node_index_file","node_inventory_dir","node_inventory_dir","node_npm_version_file","package_distro_file","package_distro_shasum","package_image_dir","package_image_root_dir","package_image_root_dir","package_inventory_dir","package_inventory_dir","root","root","root","root","shim_dir","shim_dir","shim_executable","shim_executable","shim_file","tmp_dir","tmp_dir","tools_dir","tools_dir","try_from","try_from","try_into","try_into","type_id","type_id","yarn_image_bin_dir","yarn_image_dir","yarn_image_root_dir","yarn_image_root_dir","yarn_inventory_dir","yarn_inventory_dir","VoltaHome","VoltaInstall","borrow","borrow","borrow_mut","borrow_mut","cache_dir","cache_dir","create","create","default_bin_dir","default_bin_dir","default_hooks_file","default_hooks_file","default_package_config_file","default_package_dir","default_package_dir","default_platform_file","default_platform_file","default_tool_bin_config","default_toolchain_dir","default_toolchain_dir","from","from","image_dir","image_dir","into","into","inventory_dir","inventory_dir","layout_file","layout_file","log_dir","log_dir","main_executable","main_executable","migrate_executable","migrate_executable","new","new","node_cache_dir","node_cache_dir","node_image_bin_dir","node_image_dir","node_image_root_dir","node_image_root_dir","node_index_expiry_file","node_index_expiry_file","node_index_file","node_index_file","node_inventory_dir","node_inventory_dir","node_npm_version_file","package_distro_file","package_distro_shasum","package_image_dir","package_image_root_dir","package_image_root_dir","package_inventory_dir","package_inventory_dir","root","root","root","root","shim_dir","shim_dir","shim_executable","shim_executable","shim_file","tmp_dir","tmp_dir","tools_dir","tools_dir","try_from","try_from","try_into","try_into","type_id","type_id","yarn_image_bin_dir","yarn_image_dir","yarn_image_root_dir","yarn_image_root_dir","yarn_inventory_dir","yarn_inventory_dir","VoltaHome","VoltaInstall","borrow","borrow_mut","cache_dir","cache_dir","create","default_bin_dir","default_bin_dir","default_hooks_file","default_hooks_file","default_package_config_file","default_package_dir","default_package_dir","default_platform_file","default_platform_file","default_tool_bin_config","default_toolchain_dir","default_toolchain_dir","from","image_dir","image_dir","into","inventory_dir","inventory_dir","layout_file","layout_file","log_dir","log_dir","new","node_cache_dir","node_cache_dir","node_image_bin_dir","node_image_dir","node_image_root_dir","node_image_root_dir","node_index_expiry_file","node_index_expiry_file","node_index_file","node_index_file","node_inventory_dir","node_inventory_dir","node_npm_version_file","npm_image_bin_dir","npm_image_dir","npm_image_root_dir","npm_image_root_dir","npm_inventory_dir","npm_inventory_dir","package_distro_file","package_distro_shasum","package_image_dir","package_image_root_dir","package_image_root_dir","package_inventory_dir","package_inventory_dir","root","root","shim_dir","shim_dir","shim_file","tmp_dir","tmp_dir","tools_dir","tools_dir","try_from","try_into","type_id","yarn_image_bin_dir","yarn_image_dir","yarn_image_root_dir","yarn_image_root_dir","yarn_inventory_dir","yarn_inventory_dir","VoltaHome","VoltaInstall","borrow","borrow_mut","cache_dir","cache_dir","create","default_bin_dir","default_bin_dir","default_hooks_file","default_hooks_file","default_package_config_file","default_package_dir","default_package_dir","default_platform_file","default_platform_file","default_tool_bin_config","default_toolchain_dir","default_toolchain_dir","from","image_dir","image_dir","into","inventory_dir","inventory_dir","layout_file","layout_file","log_dir","log_dir","new","node_cache_dir","node_cache_dir","node_image_bin_dir","node_image_dir","node_image_root_dir","node_image_root_dir","node_index_expiry_file","node_index_expiry_file","node_index_file","node_index_file","node_inventory_dir","node_inventory_dir","node_npm_version_file","npm_image_bin_dir","npm_image_dir","npm_image_root_dir","npm_image_root_dir","npm_inventory_dir","npm_inventory_dir","package_image_dir","package_image_root_dir","package_image_root_dir","pnpm_image_bin_dir","pnpm_image_dir","pnpm_image_root_dir","pnpm_image_root_dir","pnpm_inventory_dir","pnpm_inventory_dir","root","root","shared_lib_dir","shared_lib_root","shared_lib_root","shim_dir","shim_dir","shim_file","tmp_dir","tmp_dir","tools_dir","tools_dir","try_from","try_into","type_id","yarn_image_bin_dir","yarn_image_dir","yarn_image_root_dir","yarn_image_root_dir","yarn_inventory_dir","yarn_inventory_dir","VoltaHome","VoltaInstall","borrow","borrow_mut","cache_dir","cache_dir","create","default_bin_dir","default_bin_dir","default_hooks_file","default_hooks_file","default_package_config_file","default_package_dir","default_package_dir","default_platform_file","default_platform_file","default_tool_bin_config","default_toolchain_dir","default_toolchain_dir","from","image_dir","image_dir","into","inventory_dir","inventory_dir","layout_file","layout_file","log_dir","log_dir","new","node_cache_dir","node_cache_dir","node_image_bin_dir","node_image_dir","node_image_root_dir","node_image_root_dir","node_index_expiry_file","node_index_expiry_file","node_index_file","node_index_file","node_inventory_dir","node_inventory_dir","node_npm_version_file","npm_image_bin_dir","npm_image_dir","npm_image_root_dir","npm_image_root_dir","npm_inventory_dir","npm_inventory_dir","package_image_dir","package_image_root_dir","package_image_root_dir","pnpm_image_bin_dir","pnpm_image_dir","pnpm_image_root_dir","pnpm_image_root_dir","pnpm_inventory_dir","pnpm_inventory_dir","root","root","shared_lib_dir","shared_lib_root","shared_lib_root","shim_dir","shim_dir","shim_file","tmp_dir","tmp_dir","tools_dir","tools_dir","try_from","try_into","type_id","yarn_image_bin_dir","yarn_image_dir","yarn_image_root_dir","yarn_image_root_dir","yarn_inventory_dir","yarn_inventory_dir"],"q":[[0,"volta_layout"],[7,"volta_layout::macros"],[8,"volta_layout::v0"],[87,"volta_layout::v1"],[172,"volta_layout::v2"],[246,"volta_layout::v3"],[325,"volta_layout::v4"],[404,"alloc::string"],[405,"std::path"],[406,"std::io::error"],[407,"std::path"],[408,"core::any"]],"d":["","","","","","","","","","","","","","","Returns the cache_dir path.","","Creates all subdirectories in this directory layout.","Creates all subdirectories in this directory layout.","Returns the default_bin_dir path.","","Returns the default_hooks_file path.","","","Returns the default_package_dir path.","","Returns the default_platform_file path.","","","Returns the default_toolchain_dir path.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the image_dir path.","","Calls U::from(self).","Calls U::from(self).","Returns the inventory_dir path.","","Returns the log_dir path.","","Constructs a new instance of the VoltaInstall layout, …","Constructs a new instance of the VoltaHome layout, rooted …","Returns the node_cache_dir path.","","","","Returns the node_image_root_dir path.","","Returns the node_index_expiry_file path.","","Returns the node_index_file path.","","Returns the node_inventory_dir path.","","","","","","Returns the package_image_root_dir path.","","Returns the package_inventory_dir path.","","Returns the root path for this directory layout.","Returns the root path for this directory layout.","","","Returns the shim_dir path.","","Returns the shim_executable path.","","","Returns the tmp_dir path.","","Returns the tools_dir path.","","","","","","","","","","Returns the yarn_image_root_dir path.","","Returns the yarn_inventory_dir path.","","","","","","","","Returns the cache_dir path.","","Creates all subdirectories in this directory layout.","Creates all subdirectories in this directory layout.","Returns the default_bin_dir path.","","Returns the default_hooks_file path.","","","Returns the default_package_dir path.","","Returns the default_platform_file path.","","","Returns the default_toolchain_dir path.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the image_dir path.","","Calls U::from(self).","Calls U::from(self).","Returns the inventory_dir path.","","Returns the layout_file path.","","Returns the log_dir path.","","Returns the main_executable path.","","Returns the migrate_executable path.","","Constructs a new instance of the VoltaInstall layout, …","Constructs a new instance of the VoltaHome layout, rooted …","Returns the node_cache_dir path.","","","","Returns the node_image_root_dir path.","","Returns the node_index_expiry_file path.","","Returns the node_index_file path.","","Returns the node_inventory_dir path.","","","","","","Returns the package_image_root_dir path.","","Returns the package_inventory_dir path.","","Returns the root path for this directory layout.","Returns the root path for this directory layout.","","","Returns the shim_dir path.","","Returns the shim_executable path.","","","Returns the tmp_dir path.","","Returns the tools_dir path.","","","","","","","","","","Returns the yarn_image_root_dir path.","","Returns the yarn_inventory_dir path.","","","","","","Returns the cache_dir path.","","Creates all subdirectories in this directory layout.","Returns the default_bin_dir path.","","Returns the default_hooks_file path.","","","Returns the default_package_dir path.","","Returns the default_platform_file path.","","","Returns the default_toolchain_dir path.","","Returns the argument unchanged.","Returns the image_dir path.","","Calls U::from(self).","Returns the inventory_dir path.","","Returns the layout_file path.","","Returns the log_dir path.","","Constructs a new instance of the VoltaHome layout, rooted …","Returns the node_cache_dir path.","","","","Returns the node_image_root_dir path.","","Returns the node_index_expiry_file path.","","Returns the node_index_file path.","","Returns the node_inventory_dir path.","","","","","Returns the npm_image_root_dir path.","","Returns the npm_inventory_dir path.","","","","","Returns the package_image_root_dir path.","","Returns the package_inventory_dir path.","","Returns the root path for this directory layout.","","Returns the shim_dir path.","","","Returns the tmp_dir path.","","Returns the tools_dir path.","","","","","","","Returns the yarn_image_root_dir path.","","Returns the yarn_inventory_dir path.","","","","","","Returns the cache_dir path.","","Creates all subdirectories in this directory layout.","Returns the default_bin_dir path.","","Returns the default_hooks_file path.","","","Returns the default_package_dir path.","","Returns the default_platform_file path.","","","Returns the default_toolchain_dir path.","","Returns the argument unchanged.","Returns the image_dir path.","","Calls U::from(self).","Returns the inventory_dir path.","","Returns the layout_file path.","","Returns the log_dir path.","","Constructs a new instance of the VoltaHome layout, rooted …","Returns the node_cache_dir path.","","","","Returns the node_image_root_dir path.","","Returns the node_index_expiry_file path.","","Returns the node_index_file path.","","Returns the node_inventory_dir path.","","","","","Returns the npm_image_root_dir path.","","Returns the npm_inventory_dir path.","","","Returns the package_image_root_dir path.","","","","Returns the pnpm_image_root_dir path.","","Returns the pnpm_inventory_dir path.","","Returns the root path for this directory layout.","","","Returns the shared_lib_root path.","","Returns the shim_dir path.","","","Returns the tmp_dir path.","","Returns the tools_dir path.","","","","","","","Returns the yarn_image_root_dir path.","","Returns the yarn_inventory_dir path.","","","","","","Returns the cache_dir path.","","Creates all subdirectories in this directory layout.","Returns the default_bin_dir path.","","Returns the default_hooks_file path.","","","Returns the default_package_dir path.","","Returns the default_platform_file path.","","","Returns the default_toolchain_dir path.","","Returns the argument unchanged.","Returns the image_dir path.","","Calls U::from(self).","Returns the inventory_dir path.","","Returns the layout_file path.","","Returns the log_dir path.","","Constructs a new instance of the VoltaHome layout, rooted …","Returns the node_cache_dir path.","","","","Returns the node_image_root_dir path.","","Returns the node_index_expiry_file path.","","Returns the node_index_file path.","","Returns the node_inventory_dir path.","","","","","Returns the npm_image_root_dir path.","","Returns the npm_inventory_dir path.","","","Returns the package_image_root_dir path.","","","","Returns the pnpm_image_root_dir path.","","Returns the pnpm_inventory_dir path.","","Returns the root path for this directory layout.","","","Returns the shared_lib_root path.","","Returns the shim_dir path.","","","Returns the tmp_dir path.","","Returns the tools_dir path.","","","","","","","Returns the yarn_image_root_dir path.","","Returns the yarn_inventory_dir path.",""],"i":[0,0,0,0,0,0,0,0,0,0,5,3,5,3,3,3,5,3,3,3,3,3,3,3,3,3,3,3,3,3,5,3,3,3,5,3,3,3,3,3,5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,3,5,3,3,3,5,5,3,3,3,3,3,5,3,5,3,5,3,3,3,3,3,3,3,0,0,12,11,12,11,11,11,12,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,11,11,12,11,11,11,11,11,11,11,12,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,11,12,11,11,11,12,12,11,11,11,11,11,12,11,12,11,12,11,11,11,11,11,11,11,0,0,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,0,0,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,0,0,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],"f":[[1,2],0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[3,4],0,[5,[[7,[6]]]],[3,[[7,[6]]]],[3,4],0,[3,4],0,[[3,1],8],[3,4],0,[3,4],0,[[3,1],8],[3,4],0,[-1,-1,[]],[-1,-1,[]],[3,4],0,[-1,-2,[],[]],[-1,-2,[],[]],[3,4],0,[3,4],0,[8,5],[8,3],[3,4],0,[[3,1,1],8],[[3,1,1],8],[3,4],0,[3,4],0,[3,4],0,[3,4],0,[[3,1],8],[[3,1,1],8],[[3,1,1],8],[[3,1,1],8],[3,4],0,[3,4],0,[5,4],[3,4],0,0,[3,4],0,[5,4],0,[[3,1],8],[3,4],0,[3,4],0,[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,10,[]],[-1,10,[]],[[3,1],8],[[3,1],8],[3,4],0,[3,4],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[11,4],0,[12,[[7,[6]]]],[11,[[7,[6]]]],[11,4],0,[11,4],0,[[11,1],8],[11,4],0,[11,4],0,[[11,1],8],[11,4],0,[-1,-1,[]],[-1,-1,[]],[11,4],0,[-1,-2,[],[]],[-1,-2,[],[]],[11,4],0,[11,4],0,[11,4],0,[12,4],0,[12,4],0,[8,12],[8,11],[11,4],0,[[11,1,1],8],[[11,1,1],8],[11,4],0,[11,4],0,[11,4],0,[11,4],0,[[11,1],8],[[11,1,1],8],[[11,1,1],8],[[11,1,1],8],[11,4],0,[11,4],0,[12,4],[11,4],0,0,[11,4],0,[12,4],0,[[11,1],8],[11,4],0,[11,4],0,[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,10,[]],[-1,10,[]],[[11,1],8],[[11,1],8],[11,4],0,[11,4],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[13,4],0,[13,[[7,[6]]]],[13,4],0,[13,4],0,[[13,1],8],[13,4],0,[13,4],0,[[13,1],8],[13,4],0,[-1,-1,[]],[13,4],0,[-1,-2,[],[]],[13,4],0,[13,4],0,[13,4],0,[8,13],[13,4],0,[[13,1],8],[[13,1],8],[13,4],0,[13,4],0,[13,4],0,[13,4],0,[[13,1],8],[[13,1],8],[[13,1],8],[13,4],0,[13,4],0,[[13,1,1],8],[[13,1,1],8],[[13,1,1],8],[13,4],0,[13,4],0,[13,4],0,[13,4],0,[[13,1],8],[13,4],0,[13,4],0,[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,10,[]],[[13,1],8],[[13,1],8],[13,4],0,[13,4],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[14,4],0,[14,[[7,[6]]]],[14,4],0,[14,4],0,[[14,1],8],[14,4],0,[14,4],0,[[14,1],8],[14,4],0,[-1,-1,[]],[14,4],0,[-1,-2,[],[]],[14,4],0,[14,4],0,[14,4],0,[8,14],[14,4],0,[[14,1],8],[[14,1],8],[14,4],0,[14,4],0,[14,4],0,[14,4],0,[[14,1],8],[[14,1],8],[[14,1],8],[14,4],0,[14,4],0,[[14,1],8],[14,4],0,[[14,1],8],[[14,1],8],[14,4],0,[14,4],0,[14,4],0,[[14,1],8],[14,4],0,[14,4],0,[[14,1],8],[14,4],0,[14,4],0,[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,10,[]],[[14,1],8],[[14,1],8],[14,4],0,[14,4],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[15,4],0,[15,[[7,[6]]]],[15,4],0,[15,4],0,[[15,1],8],[15,4],0,[15,4],0,[[15,1],8],[15,4],0,[-1,-1,[]],[15,4],0,[-1,-2,[],[]],[15,4],0,[15,4],0,[15,4],0,[8,15],[15,4],0,[[15,1],8],[[15,1],8],[15,4],0,[15,4],0,[15,4],0,[15,4],0,[[15,1],8],[[15,1],8],[[15,1],8],[15,4],0,[15,4],0,[[15,1],8],[15,4],0,[[15,1],8],[[15,1],8],[15,4],0,[15,4],0,[15,4],0,[[15,1],8],[15,4],0,[15,4],0,[[15,1],8],[15,4],0,[15,4],0,[-1,[[9,[-2]]],[],[]],[-1,[[9,[-2]]],[],[]],[-1,10,[]],[[15,1],8],[[15,1],8],[15,4],0,[15,4],0],"c":[],"p":[[15,"str"],[3,"String",404],[3,"VoltaHome",8],[3,"Path",405],[3,"VoltaInstall",8],[15,"tuple"],[6,"Result",406],[3,"PathBuf",405],[4,"Result",407],[3,"TypeId",408],[3,"VoltaHome",87],[3,"VoltaInstall",87],[3,"VoltaHome",172],[3,"VoltaHome",246],[3,"VoltaHome",325]],"b":[]},\ +"volta_layout_macro":{"doc":"","t":"AAODNNDENNEDNNDNGMLLLLLLLLLLLLLMMMMLLLLLLLLLLLLLLMMLLLLLLLLLLLLLLLLLLLLLLLMDDMLLLLLMLMLMLLMMLLLLMMLLLLLLLLLLLLM","n":["ast","ir","layout","Ast","Dir","Dir","Directory","EntryKind","Err","Exe","FieldContents","FieldPrefix","File","File","LayoutStruct","Ok","Result","attrs","borrow","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","compile","decls","directory","entries","filename","flatten","flatten","from","from","from","from","from","from","into","into","into","into","into","into","name","name","parse","parse","parse","parse","parse","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","type_id","visibility","Entry","Ir","attrs","borrow","borrow","borrow_mut","borrow_mut","codegen","context","dir_names","dirs","exe_names","exes","field_names","file_names","filename","files","from","from","into","into","name","name","to_create_method","to_ctor","to_exe_init","to_item_methods","to_normal_init","to_struct_decl","try_from","try_from","try_into","try_into","type_id","type_id","visibility"],"q":[[0,"volta_layout_macro"],[3,"volta_layout_macro::ast"],[75,"volta_layout_macro::ir"],[111,"proc_macro2"],[112,"core::result"],[113,"syn::lit"],[114,"alloc::vec"],[115,"syn::parse"],[116,"syn::error"],[117,"core::any"],[118,"core::iter::traits::iterator"],[119,"proc_macro2"]],"d":["","","A macro for defining Volta directory layout hierarchies.","Abstract syntax tree (AST) for the surface syntax of the …","","A directory field suffix, which consists of a braced …","Represents a directory entry in the AST, which can …","","Contains the error value","","AST for the suffix of a field in a layout! struct …","AST for the common prefix of a single field in a layout! …","","A file field suffix, which consists of a single semicolon (…","Represents a single type LayoutStruct in the AST, which …","Contains the success value","","","","","","","","","","","","","","","Compiles (macro-expands) the AST.","","","","","Lowers the AST to a flattened intermediate representation.","Lowers the directory to a flattened intermediate …","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","","","","","","","","","","","","","","","The intermediate representation (IR) of a struct type …","","","","","","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","","","","","",""],"i":[0,0,0,0,18,13,0,0,19,18,0,0,18,13,0,19,0,3,1,3,6,18,12,13,1,3,6,18,12,13,1,1,3,6,12,3,6,1,3,6,18,12,13,1,3,6,18,12,13,3,12,1,3,6,12,13,1,3,6,18,12,13,1,3,6,18,12,13,1,3,6,18,12,13,3,0,0,4,4,16,4,16,4,16,4,4,4,4,4,4,16,4,4,16,4,16,4,16,4,4,16,4,16,4,4,16,4,16,4,16,4],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[1,2],0,0,0,0,[3,[[5,[4,2]]]],[[6,4,[8,[7]]],[[5,[9,2]]]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[10,[[11,[1]]]],[10,[[11,[3]]]],[10,[[11,[6]]]],[10,[[11,[12]]]],[10,[[11,[13]]]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],[-1,14,[]],0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[4,2],0,[4,[[0,[15]]]],0,[4,[[0,[15]]]],0,[4,[[0,[15]]]],[4,[[0,[15]]]],0,0,[-1,-1,[]],[-1,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],0,0,[4,2],[4,2],[[16,17],2],[4,2],[[16,17],2],[4,2],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,[[5,[-2]]],[],[]],[-1,14,[]],[-1,14,[]],0],"c":[],"p":[[3,"Ast",3],[3,"TokenStream",111],[3,"LayoutStruct",3],[3,"Ir",75],[4,"Result",112],[3,"Directory",3],[3,"LitStr",113],[3,"Vec",114],[15,"tuple"],[6,"ParseStream",115],[6,"Result",116],[3,"FieldPrefix",3],[4,"FieldContents",3],[3,"TypeId",117],[8,"Iterator",118],[3,"Entry",75],[3,"Ident",111],[4,"EntryKind",3],[6,"Result",3]],"b":[]},\ +"volta_migrate":{"doc":"","t":"F","n":["main"],"q":[[0,"volta_migrate"]],"d":[""],"i":[0],"f":[[[],1]],"c":[],"p":[[15,"tuple"]],"b":[]},\ +"volta_shim":{"doc":"","t":"AFEINNLLFLLKLLLL","n":["common","main","Error","IntoResult","Tool","Volta","borrow","borrow_mut","ensure_layout","from","into","into_result","try_from","try_into","type_id","vzip"],"q":[[0,"volta_shim"],[2,"volta_shim::common"],[16,"core::result"],[17,"core::any"]],"d":["","","","","","","","","","Returns the argument unchanged.","Calls U::from(self).","","","","",""],"i":[0,0,0,0,2,2,2,2,0,2,2,5,2,2,2,2],"f":[0,[[],1],0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[[],[[3,[1,2]]]],[-1,-1,[]],[-1,-2,[],[]],[-1,[[3,[-2,2]]],[],[]],[-1,[[3,[-2]]],[],[]],[-1,[[3,[-2]]],[],[]],[-1,4,[]],[-1,-2,[],[]]],"c":[],"p":[[15,"tuple"],[4,"Error",2],[4,"Result",16],[3,"TypeId",17],[8,"IntoResult",2]],"b":[]}\ +}'); +if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; +if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/main/settings.html b/main/settings.html new file mode 100644 index 000000000..ef5218133 --- /dev/null +++ b/main/settings.html @@ -0,0 +1 @@ +Settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/main/src-files.js b/main/src-files.js new file mode 100644 index 000000000..56a3c867a --- /dev/null +++ b/main/src-files.js @@ -0,0 +1,14 @@ +var srcIndex = JSON.parse('{\ +"archive":["",[],["lib.rs","tarball.rs","zip.rs"]],\ +"fs_utils":["",[],["lib.rs"]],\ +"progress_read":["",[],["lib.rs"]],\ +"test_support":["",[],["lib.rs","matchers.rs","paths.rs","process.rs"]],\ +"validate_npm_package_name":["",[],["lib.rs"]],\ +"volta":["",[["command",[["list",[],["human.rs","mod.rs","plain.rs","toolchain.rs"]]],["completions.rs","fetch.rs","install.rs","mod.rs","pin.rs","run.rs","setup.rs","uninstall.rs","use.rs","which.rs"]]],["cli.rs","common.rs","main.rs"]],\ +"volta_core":["",[["error",[],["kind.rs","mod.rs","reporter.rs"]],["hook",[],["mod.rs","serial.rs","tool.rs"]],["layout",[],["mod.rs","unix.rs"]],["platform",[],["image.rs","mod.rs","system.rs"]],["project",[],["mod.rs","serial.rs"]],["run",[],["binary.rs","executor.rs","mod.rs","node.rs","npm.rs","npx.rs","parser.rs","pnpm.rs","yarn.rs"]],["tool",[["node",[],["fetch.rs","metadata.rs","mod.rs","resolve.rs"]],["npm",[],["fetch.rs","mod.rs","resolve.rs"]],["package",[],["configure.rs","install.rs","manager.rs","metadata.rs","mod.rs","uninstall.rs"]],["pnpm",[],["fetch.rs","mod.rs","resolve.rs"]],["yarn",[],["fetch.rs","metadata.rs","mod.rs","resolve.rs"]]],["mod.rs","registry.rs","serial.rs"]],["toolchain",[],["mod.rs","serial.rs"]],["version",[],["mod.rs","serial.rs"]]],["command.rs","event.rs","fs.rs","inventory.rs","lib.rs","log.rs","monitor.rs","session.rs","shim.rs","signal.rs","style.rs","sync.rs"]],\ +"volta_layout":["",[],["lib.rs","macros.rs","v0.rs","v1.rs","v2.rs","v3.rs","v4.rs"]],\ +"volta_layout_macro":["",[],["ast.rs","ir.rs","lib.rs"]],\ +"volta_migrate":["",[],["volta-migrate.rs"]],\ +"volta_shim":["",[],["common.rs","volta-shim.rs"]]\ +}'); +createSrcSidebar(); diff --git a/main/src/archive/lib.rs.html b/main/src/archive/lib.rs.html new file mode 100644 index 000000000..ef2e9f2bf --- /dev/null +++ b/main/src/archive/lib.rs.html @@ -0,0 +1,211 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+
//! This crate provides types for fetching and unpacking compressed
+//! archives in tarball or zip format.
+use std::fs::File;
+use std::path::Path;
+
+use attohttpc::header::HeaderMap;
+use headers::{ContentLength, Header, HeaderMapExt};
+use thiserror::Error;
+
+mod tarball;
+mod zip;
+
+pub use crate::tarball::Tarball;
+pub use crate::zip::Zip;
+
+/// Error type for this crate
+#[derive(Error, Debug)]
+pub enum ArchiveError {
+    #[error("HTTP failure ({0})")]
+    HttpError(attohttpc::StatusCode),
+
+    #[error("HTTP header '{0}' not found")]
+    MissingHeaderError(&'static attohttpc::header::HeaderName),
+
+    #[error("unexpected content length in HTTP response: {0}")]
+    UnexpectedContentLengthError(u64),
+
+    #[error("{0}")]
+    IoError(#[from] std::io::Error),
+
+    #[error("{0}")]
+    AttohttpcError(#[from] attohttpc::Error),
+
+    #[error("{0}")]
+    ZipError(#[from] zip_rs::result::ZipError),
+}
+
+/// Metadata describing whether an archive comes from a local or remote origin.
+#[derive(Copy, Clone)]
+pub enum Origin {
+    Local,
+    Remote,
+}
+
+pub trait Archive {
+    fn compressed_size(&self) -> u64;
+
+    /// Unpacks the zip archive to the specified destination folder.
+    fn unpack(
+        self: Box<Self>,
+        dest: &Path,
+        progress: &mut dyn FnMut(&(), usize),
+    ) -> Result<(), ArchiveError>;
+
+    fn origin(&self) -> Origin;
+}
+
+cfg_if::cfg_if! {
+    if #[cfg(unix)] {
+        /// Load an archive in the native OS-preferred format from the specified file.
+        ///
+        /// On Windows, the preferred format is zip. On Unixes, the preferred format
+        /// is tarball.
+        pub fn load_native(source: File) -> Result<Box<dyn Archive>, ArchiveError> {
+            Tarball::load(source)
+        }
+
+        /// Fetch a remote archive in the native OS-preferred format from the specified
+        /// URL and store its results at the specified file path.
+        ///
+        /// On Windows, the preferred format is zip. On Unixes, the preferred format
+        /// is tarball.
+        pub fn fetch_native(url: &str, cache_file: &Path) -> Result<Box<dyn Archive>, ArchiveError> {
+            Tarball::fetch(url, cache_file)
+        }
+    } else if #[cfg(windows)] {
+        /// Load an archive in the native OS-preferred format from the specified file.
+        ///
+        /// On Windows, the preferred format is zip. On Unixes, the preferred format
+        /// is tarball.
+        pub fn load_native(source: File) -> Result<Box<dyn Archive>, ArchiveError> {
+            Zip::load(source)
+        }
+
+        /// Fetch a remote archive in the native OS-preferred format from the specified
+        /// URL and store its results at the specified file path.
+        ///
+        /// On Windows, the preferred format is zip. On Unixes, the preferred format
+        /// is tarball.
+        pub fn fetch_native(url: &str, cache_file: &Path) -> Result<Box<dyn Archive>, ArchiveError> {
+            Zip::fetch(url, cache_file)
+        }
+    } else {
+        compile_error!("Unsupported OS (expected 'unix' or 'windows').");
+    }
+}
+
+/// Determines the length of an HTTP response's content in bytes, using
+/// the HTTP `"Content-Length"` header.
+fn content_length(headers: &HeaderMap) -> Result<u64, ArchiveError> {
+    headers
+        .typed_get()
+        .map(|ContentLength(v)| v)
+        .ok_or_else(|| ArchiveError::MissingHeaderError(ContentLength::name()))
+}
+
\ No newline at end of file diff --git a/main/src/archive/tarball.rs.html b/main/src/archive/tarball.rs.html new file mode 100644 index 000000000..066a503fc --- /dev/null +++ b/main/src/archive/tarball.rs.html @@ -0,0 +1,197 @@ +tarball.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+
//! Provides types and functions for fetching and unpacking a Node installation
+//! tarball in Unix operating systems.
+
+use std::fs::File;
+use std::io::Read;
+use std::path::Path;
+
+use super::{content_length, Archive, ArchiveError, Origin};
+use flate2::read::GzDecoder;
+use fs_utils::ensure_containing_dir_exists;
+use progress_read::ProgressRead;
+use tee::TeeReader;
+
+/// A Node installation tarball.
+pub struct Tarball {
+    compressed_size: u64,
+    data: Box<dyn Read>,
+    origin: Origin,
+}
+
+impl Tarball {
+    /// Loads a tarball from the specified file.
+    pub fn load(source: File) -> Result<Box<dyn Archive>, ArchiveError> {
+        let compressed_size = source.metadata()?.len();
+        Ok(Box::new(Tarball {
+            compressed_size,
+            data: Box::new(source),
+            origin: Origin::Local,
+        }))
+    }
+
+    /// Initiate fetching of a tarball from the given URL, returning a
+    /// tarball that can be streamed (and that tees its data to a local
+    /// file as it streams).
+    pub fn fetch(url: &str, cache_file: &Path) -> Result<Box<dyn Archive>, ArchiveError> {
+        let (status, headers, response) = attohttpc::get(url).send()?.split();
+
+        if !status.is_success() {
+            return Err(ArchiveError::HttpError(status));
+        }
+
+        let compressed_size = content_length(&headers)?;
+
+        ensure_containing_dir_exists(&cache_file)?;
+        let file = File::create(cache_file)?;
+        let data = Box::new(TeeReader::new(response, file));
+
+        Ok(Box::new(Tarball {
+            compressed_size,
+            data,
+            origin: Origin::Remote,
+        }))
+    }
+}
+
+impl Archive for Tarball {
+    fn compressed_size(&self) -> u64 {
+        self.compressed_size
+    }
+    fn unpack(
+        self: Box<Self>,
+        dest: &Path,
+        progress: &mut dyn FnMut(&(), usize),
+    ) -> Result<(), ArchiveError> {
+        let decoded = GzDecoder::new(ProgressRead::new(self.data, (), progress));
+        let mut tarball = tar::Archive::new(decoded);
+        tarball.unpack(dest)?;
+        Ok(())
+    }
+    fn origin(&self) -> Origin {
+        self.origin
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use crate::tarball::Tarball;
+    use std::fs::File;
+    use std::path::PathBuf;
+
+    fn fixture_path(fixture_dir: &str) -> PathBuf {
+        let mut cargo_manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+        cargo_manifest_dir.push("fixtures");
+        cargo_manifest_dir.push(fixture_dir);
+        cargo_manifest_dir
+    }
+
+    #[test]
+    fn test_load() {
+        let mut test_file_path = fixture_path("tarballs");
+        test_file_path.push("test-file.tar.gz");
+        let test_file = File::open(test_file_path).expect("Couldn't open test file");
+        let tarball = Tarball::load(test_file).expect("Failed to load tarball");
+
+        assert_eq!(tarball.compressed_size(), 402);
+    }
+}
+
\ No newline at end of file diff --git a/main/src/archive/zip.rs.html b/main/src/archive/zip.rs.html new file mode 100644 index 000000000..c2d3293b2 --- /dev/null +++ b/main/src/archive/zip.rs.html @@ -0,0 +1,205 @@ +zip.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+
//! Provides types and functions for fetching and unpacking a Node installation
+//! zip file in Windows operating systems.
+
+use std::fs::File;
+use std::io::Read;
+use std::path::Path;
+
+use super::{content_length, ArchiveError};
+use fs_utils::ensure_containing_dir_exists;
+use progress_read::ProgressRead;
+use tee::TeeReader;
+use verbatim::PathExt;
+use zip_rs::unstable::stream::ZipStreamReader;
+
+use super::Archive;
+use super::Origin;
+
+pub struct Zip {
+    compressed_size: u64,
+    data: Box<dyn Read>,
+    origin: Origin,
+}
+
+impl Zip {
+    /// Loads a cached Node zip archive from the specified file.
+    pub fn load(source: File) -> Result<Box<dyn Archive>, ArchiveError> {
+        let compressed_size = source.metadata()?.len();
+
+        Ok(Box::new(Zip {
+            compressed_size,
+            data: Box::new(source),
+            origin: Origin::Local,
+        }))
+    }
+
+    /// Initiate fetching of a Node zip archive from the given URL, returning
+    /// a `Remote` data source.
+    pub fn fetch(url: &str, cache_file: &Path) -> Result<Box<dyn Archive>, ArchiveError> {
+        let (status, headers, response) = attohttpc::get(url).send()?.split();
+
+        if !status.is_success() {
+            return Err(ArchiveError::HttpError(status));
+        }
+
+        let compressed_size = content_length(&headers)?;
+
+        ensure_containing_dir_exists(&cache_file)?;
+        let file = File::create(cache_file)?;
+        let data = Box::new(TeeReader::new(response, file));
+
+        Ok(Box::new(Zip {
+            compressed_size,
+            data,
+            origin: Origin::Remote,
+        }))
+    }
+}
+
+impl Archive for Zip {
+    fn compressed_size(&self) -> u64 {
+        self.compressed_size
+    }
+    fn unpack(
+        self: Box<Self>,
+        dest: &Path,
+        progress: &mut dyn FnMut(&(), usize),
+    ) -> Result<(), ArchiveError> {
+        // Use a verbatim path to avoid the legacy Windows 260 byte path limit.
+        let dest: &Path = &dest.to_verbatim();
+        let zip = ZipStreamReader::new(ProgressRead::new(self.data, (), progress));
+        zip.extract(dest)?;
+        Ok(())
+    }
+    fn origin(&self) -> Origin {
+        self.origin
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use crate::zip::Zip;
+    use std::fs::File;
+    use std::path::PathBuf;
+
+    fn fixture_path(fixture_dir: &str) -> PathBuf {
+        let mut cargo_manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+        cargo_manifest_dir.push("fixtures");
+        cargo_manifest_dir.push(fixture_dir);
+        cargo_manifest_dir
+    }
+
+    #[test]
+    fn test_load() {
+        let mut test_file_path = fixture_path("zips");
+        test_file_path.push("test-file.zip");
+        let test_file = File::open(test_file_path).expect("Couldn't open test file");
+        let zip = Zip::load(test_file).expect("Failed to load zip file");
+
+        assert_eq!(zip.compressed_size(), 214);
+    }
+}
+
\ No newline at end of file diff --git a/main/src/fs_utils/lib.rs.html b/main/src/fs_utils/lib.rs.html new file mode 100644 index 000000000..13d1d7c73 --- /dev/null +++ b/main/src/fs_utils/lib.rs.html @@ -0,0 +1,43 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+
//! This crate provides utilities for operating on the filesystem.
+
+use std::fs;
+use std::io;
+use std::path::Path;
+
+/// This creates the parent directory of the input path, assuming the input path is a file.
+pub fn ensure_containing_dir_exists<P: AsRef<Path>>(path: &P) -> io::Result<()> {
+    path.as_ref()
+        .parent()
+        .ok_or_else(|| {
+            io::Error::new(
+                io::ErrorKind::NotFound,
+                format!(
+                    "Could not determine directory information for {}",
+                    path.as_ref().display()
+                ),
+            )
+        })
+        .and_then(fs::create_dir_all)
+}
+
\ No newline at end of file diff --git a/main/src/progress_read/lib.rs.html b/main/src/progress_read/lib.rs.html new file mode 100644 index 000000000..c5389682d --- /dev/null +++ b/main/src/progress_read/lib.rs.html @@ -0,0 +1,95 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+
//! This crate provides an adapter for the `std::io::Read` trait to
+//! allow reporting incremental progress to a callback function.
+
+use std::io::{self, Read, Seek, SeekFrom};
+
+/// A reader that reports incremental progress while reading.
+pub struct ProgressRead<R: Read, T, F: FnMut(&T, usize) -> T> {
+    source: R,
+    accumulator: T,
+    progress: F,
+}
+
+impl<R: Read, T, F: FnMut(&T, usize) -> T> Read for ProgressRead<R, T, F> {
+    /// Read some bytes from the underlying reader into the specified buffer,
+    /// and report progress to the progress callback. The progress callback is
+    /// passed the current value of the accumulator as its first argument and
+    /// the number of bytes read as its second argument. The result of the
+    /// progress callback is stored as the updated value of the accumulator,
+    /// to be passed to the next invocation of the callback.
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        let len = self.source.read(buf)?;
+        let new_accumulator = {
+            let progress = &mut self.progress;
+            progress(&self.accumulator, len)
+        };
+        self.accumulator = new_accumulator;
+        Ok(len)
+    }
+}
+
+impl<R: Read, T, F: FnMut(&T, usize) -> T> ProgressRead<R, T, F> {
+    /// Construct a new progress reader with the specified underlying reader,
+    /// initial value for an accumulator, and progress callback.
+    pub fn new(source: R, init: T, progress: F) -> ProgressRead<R, T, F> {
+        ProgressRead {
+            source,
+            accumulator: init,
+            progress,
+        }
+    }
+}
+
+impl<R: Read + Seek, T, F: FnMut(&T, usize) -> T> Seek for ProgressRead<R, T, F> {
+    fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
+        self.source.seek(pos)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/test_support/lib.rs.html b/main/src/test_support/lib.rs.html new file mode 100644 index 000000000..2d419da38 --- /dev/null +++ b/main/src/test_support/lib.rs.html @@ -0,0 +1,31 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
//! Utilities to use with acceptance tests in Volta.
+
+#[macro_export]
+macro_rules! ok_or_panic {
+    { $e:expr } => {
+        match $e {
+            Ok(x) => x,
+            Err(err) => panic!("{} failed with {}", stringify!($e), err),
+        }
+    };
+}
+
+pub mod matchers;
+pub mod paths;
+pub mod process;
+
\ No newline at end of file diff --git a/main/src/test_support/matchers.rs.html b/main/src/test_support/matchers.rs.html new file mode 100644 index 000000000..eb01e1896 --- /dev/null +++ b/main/src/test_support/matchers.rs.html @@ -0,0 +1,1439 @@ +matchers.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+
use std::fmt;
+use std::process::Output;
+use std::str;
+
+use crate::process::ProcessBuilder;
+
+use hamcrest2::core::{MatchResult, Matcher};
+use serde_json::{self, Value};
+
+#[derive(Clone)]
+pub struct Execs {
+    expect_stdout: Option<String>,
+    expect_stderr: Option<String>,
+    expect_exit_code: Option<i32>,
+    expect_stdout_contains: Vec<String>,
+    expect_stderr_contains: Vec<String>,
+    expect_either_contains: Vec<String>,
+    expect_stdout_contains_n: Vec<(String, usize)>,
+    expect_stdout_not_contains: Vec<String>,
+    expect_stderr_not_contains: Vec<String>,
+    expect_stderr_unordered: Vec<String>,
+    expect_neither_contains: Vec<String>,
+    expect_json: Option<Vec<Value>>,
+}
+
+impl Execs {
+    /// Verify that stdout is equal to the given lines.
+    /// See `lines_match` for supported patterns.
+    pub fn with_stdout<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_stdout = Some(expected.to_string());
+        self
+    }
+
+    /// Verify that stderr is equal to the given lines.
+    /// See `lines_match` for supported patterns.
+    pub fn with_stderr<S: ToString>(mut self, expected: S) -> Execs {
+        self._with_stderr(&expected);
+        self
+    }
+
+    fn _with_stderr(&mut self, expected: &dyn ToString) {
+        self.expect_stderr = Some(expected.to_string());
+    }
+
+    /// Verify the exit code from the process.
+    pub fn with_status(mut self, expected: i32) -> Execs {
+        self.expect_exit_code = Some(expected);
+        self
+    }
+
+    /// Verify that stdout contains the given contiguous lines somewhere in
+    /// its output.
+    /// See `lines_match` for supported patterns.
+    pub fn with_stdout_contains<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_stdout_contains.push(expected.to_string());
+        self
+    }
+
+    /// Verify that stderr contains the given contiguous lines somewhere in
+    /// its output.
+    /// See `lines_match` for supported patterns.
+    pub fn with_stderr_contains<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_stderr_contains.push(expected.to_string());
+        self
+    }
+
+    /// Verify that either stdout or stderr contains the given contiguous
+    /// lines somewhere in its output.
+    /// See `lines_match` for supported patterns.
+    pub fn with_either_contains<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_either_contains.push(expected.to_string());
+        self
+    }
+
+    /// Verify that stdout contains the given contiguous lines somewhere in
+    /// its output, and should be repeated `number` times.
+    /// See `lines_match` for supported patterns.
+    pub fn with_stdout_contains_n<S: ToString>(mut self, expected: S, number: usize) -> Execs {
+        self.expect_stdout_contains_n
+            .push((expected.to_string(), number));
+        self
+    }
+
+    /// Verify that stdout does not contain the given contiguous lines.
+    /// See `lines_match` for supported patterns.
+    /// See note on `with_stderr_does_not_contain`.
+    pub fn with_stdout_does_not_contain<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_stdout_not_contains.push(expected.to_string());
+        self
+    }
+
+    /// Verify that stderr does not contain the given contiguous lines.
+    /// See `lines_match` for supported patterns.
+    ///
+    /// Care should be taken when using this method because there is a
+    /// limitless number of possible things that *won't* appear.  A typo means
+    /// your test will pass without verifying the correct behavior. If
+    /// possible, write the test first so that it fails, and then implement
+    /// your fix/feature to make it pass.
+    pub fn with_stderr_does_not_contain<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_stderr_not_contains.push(expected.to_string());
+        self
+    }
+
+    /// Verify that all of the stderr output is equal to the given lines,
+    /// ignoring the order of the lines.
+    /// See `lines_match` for supported patterns.
+    /// This is useful when checking the output of `cargo build -v` since
+    /// the order of the output is not always deterministic.
+    /// Recommend use `with_stderr_contains` instead unless you really want to
+    /// check *every* line of output.
+    ///
+    /// Be careful when using patterns such as `[..]`, because you may end up
+    /// with multiple lines that might match, and this is not smart enough to
+    /// do anything like longest-match.  For example, avoid something like:
+    ///     [RUNNING] `rustc [..]
+    ///     [RUNNING] `rustc --crate-name foo [..]
+    /// This will randomly fail if the other crate name is `bar`, and the
+    /// order changes.
+    pub fn with_stderr_unordered<S: ToString>(mut self, expected: S) -> Execs {
+        self.expect_stderr_unordered.push(expected.to_string());
+        self
+    }
+
+    /// Verify the JSON output matches the given JSON.
+    /// Typically used when testing cargo commands that emit JSON.
+    /// Each separate JSON object should be separated by a blank line.
+    /// Example:
+    ///     assert_that(
+    ///         p.cargo("metadata"),
+    ///         execs().with_json(r#"
+    ///             {"example": "abc"}
+    ///             {"example": "def"}
+    ///         "#)
+    ///      );
+    /// Objects should match in the order given.
+    /// The order of arrays is ignored.
+    /// Strings support patterns described in `lines_match`.
+    /// Use `{...}` to match any object.
+    pub fn with_json(mut self, expected: &str) -> Execs {
+        self.expect_json = Some(
+            expected
+                .split("\n\n")
+                .map(|obj| obj.parse().unwrap())
+                .collect(),
+        );
+        self
+    }
+
+    fn match_output(&self, actual: &Output) -> MatchResult {
+        self.match_status(actual)
+            .and(self.match_stdout(actual))
+            .and(self.match_stderr(actual))
+    }
+
+    fn match_status(&self, actual: &Output) -> MatchResult {
+        match self.expect_exit_code {
+            None => Ok(()),
+            Some(code) if actual.status.code() == Some(code) => Ok(()),
+            Some(_) => Err(format!(
+                "exited with {}\n--- stdout\n{}\n--- stderr\n{}",
+                actual.status,
+                String::from_utf8_lossy(&actual.stdout),
+                String::from_utf8_lossy(&actual.stderr)
+            )),
+        }
+    }
+
+    fn match_stdout(&self, actual: &Output) -> MatchResult {
+        self.match_std(
+            self.expect_stdout.as_ref(),
+            &actual.stdout,
+            "stdout",
+            &actual.stderr,
+            MatchKind::Exact,
+        )?;
+        for expect in self.expect_stdout_contains.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stdout,
+                "stdout",
+                &actual.stderr,
+                MatchKind::Partial,
+            )?;
+        }
+        for expect in self.expect_stderr_contains.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stderr,
+                "stderr",
+                &actual.stdout,
+                MatchKind::Partial,
+            )?;
+        }
+        for &(ref expect, number) in self.expect_stdout_contains_n.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stdout,
+                "stdout",
+                &actual.stderr,
+                MatchKind::PartialN(number),
+            )?;
+        }
+        for expect in self.expect_stdout_not_contains.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stdout,
+                "stdout",
+                &actual.stderr,
+                MatchKind::NotPresent,
+            )?;
+        }
+        for expect in self.expect_stderr_not_contains.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stderr,
+                "stderr",
+                &actual.stdout,
+                MatchKind::NotPresent,
+            )?;
+        }
+        for expect in self.expect_stderr_unordered.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stderr,
+                "stderr",
+                &actual.stdout,
+                MatchKind::Unordered,
+            )?;
+        }
+        for expect in self.expect_neither_contains.iter() {
+            self.match_std(
+                Some(expect),
+                &actual.stdout,
+                "stdout",
+                &actual.stdout,
+                MatchKind::NotPresent,
+            )?;
+
+            self.match_std(
+                Some(expect),
+                &actual.stderr,
+                "stderr",
+                &actual.stderr,
+                MatchKind::NotPresent,
+            )?;
+        }
+
+        for expect in self.expect_either_contains.iter() {
+            let match_std = self.match_std(
+                Some(expect),
+                &actual.stdout,
+                "stdout",
+                &actual.stdout,
+                MatchKind::Partial,
+            );
+            let match_err = self.match_std(
+                Some(expect),
+                &actual.stderr,
+                "stderr",
+                &actual.stderr,
+                MatchKind::Partial,
+            );
+
+            if let (Err(_), Err(_)) = (match_std, match_err) {
+                return Err(format!(
+                    "expected to find:\n\
+                     {}\n\n\
+                     did not find in either output.",
+                    expect
+                ));
+            }
+        }
+
+        if let Some(ref objects) = self.expect_json {
+            let stdout = str::from_utf8(&actual.stdout)
+                .map_err(|_| "stdout was not utf8 encoded".to_owned())?;
+            let lines = stdout
+                .lines()
+                .filter(|line| line.starts_with('{'))
+                .collect::<Vec<_>>();
+            if lines.len() != objects.len() {
+                return Err(format!(
+                    "expected {} json lines, got {}, stdout:\n{}",
+                    objects.len(),
+                    lines.len(),
+                    stdout
+                ));
+            }
+            for (obj, line) in objects.iter().zip(lines) {
+                self.match_json(obj, line)?;
+            }
+        }
+        Ok(())
+    }
+
+    fn match_stderr(&self, actual: &Output) -> MatchResult {
+        self.match_std(
+            self.expect_stderr.as_ref(),
+            &actual.stderr,
+            "stderr",
+            &actual.stdout,
+            MatchKind::Exact,
+        )
+    }
+
+    fn match_std(
+        &self,
+        expected: Option<&String>,
+        actual: &[u8],
+        description: &str,
+        extra: &[u8],
+        kind: MatchKind,
+    ) -> MatchResult {
+        let out = match expected {
+            Some(out) => out,
+            None => return Ok(()),
+        };
+        let actual = match str::from_utf8(actual) {
+            Err(..) => return Err(format!("{} was not utf8 encoded", description)),
+            Ok(actual) => actual,
+        };
+        // Let's not deal with \r\n vs \n on windows...
+        let actual = actual.replace('\r', "");
+        let actual = actual.replace('\t', "<tab>");
+
+        match kind {
+            MatchKind::Exact => {
+                let a = actual.lines();
+                let e = out.lines();
+
+                let diffs = self.diff_lines(a, e, false);
+                if diffs.is_empty() {
+                    Ok(())
+                } else {
+                    Err(format!(
+                        "differences:\n\
+                         {}\n\n\
+                         other output:\n\
+                         `{}`",
+                        diffs.join("\n"),
+                        String::from_utf8_lossy(extra)
+                    ))
+                }
+            }
+            MatchKind::Partial => {
+                let mut a = actual.lines();
+                let e = out.lines();
+
+                let mut diffs = self.diff_lines(a.clone(), e.clone(), true);
+                #[allow(clippy::while_let_on_iterator)]
+                while let Some(..) = a.next() {
+                    let a = self.diff_lines(a.clone(), e.clone(), true);
+                    if a.len() < diffs.len() {
+                        diffs = a;
+                    }
+                }
+                if diffs.is_empty() {
+                    Ok(())
+                } else {
+                    Err(format!(
+                        "expected to find:\n\
+                         {}\n\n\
+                         did not find in output:\n\
+                         {}",
+                        out, actual
+                    ))
+                }
+            }
+            MatchKind::PartialN(number) => {
+                let mut a = actual.lines();
+                let e = out.lines();
+
+                let mut matches = 0;
+
+                loop {
+                    if self.diff_lines(a.clone(), e.clone(), true).is_empty() {
+                        matches += 1;
+                    }
+
+                    if a.next().is_none() {
+                        break;
+                    }
+                }
+
+                if matches == number {
+                    Ok(())
+                } else {
+                    Err(format!(
+                        "expected to find {} occurrences:\n\
+                         {}\n\n\
+                         did not find in output:\n\
+                         {}",
+                        number, out, actual
+                    ))
+                }
+            }
+            MatchKind::NotPresent => {
+                let mut a = actual.lines();
+                let e = out.lines();
+
+                let mut diffs = self.diff_lines(a.clone(), e.clone(), true);
+                #[allow(clippy::while_let_on_iterator)]
+                while let Some(..) = a.next() {
+                    let a = self.diff_lines(a.clone(), e.clone(), true);
+                    if a.len() < diffs.len() {
+                        diffs = a;
+                    }
+                }
+                if diffs.is_empty() {
+                    Err(format!(
+                        "expected not to find:\n\
+                         {}\n\n\
+                         but found in output:\n\
+                         {}",
+                        out, actual
+                    ))
+                } else {
+                    Ok(())
+                }
+            }
+            MatchKind::Unordered => {
+                let mut a = actual.lines().collect::<Vec<_>>();
+                let e = out.lines();
+
+                for e_line in e {
+                    match a.iter().position(|a_line| lines_match(e_line, a_line)) {
+                        Some(index) => a.remove(index),
+                        None => {
+                            return Err(format!(
+                                "Did not find expected line:\n\
+                                 {}\n\
+                                 Remaining available output:\n\
+                                 {}\n",
+                                e_line,
+                                a.join("\n")
+                            ));
+                        }
+                    };
+                }
+                if !a.is_empty() {
+                    Err(format!(
+                        "Output included extra lines:\n\
+                         {}\n",
+                        a.join("\n")
+                    ))
+                } else {
+                    Ok(())
+                }
+            }
+        }
+    }
+
+    fn match_json(&self, expected: &Value, line: &str) -> MatchResult {
+        let actual = match line.parse() {
+            Err(e) => return Err(format!("invalid json, {}:\n`{}`", e, line)),
+            Ok(actual) => actual,
+        };
+
+        match find_mismatch(expected, &actual) {
+            Some((expected_part, actual_part)) => Err(format!(
+                "JSON mismatch\nExpected:\n{}\nWas:\n{}\nExpected part:\n{}\nActual part:\n{}\n",
+                serde_json::to_string_pretty(expected).unwrap(),
+                serde_json::to_string_pretty(&actual).unwrap(),
+                serde_json::to_string_pretty(expected_part).unwrap(),
+                serde_json::to_string_pretty(actual_part).unwrap(),
+            )),
+            None => Ok(()),
+        }
+    }
+
+    fn diff_lines<'a>(
+        &self,
+        actual: str::Lines<'a>,
+        expected: str::Lines<'a>,
+        partial: bool,
+    ) -> Vec<String> {
+        let actual = actual.take(if partial {
+            expected.clone().count()
+        } else {
+            usize::MAX
+        });
+        zip_all(actual, expected)
+            .enumerate()
+            .filter_map(|(i, (a, e))| match (a, e) {
+                (Some(a), Some(e)) => {
+                    if lines_match(e, a) {
+                        None
+                    } else {
+                        Some(format!("{:3} - |{}|\n    + |{}|\n", i, e, a))
+                    }
+                }
+                (Some(a), None) => Some(format!("{:3} -\n    + |{}|\n", i, a)),
+                (None, Some(e)) => Some(format!("{:3} - |{}|\n    +\n", i, e)),
+                (None, None) => panic!("Cannot get here"),
+            })
+            .collect()
+    }
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+enum MatchKind {
+    Exact,
+    Partial,
+    PartialN(usize),
+    NotPresent,
+    Unordered,
+}
+
+/// Compare a line with an expected pattern.
+/// - Use `[..]` as a wildcard to match 0 or more characters on the same line
+///   (similar to `.*` in a regex).
+/// - Use `[EXE]` to optionally add `.exe` on Windows (empty string on other
+///   platforms).
+/// - There is a wide range of macros (such as `[COMPILING]` or `[WARNING]`)
+///   to match cargo's "status" output and allows you to ignore the alignment.
+///   See `substitute_macros` for a complete list of macros.
+pub fn lines_match(expected: &str, actual: &str) -> bool {
+    // Let's not deal with / vs \ (windows...)
+    let expected = expected.replace('\\', "/");
+    let mut actual: &str = &actual.replace('\\', "/");
+    let expected = substitute_macros(&expected);
+    for (i, part) in expected.split("[..]").enumerate() {
+        match actual.find(part) {
+            Some(j) => {
+                if i == 0 && j != 0 {
+                    return false;
+                }
+                actual = &actual[j + part.len()..];
+            }
+            None => return false,
+        }
+    }
+    actual.is_empty() || expected.ends_with("[..]")
+}
+
+#[test]
+fn lines_match_works() {
+    assert!(lines_match("a b", "a b"));
+    assert!(lines_match("a[..]b", "a b"));
+    assert!(lines_match("a[..]", "a b"));
+    assert!(lines_match("[..]", "a b"));
+    assert!(lines_match("[..]b", "a b"));
+
+    assert!(!lines_match("[..]b", "c"));
+    assert!(!lines_match("b", "c"));
+    assert!(!lines_match("b", "cb"));
+}
+
+// Compares JSON object for approximate equality.
+// You can use `[..]` wildcard in strings (useful for OS dependent things such
+// as paths).  You can use a `"{...}"` string literal as a wildcard for
+// arbitrary nested JSON (useful for parts of object emitted by other programs
+// (e.g. rustc) rather than Cargo itself).  Arrays are sorted before comparison.
+fn find_mismatch<'a>(expected: &'a Value, actual: &'a Value) -> Option<(&'a Value, &'a Value)> {
+    use serde_json::Value::*;
+    match (expected, actual) {
+        (Number(l), Number(r)) if l == r => None,
+        (Bool(l), Bool(r)) if l == r => None,
+        (String(l), String(r)) if lines_match(l, r) => None,
+        (Array(l), Array(r)) => {
+            if l.len() != r.len() {
+                return Some((expected, actual));
+            }
+
+            let mut l = l.iter().collect::<Vec<_>>();
+            let mut r = r.iter().collect::<Vec<_>>();
+
+            l.retain(
+                |l| match r.iter().position(|r| find_mismatch(l, r).is_none()) {
+                    Some(i) => {
+                        r.remove(i);
+                        false
+                    }
+                    None => true,
+                },
+            );
+
+            if !l.is_empty() {
+                assert!(!r.is_empty());
+                Some((l[0], r[0]))
+            } else {
+                assert_eq!(r.len(), 0);
+                None
+            }
+        }
+        (Object(l), Object(r)) => {
+            let same_keys = l.len() == r.len() && l.keys().all(|k| r.contains_key(k));
+            if !same_keys {
+                return Some((expected, actual));
+            }
+
+            l.values()
+                .zip(r.values())
+                .find_map(|(l, r)| find_mismatch(l, r))
+        }
+        (Null, Null) => None,
+        // magic string literal "{...}" acts as wildcard for any sub-JSON
+        (String(l), _) if l == "{...}" => None,
+        _ => Some((expected, actual)),
+    }
+}
+
+struct ZipAll<I1: Iterator, I2: Iterator> {
+    first: I1,
+    second: I2,
+}
+
+impl<T, I1: Iterator<Item = T>, I2: Iterator<Item = T>> Iterator for ZipAll<I1, I2> {
+    type Item = (Option<T>, Option<T>);
+    fn next(&mut self) -> Option<(Option<T>, Option<T>)> {
+        let first = self.first.next();
+        let second = self.second.next();
+
+        match (first, second) {
+            (None, None) => None,
+            (a, b) => Some((a, b)),
+        }
+    }
+}
+
+fn zip_all<T, I1: Iterator<Item = T>, I2: Iterator<Item = T>>(a: I1, b: I2) -> ZipAll<I1, I2> {
+    ZipAll {
+        first: a,
+        second: b,
+    }
+}
+
+impl fmt::Display for Execs {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "execs")
+    }
+}
+
+impl fmt::Debug for Execs {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "execs")
+    }
+}
+
+impl Matcher<ProcessBuilder> for Execs {
+    fn matches(&self, mut process: ProcessBuilder) -> MatchResult {
+        self.matches(&mut process)
+    }
+}
+
+impl<'a> Matcher<&'a mut ProcessBuilder> for Execs {
+    fn matches(&self, process: &'a mut ProcessBuilder) -> MatchResult {
+        println!("running {}", process);
+        let res = process.exec_with_output();
+
+        match res {
+            Ok(out) => self.match_output(&out),
+            Err(err) => {
+                if let Some(out) = &err.output {
+                    return self.match_output(out);
+                }
+                Err(format!("could not exec process {}: {}", process, err))
+            }
+        }
+    }
+}
+
+impl Matcher<Output> for Execs {
+    fn matches(&self, output: Output) -> MatchResult {
+        self.match_output(&output)
+    }
+}
+
+pub fn execs() -> Execs {
+    Execs {
+        expect_stdout: None,
+        expect_stderr: None,
+        expect_exit_code: Some(0),
+        expect_stdout_contains: Vec::new(),
+        expect_stderr_contains: Vec::new(),
+        expect_either_contains: Vec::new(),
+        expect_stdout_contains_n: Vec::new(),
+        expect_stdout_not_contains: Vec::new(),
+        expect_stderr_not_contains: Vec::new(),
+        expect_stderr_unordered: Vec::new(),
+        expect_neither_contains: Vec::new(),
+        expect_json: None,
+    }
+}
+
+fn substitute_macros(input: &str) -> String {
+    let macros = [
+        ("[RUNNING]", "     Running"),
+        ("[COMPILING]", "   Compiling"),
+        ("[CHECKING]", "    Checking"),
+        ("[CREATED]", "     Created"),
+        ("[FINISHED]", "    Finished"),
+        ("[ERROR]", "error:"),
+        ("[WARNING]", "warning:"),
+        ("[DOCUMENTING]", " Documenting"),
+        ("[FRESH]", "       Fresh"),
+        ("[UPDATING]", "    Updating"),
+        ("[ADDING]", "      Adding"),
+        ("[REMOVING]", "    Removing"),
+        ("[DOCTEST]", "   Doc-tests"),
+        ("[PACKAGING]", "   Packaging"),
+        ("[DOWNLOADING]", " Downloading"),
+        ("[UPLOADING]", "   Uploading"),
+        ("[VERIFYING]", "   Verifying"),
+        ("[ARCHIVING]", "   Archiving"),
+        ("[INSTALLING]", "  Installing"),
+        ("[REPLACING]", "   Replacing"),
+        ("[UNPACKING]", "   Unpacking"),
+        ("[SUMMARY]", "     Summary"),
+        ("[FIXING]", "      Fixing"),
+        ("[EXE]", if cfg!(windows) { ".exe" } else { "" }),
+    ];
+    let mut result = input.to_owned();
+    for &(pat, subst) in &macros {
+        result = result.replace(pat, subst)
+    }
+    result
+}
+
\ No newline at end of file diff --git a/main/src/test_support/paths.rs.html b/main/src/test_support/paths.rs.html new file mode 100644 index 000000000..c98248d5e --- /dev/null +++ b/main/src/test_support/paths.rs.html @@ -0,0 +1,285 @@ +paths.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+
use std::cell::Cell;
+use std::env;
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::sync::atomic::{AtomicUsize, Ordering};
+use std::sync::Once;
+
+static SMOKE_TEST_DIR: &str = "smoke_test";
+static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
+
+thread_local!(static TASK_ID: usize = NEXT_ID.fetch_add(1, Ordering::SeqCst));
+
+// creates the root directory for the tests (once), and
+// initializes the root and home directories for the current task
+fn init() {
+    static GLOBAL_INIT: Once = Once::new();
+    thread_local!(static LOCAL_INIT: Cell<bool> = Cell::new(false));
+    GLOBAL_INIT.call_once(|| {
+        global_root().mkdir_p();
+    });
+    LOCAL_INIT.with(|i| {
+        if i.get() {
+            return;
+        }
+        i.set(true);
+        root().rm_rf();
+        home().mkdir_p();
+    })
+}
+
+// the root directory for the smoke tests, in `target/smoke_test`
+fn global_root() -> PathBuf {
+    let mut path = ok_or_panic! { env::current_exe() };
+    path.pop(); // chop off exe name
+    path.pop(); // chop off 'debug'
+
+    // If `cargo test` is run manually then our path looks like
+    // `target/debug/foo`, in which case our `path` is already pointing at
+    // `target`. If, however, `cargo test --target $target` is used then the
+    // output is `target/$target/debug/foo`, so our path is pointing at
+    // `target/$target`. Here we conditionally pop the `$target` name.
+    if path.file_name().and_then(|s| s.to_str()) != Some("target") {
+        path.pop();
+    }
+
+    path.join(SMOKE_TEST_DIR)
+}
+
+pub fn root() -> PathBuf {
+    init();
+    global_root().join(TASK_ID.with(|my_id| format!("t{}", my_id)))
+}
+
+pub fn home() -> PathBuf {
+    root().join("home")
+}
+
+enum Remove {
+    File,
+    Dir,
+}
+impl Remove {
+    fn to_str(&self) -> &'static str {
+        match *self {
+            Remove::File => "remove file",
+            Remove::Dir => "remove dir",
+        }
+    }
+
+    fn at(&self, path: &Path) {
+        if cfg!(windows) {
+            let mut p = ok_or_panic!(path.metadata()).permissions();
+            // This lint rule is not applicable: this is in a `cfg!(windows)` block.
+            #[allow(clippy::permissions_set_readonly_false)]
+            p.set_readonly(false);
+            ok_or_panic! { fs::set_permissions(path, p) };
+        }
+        match *self {
+            Remove::File => fs::remove_file(path),
+            Remove::Dir => fs::remove_dir_all(path), // ensure all dir contents are removed
+        }
+        .unwrap_or_else(|e| {
+            panic!("failed to {} {}: {}", self.to_str(), path.display(), e);
+        })
+    }
+}
+
+pub trait PathExt {
+    fn rm(&self);
+    fn rm_rf(&self);
+    fn rm_contents(&self);
+    fn ensure_empty(&self);
+    fn mkdir_p(&self);
+}
+
+impl PathExt for Path {
+    // delete a file if it exists
+    fn rm(&self) {
+        if !self.exists() {
+            return;
+        }
+        // On windows we can't remove a readonly file, and git will
+        // often clone files as readonly. As a result, we have some
+        // special logic to remove readonly files on windows.
+        Remove::File.at(self);
+    }
+
+    /* Technically there is a potential race condition, but we don't
+     * care all that much for our tests
+     */
+    fn rm_rf(&self) {
+        if !self.exists() {
+            return;
+        }
+        self.rm_contents();
+        Remove::Dir.at(self);
+    }
+
+    // remove directory contents but not the directory itself
+    fn rm_contents(&self) {
+        for file in ok_or_panic! { fs::read_dir(self) } {
+            let file = ok_or_panic! { file };
+            if file.file_type().map(|m| m.is_dir()).unwrap_or(false) {
+                file.path().rm_rf();
+            } else {
+                file.path().rm();
+            }
+        }
+    }
+
+    // ensure the directory is created and empty
+    fn ensure_empty(&self) {
+        self.mkdir_p();
+        self.rm_contents();
+    }
+
+    // create all paths up to the input path
+    fn mkdir_p(&self) {
+        fs::create_dir_all(self)
+            .unwrap_or_else(|e| panic!("failed to mkdir_p {}: {}", self.display(), e))
+    }
+}
+
\ No newline at end of file diff --git a/main/src/test_support/process.rs.html b/main/src/test_support/process.rs.html new file mode 100644 index 000000000..bf3d26c44 --- /dev/null +++ b/main/src/test_support/process.rs.html @@ -0,0 +1,491 @@ +process.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+
use std::collections::HashMap;
+use std::env;
+use std::ffi::{OsStr, OsString};
+use std::fmt;
+use std::path::Path;
+use std::process::{Command, ExitStatus, Output};
+use std::str;
+
+use thiserror::Error;
+
+/// A builder object for an external process, similar to `std::process::Command`.
+#[derive(Clone, Debug)]
+pub struct ProcessBuilder {
+    /// The program to execute.
+    program: OsString,
+    /// A list of arguments to pass to the program.
+    args: Vec<OsString>,
+    /// Any environment variables that should be set for the program.
+    env: HashMap<String, Option<OsString>>,
+    /// Which directory to run the program from.
+    cwd: Option<OsString>,
+}
+
+impl fmt::Display for ProcessBuilder {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "`{}", self.program.to_string_lossy())?;
+
+        for arg in &self.args {
+            write!(f, " {}", arg.to_string_lossy())?;
+        }
+
+        write!(f, "`")
+    }
+}
+
+impl ProcessBuilder {
+    /// (chainable) Set the executable for the process.
+    pub fn program<T: AsRef<OsStr>>(&mut self, program: T) -> &mut ProcessBuilder {
+        self.program = program.as_ref().to_os_string();
+        self
+    }
+
+    /// (chainable) Add an arg to the args list.
+    pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut ProcessBuilder {
+        self.args.push(arg.as_ref().to_os_string());
+        self
+    }
+
+    /// (chainable) Add many args to the args list.
+    pub fn args<T: AsRef<OsStr>>(&mut self, arguments: &[T]) -> &mut ProcessBuilder {
+        self.args
+            .extend(arguments.iter().map(|t| t.as_ref().to_os_string()));
+        self
+    }
+
+    /// (chainable) Replace args with new args list
+    pub fn args_replace<T: AsRef<OsStr>>(&mut self, arguments: &[T]) -> &mut ProcessBuilder {
+        self.args = arguments
+            .iter()
+            .map(|t| t.as_ref().to_os_string())
+            .collect();
+        self
+    }
+
+    /// (chainable) Set the current working directory of the process
+    pub fn cwd<T: AsRef<OsStr>>(&mut self, path: T) -> &mut ProcessBuilder {
+        self.cwd = Some(path.as_ref().to_os_string());
+        self
+    }
+
+    /// (chainable) Set an environment variable for the process.
+    pub fn env<T: AsRef<OsStr>>(&mut self, key: &str, val: T) -> &mut ProcessBuilder {
+        self.env
+            .insert(key.to_string(), Some(val.as_ref().to_os_string()));
+        self
+    }
+
+    /// (chainable) Unset an environment variable for the process.
+    pub fn env_remove(&mut self, key: &str) -> &mut ProcessBuilder {
+        self.env.insert(key.to_string(), None);
+        self
+    }
+
+    /// Get the executable name.
+    pub fn get_program(&self) -> &OsString {
+        &self.program
+    }
+
+    /// Get the program arguments
+    pub fn get_args(&self) -> &[OsString] {
+        &self.args
+    }
+
+    /// Get the current working directory for the process
+    pub fn get_cwd(&self) -> Option<&Path> {
+        self.cwd.as_ref().map(Path::new)
+    }
+
+    /// Get an environment variable as the process will see it (will inherit from environment
+    /// unless explicitally unset).
+    pub fn get_env(&self, var: &str) -> Option<OsString> {
+        self.env
+            .get(var)
+            .cloned()
+            .or_else(|| Some(env::var_os(var)))
+            .and_then(|s| s)
+    }
+
+    /// Get all environment variables explicitly set or unset for the process (not inherited
+    /// vars).
+    pub fn get_envs(&self) -> &HashMap<String, Option<OsString>> {
+        &self.env
+    }
+
+    /// Run the process, waiting for completion, and mapping non-success exit codes to an error.
+    pub fn exec(&self) -> Result<(), ProcessError> {
+        let mut command = self.build_command();
+
+        let exit = match command.status() {
+            Ok(e) => e,
+            Err(_) => {
+                return Err(process_error(
+                    &format!("could not execute process {}", self),
+                    None,
+                    None,
+                ));
+            }
+        };
+
+        if exit.success() {
+            Ok(())
+        } else {
+            Err(process_error(
+                &format!("process didn't exit successfully: {}", self),
+                Some(exit),
+                None,
+            ))
+        }
+    }
+
+    /// Execute the process, returning the stdio output, or an error if non-zero exit status.
+    pub fn exec_with_output(&self) -> Result<Output, ProcessError> {
+        let mut command = self.build_command();
+
+        let output = match command.output() {
+            Ok(o) => o,
+            Err(_) => {
+                return Err(process_error(
+                    &format!("could not execute process {}", self),
+                    None,
+                    None,
+                ));
+            }
+        };
+
+        if output.status.success() {
+            Ok(output)
+        } else {
+            Err(process_error(
+                &format!("process didn't exit successfully: {}", self),
+                Some(output.status),
+                Some(&output),
+            ))
+        }
+    }
+
+    /// Converts ProcessBuilder into a `std::process::Command`
+    pub fn build_command(&self) -> Command {
+        let mut command = Command::new(&self.program);
+        if let Some(cwd) = self.get_cwd() {
+            command.current_dir(cwd);
+        }
+        for arg in &self.args {
+            command.arg(arg);
+        }
+        for (k, v) in &self.env {
+            match *v {
+                Some(ref v) => {
+                    command.env(k, v);
+                }
+                None => {
+                    command.env_remove(k);
+                }
+            }
+        }
+        command
+    }
+}
+
+/// A helper function to create a `ProcessBuilder`.
+pub fn process<T: AsRef<OsStr>>(cmd: T) -> ProcessBuilder {
+    ProcessBuilder {
+        program: cmd.as_ref().to_os_string(),
+        args: Vec::new(),
+        cwd: None,
+        env: HashMap::new(),
+    }
+}
+
+#[derive(Debug, Error)]
+#[error("{desc}")]
+pub struct ProcessError {
+    pub desc: String,
+    pub exit: Option<ExitStatus>,
+    pub output: Option<Output>,
+}
+
+pub fn process_error(
+    msg: &str,
+    status: Option<ExitStatus>,
+    output: Option<&Output>,
+) -> ProcessError {
+    let exit = match status {
+        Some(s) => status_to_string(s),
+        None => "never executed".to_string(),
+    };
+    let mut desc = format!("{} ({})", &msg, exit);
+
+    if let Some(out) = output {
+        match str::from_utf8(&out.stdout) {
+            Ok(s) if !s.trim().is_empty() => {
+                desc.push_str("\n--- stdout\n");
+                desc.push_str(s);
+            }
+            Ok(..) | Err(..) => {}
+        }
+        match str::from_utf8(&out.stderr) {
+            Ok(s) if !s.trim().is_empty() => {
+                desc.push_str("\n--- stderr\n");
+                desc.push_str(s);
+            }
+            Ok(..) | Err(..) => {}
+        }
+    }
+
+    return ProcessError {
+        desc,
+        exit: status,
+        output: output.cloned(),
+    };
+
+    fn status_to_string(status: ExitStatus) -> String {
+        status.to_string()
+    }
+}
+
\ No newline at end of file diff --git a/main/src/validate_npm_package_name/lib.rs.html b/main/src/validate_npm_package_name/lib.rs.html new file mode 100644 index 000000000..13989353a --- /dev/null +++ b/main/src/validate_npm_package_name/lib.rs.html @@ -0,0 +1,667 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+
//! A Rust implementation of the validation rules from the core JS package
+//! [`validate-npm-package-name`](https://github.com/npm/validate-npm-package-name/).
+
+use once_cell::sync::Lazy;
+use percent_encoding::{utf8_percent_encode, AsciiSet, NON_ALPHANUMERIC};
+use regex::Regex;
+
+/// The set of characters to encode, matching the characters encoded by
+/// [`encodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#description)
+static ENCODE_URI_SET: &AsciiSet = &NON_ALPHANUMERIC
+    .remove(b'-')
+    .remove(b'_')
+    .remove(b'.')
+    .remove(b'!')
+    .remove(b'~')
+    .remove(b'*')
+    .remove(b'\'')
+    .remove(b'(')
+    .remove(b')');
+
+static SCOPED_PACKAGE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"^(?:@([^/]+?)[/])?([^/]+?)$").expect("regex is valid"));
+static SPECIAL_CHARS: Lazy<Regex> = Lazy::new(|| Regex::new(r"[~'!()*]").expect("regex is valid"));
+const BLACKLIST: [&str; 2] = ["node_modules", "favicon.ico"];
+
+// Borrowed from https://github.com/juliangruber/builtins
+const BUILTINS: [&str; 39] = [
+    "assert",
+    "buffer",
+    "child_process",
+    "cluster",
+    "console",
+    "constants",
+    "crypto",
+    "dgram",
+    "dns",
+    "domain",
+    "events",
+    "fs",
+    "http",
+    "https",
+    "module",
+    "net",
+    "os",
+    "path",
+    "punycode",
+    "querystring",
+    "readline",
+    "repl",
+    "stream",
+    "string_decoder",
+    "sys",
+    "timers",
+    "tls",
+    "tty",
+    "url",
+    "util",
+    "vm",
+    "zlib",
+    "freelist",
+    // excluded only in some versions
+    "freelist",
+    "v8",
+    "process",
+    "async_hooks",
+    "http2",
+    "perf_hooks",
+];
+
+#[derive(Debug, PartialEq, Eq)]
+pub enum Validity {
+    /// Valid for new and old packages
+    Valid,
+
+    /// Valid only for old packages
+    ValidForOldPackages { warnings: Vec<String> },
+
+    /// Not valid for new or old packages
+    Invalid {
+        warnings: Vec<String>,
+        errors: Vec<String>,
+    },
+}
+
+impl Validity {
+    pub fn valid_for_old_packages(&self) -> bool {
+        matches!(self, Validity::Valid | Validity::ValidForOldPackages { .. })
+    }
+
+    pub fn valid_for_new_packages(&self) -> bool {
+        matches!(self, Validity::Valid)
+    }
+}
+
+pub fn validate(name: &str) -> Validity {
+    let mut warnings = Vec::new();
+    let mut errors = Vec::new();
+
+    if name.is_empty() {
+        errors.push("name length must be greater than zero".into());
+    }
+
+    if name.starts_with('.') {
+        errors.push("name cannot start with a period".into());
+    }
+
+    if name.starts_with('_') {
+        errors.push("name cannot start with an underscore".into());
+    }
+
+    if name.trim() != name {
+        errors.push("name cannot contain leading or trailing spaces".into());
+    }
+
+    // No funny business
+    for blacklisted_name in BLACKLIST.iter() {
+        if &name.to_lowercase() == blacklisted_name {
+            errors.push(format!("{} is a blacklisted name", blacklisted_name));
+        }
+    }
+
+    // Generate warnings for stuff that used to be allowed
+
+    for builtin in BUILTINS.iter() {
+        if name.to_lowercase() == *builtin {
+            warnings.push(format!("{} is a core module name", builtin));
+        }
+    }
+
+    // really-long-package-names-------------------------------such--length-----many---wow
+    // the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
+    if name.len() > 214 {
+        warnings.push("name can no longer contain more than 214 characters".into());
+    }
+
+    // mIxeD CaSe nAMEs
+    if name.to_lowercase() != name {
+        warnings.push("name can no longer contain capital letters".into());
+    }
+
+    if name
+        .split('/')
+        .last()
+        .map(|final_part| SPECIAL_CHARS.is_match(final_part))
+        .unwrap_or(false)
+    {
+        warnings.push(r#"name can no longer contain special characters ("~\'!()*")"#.into());
+    }
+
+    if utf8_percent_encode(name, ENCODE_URI_SET).to_string() != name {
+        // Maybe it's a scoped package name, like @user/package
+        if let Some(captures) = SCOPED_PACKAGE.captures(name) {
+            let valid_scope_name = captures
+                .get(1)
+                .map(|scope| scope.as_str())
+                .map(|scope| utf8_percent_encode(scope, ENCODE_URI_SET).to_string() == scope)
+                .unwrap_or(true);
+
+            let valid_package_name = captures
+                .get(2)
+                .map(|package| package.as_str())
+                .map(|package| utf8_percent_encode(package, ENCODE_URI_SET).to_string() == package)
+                .unwrap_or(true);
+
+            if valid_scope_name && valid_package_name {
+                return done(warnings, errors);
+            }
+        }
+
+        errors.push("name can only contain URL-friendly characters".into());
+    }
+
+    done(warnings, errors)
+}
+
+fn done(warnings: Vec<String>, errors: Vec<String>) -> Validity {
+    match (warnings.len(), errors.len()) {
+        (0, 0) => Validity::Valid,
+        (_, 0) => Validity::ValidForOldPackages { warnings },
+        (_, _) => Validity::Invalid { warnings, errors },
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn traditional() {
+        assert_eq!(validate("some-package"), Validity::Valid);
+        assert_eq!(validate("example.com"), Validity::Valid);
+        assert_eq!(validate("under_score"), Validity::Valid);
+        assert_eq!(validate("period.js"), Validity::Valid);
+        assert_eq!(validate("123numeric"), Validity::Valid);
+        assert_eq!(
+            validate("crazy!"),
+            Validity::ValidForOldPackages {
+                warnings: vec![
+                    r#"name can no longer contain special characters ("~\'!()*")"#.into()
+                ]
+            }
+        );
+    }
+
+    #[test]
+    fn scoped() {
+        assert_eq!(validate("@npm/thingy"), Validity::Valid);
+        assert_eq!(
+            validate("@npm-zors/money!time.js"),
+            Validity::ValidForOldPackages {
+                warnings: vec![
+                    r#"name can no longer contain special characters ("~\'!()*")"#.into()
+                ]
+            }
+        );
+    }
+
+    #[test]
+    fn invalid() {
+        assert_eq!(
+            validate(""),
+            Validity::Invalid {
+                errors: vec!["name length must be greater than zero".into()],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate(".start-with-period"),
+            Validity::Invalid {
+                errors: vec!["name cannot start with a period".into()],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate("_start-with-underscore"),
+            Validity::Invalid {
+                errors: vec!["name cannot start with an underscore".into()],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate("contain:colons"),
+            Validity::Invalid {
+                errors: vec!["name can only contain URL-friendly characters".into()],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate(" leading-space"),
+            Validity::Invalid {
+                errors: vec![
+                    "name cannot contain leading or trailing spaces".into(),
+                    "name can only contain URL-friendly characters".into()
+                ],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate("trailing-space "),
+            Validity::Invalid {
+                errors: vec![
+                    "name cannot contain leading or trailing spaces".into(),
+                    "name can only contain URL-friendly characters".into()
+                ],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate("s/l/a/s/h/e/s"),
+            Validity::Invalid {
+                errors: vec!["name can only contain URL-friendly characters".into()],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate("node_modules"),
+            Validity::Invalid {
+                errors: vec!["node_modules is a blacklisted name".into()],
+                warnings: vec![]
+            }
+        );
+
+        assert_eq!(
+            validate("favicon.ico"),
+            Validity::Invalid {
+                errors: vec!["favicon.ico is a blacklisted name".into()],
+                warnings: vec![]
+            }
+        );
+    }
+
+    #[test]
+    fn node_io_core() {
+        assert_eq!(
+            validate("http"),
+            Validity::ValidForOldPackages {
+                warnings: vec!["http is a core module name".into()]
+            }
+        );
+    }
+
+    #[test]
+    fn long_package_names() {
+        let one_too_long = "ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou-";
+        let short_enough = "ifyouwanttogetthesumoftwonumberswherethosetwonumbersarechosenbyfindingthelargestoftwooutofthreenumbersandsquaringthemwhichismultiplyingthembyitselfthenyoushouldinputthreenumbersintothisfunctionanditwilldothatforyou";
+
+        assert_eq!(
+            validate(one_too_long),
+            Validity::ValidForOldPackages {
+                warnings: vec!["name can no longer contain more than 214 characters".into()]
+            }
+        );
+
+        assert_eq!(validate(short_enough), Validity::Valid);
+    }
+
+    #[test]
+    fn legacy_mixed_case() {
+        assert_eq!(
+            validate("CAPITAL-LETTERS"),
+            Validity::ValidForOldPackages {
+                warnings: vec!["name can no longer contain capital letters".into()]
+            }
+        );
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/cli.rs.html b/main/src/volta/cli.rs.html new file mode 100644 index 000000000..cfe0a9f90 --- /dev/null +++ b/main/src/volta/cli.rs.html @@ -0,0 +1,275 @@ +cli.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+
use clap::{builder::styling, ColorChoice, Parser};
+
+use crate::command::{self, Command};
+use volta_core::error::{ExitCode, Fallible};
+use volta_core::session::Session;
+use volta_core::style::{text_width, MAX_WIDTH};
+
+#[derive(Parser)]
+#[command(
+    about = "The JavaScript Launcher ⚡",
+    long_about = "The JavaScript Launcher ⚡
+
+    To install a tool in your toolchain, use `volta install`.
+    To pin your project's runtime or package manager, use `volta pin`.",
+    color = ColorChoice::Auto,
+    disable_version_flag = true,
+    styles = styles(),
+    term_width = text_width().unwrap_or(MAX_WIDTH),
+)]
+pub(crate) struct Volta {
+    #[command(subcommand)]
+    pub(crate) command: Option<Subcommand>,
+
+    /// Enables verbose diagnostics
+    #[arg(long, global = true)]
+    pub(crate) verbose: bool,
+
+    /// Enables trace-level diagnostics.
+    #[arg(long, global = true, requires = "verbose")]
+    pub(crate) very_verbose: bool,
+
+    /// Prevents unnecessary output
+    #[arg(
+        long,
+        global = true,
+        conflicts_with = "verbose",
+        aliases = &["silent"]
+    )]
+    pub(crate) quiet: bool,
+
+    /// Prints the current version of Volta
+    #[arg(short, long)]
+    pub(crate) version: bool,
+}
+
+impl Volta {
+    pub(crate) fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        if self.version {
+            // suffix indicator for dev build
+            if cfg!(debug_assertions) {
+                println!("{}-dev", env!("CARGO_PKG_VERSION"));
+            } else {
+                println!("{}", env!("CARGO_PKG_VERSION"));
+            }
+            Ok(ExitCode::Success)
+        } else if let Some(command) = self.command {
+            command.run(session)
+        } else {
+            Volta::parse_from(["volta", "help"].iter()).run(session)
+        }
+    }
+}
+
+#[derive(clap::Subcommand)]
+pub(crate) enum Subcommand {
+    /// Fetches a tool to the local machine
+    Fetch(command::Fetch),
+
+    /// Installs a tool in your toolchain
+    Install(command::Install),
+
+    /// Uninstalls a tool from your toolchain
+    Uninstall(command::Uninstall),
+
+    /// Pins your project's runtime or package manager
+    Pin(command::Pin),
+
+    /// Displays the current toolchain
+    #[command(alias = "ls")]
+    List(command::List),
+
+    /// Generates Volta completions
+    ///
+    /// By default, completions will be generated for the value of your current shell,
+    /// shell, i.e. the value of `SHELL`. If you set the `<shell>` option, completions
+    /// will be generated for that shell instead.
+    ///
+    /// If you specify a directory, the completions will be written to a file there;
+    /// otherwise, they will be written to `stdout`.
+    #[command(arg_required_else_help = true)]
+    Completions(command::Completions),
+
+    /// Locates the actual binary that will be called by Volta
+    Which(command::Which),
+
+    #[command(long_about = crate::command::r#use::USAGE, hide = true)]
+    Use(command::Use),
+
+    /// Enables Volta for the current user / shell
+    Setup(command::Setup),
+
+    /// Run a command with custom Node, npm, pnpm, and/or Yarn versions
+    Run(command::Run),
+}
+
+impl Subcommand {
+    pub(crate) fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        match self {
+            Subcommand::Fetch(fetch) => fetch.run(session),
+            Subcommand::Install(install) => install.run(session),
+            Subcommand::Uninstall(uninstall) => uninstall.run(session),
+            Subcommand::Pin(pin) => pin.run(session),
+            Subcommand::List(list) => list.run(session),
+            Subcommand::Completions(completions) => completions.run(session),
+            Subcommand::Which(which) => which.run(session),
+            Subcommand::Use(r#use) => r#use.run(session),
+            Subcommand::Setup(setup) => setup.run(session),
+            Subcommand::Run(run) => run.run(session),
+        }
+    }
+}
+
+fn styles() -> styling::Styles {
+    styling::Styles::plain()
+        .header(
+            styling::AnsiColor::Yellow.on_default()
+                | styling::Effects::BOLD
+                | styling::Effects::ITALIC,
+        )
+        .usage(
+            styling::AnsiColor::Yellow.on_default()
+                | styling::Effects::BOLD
+                | styling::Effects::ITALIC,
+        )
+        .literal(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
+        .placeholder(styling::AnsiColor::BrightBlue.on_default())
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/completions.rs.html b/main/src/volta/command/completions.rs.html new file mode 100644 index 000000000..9e64b0d1f --- /dev/null +++ b/main/src/volta/command/completions.rs.html @@ -0,0 +1,159 @@ +completions.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+
use std::path::PathBuf;
+
+use clap::CommandFactory;
+use clap_complete::Shell;
+use log::info;
+
+use volta_core::{
+    error::{Context, ErrorKind, ExitCode, Fallible},
+    session::{ActivityKind, Session},
+    style::{note_prefix, success_prefix},
+};
+
+use crate::command::Command;
+
+#[derive(Debug, clap::Args)]
+pub(crate) struct Completions {
+    /// Shell to generate completions for
+    #[arg(index = 1, ignore_case = true, required = true)]
+    shell: Shell,
+
+    /// File to write generated completions to
+    #[arg(short, long = "output")]
+    out_file: Option<PathBuf>,
+
+    /// Write over an existing file, if any.
+    #[arg(short, long)]
+    force: bool,
+}
+
+impl Command for Completions {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Completions);
+
+        let mut app = crate::cli::Volta::command();
+        let app_name = app.get_name().to_owned();
+        match self.out_file {
+            Some(path) => {
+                if path.is_file() && !self.force {
+                    return Err(ErrorKind::CompletionsOutFileError { path }.into());
+                }
+
+                // The user may have passed a path that does not yet exist. If
+                // so, we create it, informing the user we have done so.
+                if let Some(parent) = path.parent() {
+                    if !parent.is_dir() {
+                        info!(
+                            "{} {} does not exist, creating it",
+                            note_prefix(),
+                            parent.display()
+                        );
+                        std::fs::create_dir_all(parent).with_context(|| {
+                            ErrorKind::CreateDirError {
+                                dir: parent.to_path_buf(),
+                            }
+                        })?;
+                    }
+                }
+
+                let mut file = &std::fs::File::create(&path).with_context(|| {
+                    ErrorKind::CompletionsOutFileError {
+                        path: path.to_path_buf(),
+                    }
+                })?;
+
+                clap_complete::generate(self.shell, &mut app, app_name, &mut file);
+
+                info!(
+                    "{} installed completions to {}",
+                    success_prefix(),
+                    path.display()
+                );
+            }
+            None => clap_complete::generate(self.shell, &mut app, app_name, &mut std::io::stdout()),
+        };
+
+        session.add_event_end(ActivityKind::Completions, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/fetch.rs.html b/main/src/volta/command/fetch.rs.html new file mode 100644 index 000000000..04d262c8a --- /dev/null +++ b/main/src/volta/command/fetch.rs.html @@ -0,0 +1,51 @@ +fetch.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+
use volta_core::error::{ExitCode, Fallible};
+use volta_core::session::{ActivityKind, Session};
+use volta_core::tool;
+
+use crate::command::Command;
+
+#[derive(clap::Args)]
+pub(crate) struct Fetch {
+    /// Tools to fetch, like `node`, `yarn@latest` or `your-package@^14.4.3`.
+    #[arg(value_name = "tool[@version]", required = true)]
+    tools: Vec<String>,
+}
+
+impl Command for Fetch {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Fetch);
+
+        for tool in tool::Spec::from_strings(&self.tools, "fetch")? {
+            tool.resolve(session)?.fetch(session)?;
+        }
+
+        session.add_event_end(ActivityKind::Fetch, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/install.rs.html b/main/src/volta/command/install.rs.html new file mode 100644 index 000000000..b5d1b252c --- /dev/null +++ b/main/src/volta/command/install.rs.html @@ -0,0 +1,51 @@ +install.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+
use volta_core::error::{ExitCode, Fallible};
+use volta_core::session::{ActivityKind, Session};
+use volta_core::tool::Spec;
+
+use crate::command::Command;
+
+#[derive(clap::Args)]
+pub(crate) struct Install {
+    /// Tools to install, like `node`, `yarn@latest` or `your-package@^14.4.3`.
+    #[arg(value_name = "tool[@version]", required = true)]
+    tools: Vec<String>,
+}
+
+impl Command for Install {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Install);
+
+        for tool in Spec::from_strings(&self.tools, "install")? {
+            tool.resolve(session)?.install(session)?;
+        }
+
+        session.add_event_end(ActivityKind::Install, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/list/human.rs.html b/main/src/volta/command/list/human.rs.html new file mode 100644 index 000000000..0da36ecd3 --- /dev/null +++ b/main/src/volta/command/list/human.rs.html @@ -0,0 +1,3267 @@ +human.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+1583
+1584
+1585
+1586
+1587
+1588
+1589
+1590
+1591
+1592
+1593
+1594
+1595
+1596
+1597
+1598
+1599
+1600
+1601
+1602
+1603
+1604
+1605
+1606
+1607
+1608
+1609
+1610
+1611
+1612
+1613
+1614
+1615
+1616
+1617
+1618
+1619
+1620
+1621
+1622
+1623
+1624
+1625
+1626
+1627
+1628
+1629
+1630
+1631
+1632
+1633
+
//! Define the "human" format style for list commands.
+
+use std::collections::BTreeMap;
+
+use super::{Node, Package, PackageManager, PackageManagerKind, Toolchain};
+use once_cell::sync::Lazy;
+use textwrap::{fill, Options};
+use volta_core::style::{text_width, tool_version, MAX_WIDTH};
+
+static INDENTATION: &str = "    ";
+static NO_RUNTIME: &str = "⚡️ No Node runtimes installed!
+
+    You can install a runtime by running `volta install node`. See `volta help install` for
+    details and more options.";
+
+static TEXT_WIDTH: Lazy<usize> = Lazy::new(|| text_width().unwrap_or(MAX_WIDTH));
+
+#[allow(clippy::unnecessary_wraps)] // Needs to match the API of `plain::format`
+pub(super) fn format(toolchain: &Toolchain) -> Option<String> {
+    // Formatting here depends on the toolchain: we do different degrees of
+    // indentation
+    Some(match toolchain {
+        Toolchain::Node(runtimes) => display_node(runtimes),
+        Toolchain::Active {
+            runtime,
+            package_managers,
+            packages,
+        } => display_active(runtime, package_managers, packages),
+        Toolchain::All {
+            runtimes,
+            package_managers,
+            packages,
+        } => display_all(runtimes, package_managers, packages),
+        Toolchain::PackageManagers { kind, managers } => display_package_managers(*kind, managers),
+        Toolchain::Packages(packages) => display_packages(packages),
+        Toolchain::Tool {
+            name,
+            host_packages,
+        } => display_tool(name, host_packages),
+    })
+}
+
+/// Format the output for `Toolchain::Active`.
+///
+/// Accepts the components *from* the toolchain rather than the item itself so
+/// that
+fn display_active(
+    runtime: &Option<Box<Node>>,
+    package_managers: &[PackageManager],
+    packages: &[Package],
+) -> String {
+    match runtime {
+        None => NO_RUNTIME.to_string(),
+        Some(node) => {
+            let runtime_version = wrap(format!("Node: {}", format_runtime(node)));
+
+            let package_manager_versions = if package_managers.is_empty() {
+                String::new()
+            } else {
+                format!(
+                    "\n{}",
+                    format_package_manager_list_condensed(package_managers)
+                )
+            };
+
+            let package_versions = if packages.is_empty() {
+                wrap("Tool binaries available: NONE")
+            } else {
+                wrap(format!(
+                    "Tool binaries available:\n{}",
+                    format_tool_list(packages)
+                ))
+            };
+
+            format!(
+                "⚡️ Currently active tools:\n\n{}{}\n{}\n\n{}",
+                runtime_version,
+                package_manager_versions,
+                package_versions,
+                "See options for more detailed reports by running `volta list --help`."
+            )
+        }
+    }
+}
+
+/// Format the output for `Toolchain::All`.
+fn display_all(
+    runtimes: &[Node],
+    package_managers: &[PackageManager],
+    packages: &[Package],
+) -> String {
+    if runtimes.is_empty() {
+        NO_RUNTIME.to_string()
+    } else {
+        let runtime_versions: String =
+            wrap(format!("Node runtimes:\n{}", format_runtime_list(runtimes)));
+        let package_manager_versions: String = wrap(format!(
+            "Package managers:\n{}",
+            format_package_manager_list_verbose(package_managers)
+        ));
+        let package_versions = wrap(format!("Packages:\n{}", format_package_list(packages)));
+        format!(
+            "⚡️ User toolchain:\n\n{}\n\n{}\n\n{}",
+            runtime_versions, package_manager_versions, package_versions
+        )
+    }
+}
+
+/// Format a set of `Toolchain::Node`s.
+fn display_node(runtimes: &[Node]) -> String {
+    if runtimes.is_empty() {
+        NO_RUNTIME.to_string()
+    } else {
+        format!(
+            "⚡️ Node runtimes in your toolchain:\n\n{}",
+            format_runtime_list(runtimes)
+        )
+    }
+}
+
+/// Format a set of `Toolchain::PackageManager`s for `volta list npm`
+fn display_npms(managers: &[PackageManager]) -> String {
+    if managers.is_empty() {
+        "⚡️ No custom npm versions installed (npm is still available bundled with Node).
+
+You can install an npm version by running `volta install npm`.
+See `volta help install` for details and more options."
+            .into()
+    } else {
+        let versions = wrap(
+            managers
+                .iter()
+                .map(format_package_manager)
+                .collect::<Vec<_>>()
+                .join("\n"),
+        );
+        format!("⚡️ Custom npm versions in your toolchain:\n\n{}", versions)
+    }
+}
+
+/// Format a set of `Toolchain::PackageManager`s.
+fn display_package_managers(kind: PackageManagerKind, managers: &[PackageManager]) -> String {
+    match kind {
+        PackageManagerKind::Npm => display_npms(managers),
+        _ => {
+            if managers.is_empty() {
+                // Note: Using `format_package_manager_kind` to get the properly capitalized version of the tool
+                // Then using the `Display` impl on the kind to get the version to show in the command
+                format!(
+                    "⚡️ No {} versions installed.
+
+You can install a {0} version by running `volta install {}`.
+See `volta help install` for details and more options.",
+                    format_package_manager_kind(kind),
+                    kind
+                )
+            } else {
+                let versions = wrap(
+                    managers
+                        .iter()
+                        .map(format_package_manager)
+                        .collect::<Vec<String>>()
+                        .join("\n"),
+                );
+                format!(
+                    "⚡️ {} versions in your toolchain:\n\n{}",
+                    format_package_manager_kind(kind),
+                    versions
+                )
+            }
+        }
+    }
+}
+
+/// Format a set of `Toolchain::Package`s and their associated tools.
+fn display_packages(packages: &[Package]) -> String {
+    if packages.is_empty() {
+        String::from(
+            "⚡️ No tools or packages installed.
+
+You can safely install packages by running `volta install <package name>`.
+See `volta help install` for details and more options.",
+        )
+    } else {
+        format!(
+            "⚡️ Package versions in your toolchain:\n\n{}",
+            format_package_list(packages)
+        )
+    }
+}
+
+/// Format a single `Toolchain::Tool` with associated `Toolchain::Package`
+
+fn display_tool(tool: &str, host_packages: &[Package]) -> String {
+    if host_packages.is_empty() {
+        format!(
+            "⚡️ No tools or packages named `{}` installed.
+
+You can safely install packages by running `volta install <package name>`.
+See `volta help install` for details and more options.",
+            tool
+        )
+    } else {
+        let versions = wrap(
+            host_packages
+                .iter()
+                .map(format_package)
+                .collect::<Vec<String>>()
+                .join("\n"),
+        );
+        format!("⚡️ Tool `{}` available from:\n\n{}", tool, versions)
+    }
+}
+
+/// Format a list of `Toolchain::Package`s without detail information
+fn format_tool_list(packages: &[Package]) -> String {
+    packages
+        .iter()
+        .map(format_tool)
+        .collect::<Vec<String>>()
+        .join("\n")
+}
+/// Format a single `Toolchain::Package` without detail information
+fn format_tool(package: &Package) -> String {
+    match package {
+        Package::Default { tools, .. } | Package::Project { tools, .. } => {
+            let tools = match tools.len() {
+                0 => String::from(""),
+                _ => tools.join(", "),
+            };
+            wrap(format!("{}{}", tools, list_package_source(package)))
+        }
+        Package::Fetched(..) => String::new(),
+    }
+}
+
+/// format a list of `Toolchain::Node`s.
+fn format_runtime_list(runtimes: &[Node]) -> String {
+    wrap(
+        runtimes
+            .iter()
+            .map(format_runtime)
+            .collect::<Vec<String>>()
+            .join("\n"),
+    )
+}
+
+/// format a single version of `Toolchain::Node`.
+fn format_runtime(runtime: &Node) -> String {
+    format!("v{}{}", runtime.version, runtime.source)
+}
+
+/// format a list of `Toolchain::PackageManager`s in condensed form
+fn format_package_manager_list_condensed(package_managers: &[PackageManager]) -> String {
+    wrap(
+        package_managers
+            .iter()
+            .map(|manager| {
+                format!(
+                    "{}: {}",
+                    format_package_manager_kind(manager.kind),
+                    format_package_manager(manager)
+                )
+            })
+            .collect::<Vec<_>>()
+            .join("\n"),
+    )
+}
+
+/// format a list of `Toolchain::PackageManager`s in verbose form
+fn format_package_manager_list_verbose(package_managers: &[PackageManager]) -> String {
+    let mut manager_lists = BTreeMap::new();
+
+    for manager in package_managers {
+        manager_lists
+            .entry(manager.kind)
+            .or_insert_with(Vec::new)
+            .push(format_package_manager(manager));
+    }
+
+    wrap(
+        manager_lists
+            .iter()
+            .map(|(kind, list)| {
+                format!(
+                    "{}:\n{}",
+                    format_package_manager_kind(*kind),
+                    wrap(list.join("\n"))
+                )
+            })
+            .collect::<Vec<_>>()
+            .join("\n"),
+    )
+}
+
+/// format a single `Toolchain::PackageManager`.
+fn format_package_manager(package_manager: &PackageManager) -> String {
+    format!("v{}{}", package_manager.version, package_manager.source)
+}
+
+/// format the title for a kind of package manager
+///
+/// This is distinct from the `Display` impl, because we need 'Yarn' to be capitalized for human output
+fn format_package_manager_kind(kind: PackageManagerKind) -> String {
+    match kind {
+        PackageManagerKind::Npm => "npm".into(),
+        PackageManagerKind::Pnpm => "pnpm".into(),
+        PackageManagerKind::Yarn => "Yarn".into(),
+    }
+}
+
+/// format a list of `Toolchain::Package`s and their associated tools.
+fn format_package_list(packages: &[Package]) -> String {
+    wrap(
+        packages
+            .iter()
+            .map(format_package)
+            .collect::<Vec<String>>()
+            .join("\n"),
+    )
+}
+
+/// Format a single `Toolchain::Package` and its associated tools.
+fn format_package(package: &Package) -> String {
+    match package {
+        Package::Default {
+            details,
+            node,
+            tools,
+            ..
+        } => {
+            let tools = match tools.len() {
+                0 => String::from(""),
+                _ => tools.join(", "),
+            };
+
+            let version = format!("{}{}", details.version, list_package_source(package));
+            let binaries = wrap(format!("binary tools: {}", tools));
+            let platform_detail = wrap(format!(
+                "runtime: {}\npackage manager: {}",
+                tool_version("node", node),
+                // TODO: Should be updated when we support installing with custom package_managers,
+                // whether Yarn or non-built-in versions of npm
+                "npm@built-in"
+            ));
+            let platform = wrap(format!("platform:\n{}", platform_detail));
+            format!("{}@{}\n{}\n{}", details.name, version, binaries, platform)
+        }
+        Package::Project { name, tools, .. } => {
+            let tools = match tools.len() {
+                0 => String::from(""),
+                _ => tools.join(", "),
+            };
+
+            let binaries = wrap(format!("binary tools: {}", tools));
+            format!("{}{}\n{}", name, list_package_source(package), binaries)
+        }
+        Package::Fetched(details) => {
+            let package_info = format!("{}@{}", details.name, details.version);
+            let footer_message = format!(
+                "To make it available to execute, run `volta install {}`.",
+                package_info
+            );
+            format!("{}\n\n{}", package_info, footer_message)
+        }
+    }
+}
+
+/// List a the source from a `Toolchain::Package`.
+fn list_package_source(package: &Package) -> String {
+    match package {
+        Package::Default { .. } => String::from(" (default)"),
+        Package::Project { path, .. } => format!(" (current @ {})", path.display()),
+        Package::Fetched(..) => String::new(),
+    }
+}
+
+/// Wrap and indent the output
+fn wrap<S>(text: S) -> String
+where
+    S: AsRef<str>,
+{
+    let options = Options::new(*TEXT_WIDTH)
+        .initial_indent(INDENTATION)
+        .subsequent_indent(INDENTATION);
+
+    let mut wrapped = fill(text.as_ref(), options);
+    // The `fill` method in the latest `textwrap` version does not trim the indentation whitespace
+    // from the final line.
+    wrapped.truncate(wrapped.trim_end_matches(INDENTATION).len());
+    wrapped
+}
+
+// These tests are organized by way of the *commands* supplied to `list`, unlike
+// in the `plain` module, because the formatting varies by command here, as it
+// does not there.
+#[cfg(test)]
+mod tests {
+    use std::path::PathBuf;
+
+    use node_semver::Version;
+    use once_cell::sync::Lazy;
+
+    use super::*;
+
+    static NODE_12: Lazy<Version> = Lazy::new(|| Version::from((12, 2, 0)));
+    static NODE_11: Lazy<Version> = Lazy::new(|| Version::from((11, 9, 0)));
+    static NODE_10: Lazy<Version> = Lazy::new(|| Version::from((10, 15, 3)));
+    static YARN_VERSION: Lazy<Version> = Lazy::new(|| Version::from((1, 16, 0)));
+    static NPM_VERSION: Lazy<Version> = Lazy::new(|| Version::from((6, 13, 1)));
+    static PROJECT_PATH: Lazy<PathBuf> = Lazy::new(|| PathBuf::from("~/path/to/project.json"));
+
+    mod active {
+        use super::*;
+        use crate::command::list::{
+            human::display_active, Node, PackageDetails, PackageManager, PackageManagerKind, Source,
+        };
+
+        #[test]
+        fn no_runtimes() {
+            let runtime = None;
+            let package_managers = vec![];
+            let packages = vec![];
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                NO_RUNTIME
+            );
+        }
+
+        #[test]
+        fn runtime_only_default() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_only_project() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (current @ ~/path/to/project.json)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_npm_default() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    npm: v6.13.1 (default)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Source::Default,
+                version: NPM_VERSION.clone(),
+            }];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_yarn_default() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    Yarn: v1.16.0 (default)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Source::Default,
+                version: YARN_VERSION.clone(),
+            }];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_npm_mixed() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    npm: v6.13.1 (current @ ~/path/to/project.json)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NPM_VERSION.clone(),
+            }];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_yarn_mixed() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    Yarn: v1.16.0 (current @ ~/path/to/project.json)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: YARN_VERSION.clone(),
+            }];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_npm_project() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (current @ ~/path/to/project.json)
+    npm: v6.13.1 (current @ ~/path/to/project.json)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NPM_VERSION.clone(),
+            }];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_yarn_project() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (current @ ~/path/to/project.json)
+    Yarn: v1.16.0 (current @ ~/path/to/project.json)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: YARN_VERSION.clone(),
+            }];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_npm_and_yarn_default() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    npm: v6.13.1 (default)
+    Yarn: v1.16.0 (default)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Default,
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Default,
+                    version: YARN_VERSION.clone(),
+                },
+            ];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_npm_and_yarn_project() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (current @ ~/path/to/project.json)
+    npm: v6.13.1 (current @ ~/path/to/project.json)
+    Yarn: v1.16.0 (current @ ~/path/to/project.json)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: YARN_VERSION.clone(),
+                },
+            ];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_npm_and_yarn_mixed() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (default)
+    npm: v6.13.1 (current @ ~/path/to/project.json)
+    Yarn: v1.16.0 (default)
+    Tool binaries available: NONE
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Default,
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Default,
+                    version: YARN_VERSION.clone(),
+                },
+            ];
+            let packages = vec![];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn with_default_tools() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (current @ ~/path/to/project.json)
+    npm: v6.13.1 (current @ ~/path/to/project.json)
+    Yarn: v1.16.0 (current @ ~/path/to/project.json)
+    Tool binaries available:
+        create-react-app (default)
+        tsc, tsserver (default)
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: YARN_VERSION.clone(),
+                },
+            ];
+            let packages = vec![
+                Package::Default {
+                    details: PackageDetails {
+                        name: "create-react-app".to_string(),
+                        version: Version::from((3, 0, 1)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["create-react-app".to_string()],
+                },
+                Package::Default {
+                    details: PackageDetails {
+                        name: "typescript".to_string(),
+                        version: Version::from((3, 4, 3)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["tsc".to_string(), "tsserver".to_string()],
+                },
+            ];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn with_project_tools() {
+            let expected = "⚡️ Currently active tools:
+
+    Node: v12.2.0 (current @ ~/path/to/project.json)
+    npm: v6.13.1 (current @ ~/path/to/project.json)
+    Yarn: v1.16.0 (current @ ~/path/to/project.json)
+    Tool binaries available:
+        create-react-app (current @ ~/path/to/project.json)
+        tsc, tsserver (default)
+
+See options for more detailed reports by running `volta list --help`.";
+
+            let runtime = Some(Box::new(Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }));
+            let package_managers = vec![
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: YARN_VERSION.clone(),
+                },
+            ];
+            let packages = vec![
+                Package::Project {
+                    name: "create-react-app".to_string(),
+                    path: PROJECT_PATH.clone(),
+                    tools: vec!["create-react-app".to_string()],
+                },
+                Package::Default {
+                    details: PackageDetails {
+                        name: "typescript".to_string(),
+                        version: Version::from((3, 4, 3)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["tsc".to_string(), "tsserver".to_string()],
+                },
+            ];
+
+            assert_eq!(
+                display_active(&runtime, &package_managers, &packages),
+                expected
+            );
+        }
+    }
+
+    mod node {
+        use super::super::*;
+        use super::*;
+        use crate::command::list::Source;
+
+        #[test]
+        fn no_runtimes() {
+            let expected = NO_RUNTIME;
+
+            let runtimes = [];
+            assert_eq!(display_node(&runtimes).as_str(), expected);
+        }
+
+        #[test]
+        fn single_default() {
+            let expected = "⚡️ Node runtimes in your toolchain:
+
+    v10.15.3 (default)";
+            let runtimes = [Node {
+                source: Source::Default,
+                version: NODE_10.clone(),
+            }];
+
+            assert_eq!(display_node(&runtimes).as_str(), expected);
+        }
+
+        #[test]
+        fn single_project() {
+            let expected = "⚡️ Node runtimes in your toolchain:
+
+    v12.2.0 (current @ ~/path/to/project.json)";
+
+            let runtimes = [Node {
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NODE_12.clone(),
+            }];
+
+            assert_eq!(display_node(&runtimes).as_str(), expected);
+        }
+
+        #[test]
+        fn single_installed() {
+            let expected = "⚡️ Node runtimes in your toolchain:
+
+    v11.9.0";
+
+            let runtimes = [Node {
+                source: Source::None,
+                version: NODE_11.clone(),
+            }];
+
+            assert_eq!(display_node(&runtimes).as_str(), expected);
+        }
+
+        #[test]
+        fn multi() {
+            let expected = "⚡️ Node runtimes in your toolchain:
+
+    v12.2.0 (current @ ~/path/to/project.json)
+    v11.9.0
+    v10.15.3 (default)";
+
+            let runtimes = [
+                Node {
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NODE_12.clone(),
+                },
+                Node {
+                    source: Source::None,
+                    version: NODE_11.clone(),
+                },
+                Node {
+                    source: Source::Default,
+                    version: NODE_10.clone(),
+                },
+            ];
+
+            assert_eq!(display_node(&runtimes), expected);
+        }
+    }
+
+    mod package_managers {
+        use super::*;
+        use crate::command::list::{PackageManager, PackageManagerKind, Source};
+
+        #[test]
+        fn none_installed_npm() {
+            let expected =
+                "⚡️ No custom npm versions installed (npm is still available bundled with Node).
+
+You can install an npm version by running `volta install npm`.
+See `volta help install` for details and more options.";
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Npm, &[]),
+                expected
+            );
+        }
+
+        #[test]
+        fn none_installed_yarn() {
+            let expected = "⚡️ No Yarn versions installed.
+
+You can install a Yarn version by running `volta install yarn`.
+See `volta help install` for details and more options.";
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Yarn, &[]),
+                expected
+            );
+        }
+
+        #[test]
+        fn single_default_npm() {
+            let expected = "⚡️ Custom npm versions in your toolchain:
+
+    v6.13.1 (default)";
+
+            let package_managers = [PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Source::Default,
+                version: NPM_VERSION.clone(),
+            }];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Npm, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn single_default_yarn() {
+            let expected = "⚡️ Yarn versions in your toolchain:
+
+    v1.16.0 (default)";
+
+            let package_managers = [PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Source::Default,
+                version: YARN_VERSION.clone(),
+            }];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Yarn, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn single_project_npm() {
+            let expected = "⚡️ Custom npm versions in your toolchain:
+
+    v6.13.1 (current @ ~/path/to/project.json)";
+
+            let package_managers = [PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: NPM_VERSION.clone(),
+            }];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Npm, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn single_project_yarn() {
+            let expected = "⚡️ Yarn versions in your toolchain:
+
+    v1.16.0 (current @ ~/path/to/project.json)";
+
+            let package_managers = [PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Source::Project(PROJECT_PATH.clone()),
+                version: YARN_VERSION.clone(),
+            }];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Yarn, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn single_installed_npm() {
+            let expected = "⚡️ Custom npm versions in your toolchain:
+
+    v6.13.1";
+
+            let package_managers = [PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Source::None,
+                version: NPM_VERSION.clone(),
+            }];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Npm, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn single_installed_yarn() {
+            let expected = "⚡️ Yarn versions in your toolchain:
+
+    v1.16.0";
+
+            let package_managers = [PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Source::None,
+                version: YARN_VERSION.clone(),
+            }];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Yarn, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn multi_npm() {
+            let expected = "⚡️ Custom npm versions in your toolchain:
+
+    v5.6.0
+    v6.13.1 (default)
+    v6.14.2 (current @ ~/path/to/project.json)";
+
+            let package_managers = [
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::None,
+                    version: Version::from((5, 6, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Default,
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: Version::from((6, 14, 2)),
+                },
+            ];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Npm, &package_managers),
+                expected
+            );
+        }
+
+        #[test]
+        fn multi_yarn() {
+            let expected = "⚡️ Yarn versions in your toolchain:
+
+    v1.3.0
+    v1.16.0 (default)
+    v1.17.0 (current @ ~/path/to/project.json)";
+
+            let package_managers = [
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::None,
+                    version: Version::from((1, 3, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Default,
+                    version: YARN_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: Version::from((1, 17, 0)),
+                },
+            ];
+
+            assert_eq!(
+                display_package_managers(PackageManagerKind::Yarn, &package_managers),
+                expected
+            );
+        }
+    }
+
+    mod packages {
+        use super::*;
+        use crate::command::list::{Package, PackageDetails};
+        use node_semver::Version;
+
+        #[test]
+        fn none() {
+            let expected = "⚡️ No tools or packages installed.
+
+You can safely install packages by running `volta install <package name>`.
+See `volta help install` for details and more options.";
+
+            assert_eq!(display_packages(&[]), expected);
+        }
+
+        #[test]
+        fn single_default() {
+            let expected = "⚡️ Package versions in your toolchain:
+
+    ember-cli@3.10.1 (default)
+        binary tools: ember
+        platform:
+            runtime: node@12.2.0
+            package manager: npm@built-in";
+
+            let packages = [Package::Default {
+                details: PackageDetails {
+                    name: "ember-cli".to_string(),
+                    version: Version::from((3, 10, 1)),
+                },
+                node: NODE_12.clone(),
+                tools: vec!["ember".to_string()],
+            }];
+
+            assert_eq!(display_packages(&packages), expected);
+        }
+
+        #[test]
+        fn single_project() {
+            let expected = "⚡️ Package versions in your toolchain:
+
+    ember-cli (current @ ~/path/to/project.json)
+        binary tools: ember";
+
+            let packages = [Package::Project {
+                name: "ember-cli".to_string(),
+                path: PROJECT_PATH.clone(),
+                tools: vec!["ember".to_string()],
+            }];
+
+            assert_eq!(display_packages(&packages), expected);
+        }
+
+        #[test]
+        fn single_fetched() {
+            let expected = "⚡️ Package versions in your toolchain:
+
+    ember-cli@3.10.1
+    
+    To make it available to execute, run `volta install ember-cli@3.10.1`.";
+
+            let packages = [Package::Fetched(PackageDetails {
+                name: "ember-cli".to_string(),
+                version: Version::from((3, 10, 1)),
+            })];
+
+            assert_eq!(display_packages(&packages), expected);
+        }
+
+        #[test]
+        fn multi_fetched() {
+            let expected = "⚡️ Package versions in your toolchain:
+
+    ember-cli@3.10.1
+    
+    To make it available to execute, run `volta install ember-cli@3.10.1`.
+    ember-cli@3.8.2
+    
+    To make it available to execute, run `volta install ember-cli@3.8.2`.";
+
+            let packages = [
+                Package::Fetched(PackageDetails {
+                    name: "ember-cli".to_string(),
+                    version: Version::from((3, 10, 1)),
+                }),
+                Package::Fetched(PackageDetails {
+                    name: "ember-cli".to_string(),
+                    version: Version::from((3, 8, 2)),
+                }),
+            ];
+
+            assert_eq!(display_packages(&packages), expected);
+        }
+
+        #[test]
+        fn multi() {
+            let expected = "⚡️ Package versions in your toolchain:
+
+    ember-cli@3.10.1 (default)
+        binary tools: ember
+        platform:
+            runtime: node@12.2.0
+            package manager: npm@built-in
+    ember-cli (current @ ~/path/to/project.json)
+        binary tools: ember";
+
+            let packages = [
+                Package::Default {
+                    details: PackageDetails {
+                        name: "ember-cli".to_string(),
+                        version: Version::from((3, 10, 1)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["ember".to_string()],
+                },
+                Package::Project {
+                    name: "ember-cli".to_string(),
+                    path: PROJECT_PATH.clone(),
+                    tools: vec!["ember".to_string()],
+                },
+            ];
+
+            assert_eq!(display_packages(&packages), expected);
+        }
+    }
+
+    mod tools {
+        use super::*;
+        use crate::command::list::{Package, PackageDetails};
+        use node_semver::Version;
+
+        #[test]
+        fn none() {
+            let expected = "⚡️ No tools or packages named `ember` installed.
+
+You can safely install packages by running `volta install <package name>`.
+See `volta help install` for details and more options.";
+
+            assert_eq!(display_tool("ember", &[]), expected);
+        }
+
+        #[test]
+        fn single_default() {
+            let expected = "⚡️ Tool `ember` available from:
+
+    ember-cli@3.10.1 (default)
+        binary tools: ember
+        platform:
+            runtime: node@12.2.0
+            package manager: npm@built-in";
+
+            let packages = [Package::Default {
+                details: PackageDetails {
+                    name: "ember-cli".to_string(),
+                    version: Version::from((3, 10, 1)),
+                },
+                node: NODE_12.clone(),
+                tools: vec!["ember".to_string()],
+            }];
+
+            assert_eq!(display_tool("ember", &packages), expected);
+        }
+
+        #[test]
+        fn single_project() {
+            let expected = "⚡️ Tool `ember` available from:
+
+    ember-cli (current @ ~/path/to/project.json)
+        binary tools: ember";
+
+            let packages = [Package::Project {
+                name: "ember-cli".to_string(),
+                path: PROJECT_PATH.clone(),
+                tools: vec!["ember".to_string()],
+            }];
+
+            assert_eq!(display_tool("ember", &packages), expected);
+        }
+
+        #[test]
+        fn single_fetched() {
+            let expected = "⚡️ Tool `ember` available from:
+
+    ember-cli@3.10.1
+    
+    To make it available to execute, run `volta install ember-cli@3.10.1`.";
+
+            let packages = [Package::Fetched(PackageDetails {
+                name: "ember-cli".to_string(),
+                version: Version::from((3, 10, 1)),
+            })];
+
+            assert_eq!(display_tool("ember", &packages), expected);
+        }
+
+        #[test]
+        fn multi_fetched() {
+            let expected = "⚡️ Tool `ember` available from:
+
+    ember-cli@3.10.1
+    
+    To make it available to execute, run `volta install ember-cli@3.10.1`.
+    ember-cli@3.8.2
+    
+    To make it available to execute, run `volta install ember-cli@3.8.2`.";
+
+            let packages = [
+                Package::Fetched(PackageDetails {
+                    name: "ember-cli".to_string(),
+                    version: Version::from((3, 10, 1)),
+                }),
+                Package::Fetched(PackageDetails {
+                    name: "ember-cli".to_string(),
+                    version: Version::from((3, 8, 2)),
+                }),
+            ];
+
+            assert_eq!(display_tool("ember", &packages), expected);
+        }
+
+        #[test]
+        fn multi() {
+            let expected = "⚡️ Tool `ember` available from:
+
+    ember-cli@3.10.1 (default)
+        binary tools: ember
+        platform:
+            runtime: node@12.2.0
+            package manager: npm@built-in
+    ember-cli (current @ ~/path/to/project.json)
+        binary tools: ember";
+
+            let packages = [
+                Package::Default {
+                    details: PackageDetails {
+                        name: "ember-cli".to_string(),
+                        version: Version::from((3, 10, 1)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["ember".to_string()],
+                },
+                Package::Project {
+                    name: "ember-cli".to_string(),
+                    path: PROJECT_PATH.clone(),
+                    tools: vec!["ember".to_string()],
+                },
+            ];
+
+            assert_eq!(display_tool("ember", &packages), expected);
+        }
+    }
+
+    mod all {
+        use super::*;
+        use crate::command::list::{PackageDetails, PackageManagerKind, Source};
+
+        #[test]
+        fn empty() {
+            let runtimes = [];
+            let package_managers = [];
+            let packages = [];
+
+            assert_eq!(
+                display_all(&runtimes, &package_managers, &packages),
+                NO_RUNTIME
+            );
+        }
+
+        #[test]
+        fn runtime_and_npm() {
+            let expected = "⚡️ User toolchain:
+
+    Node runtimes:
+        v12.2.0 (current @ ~/path/to/project.json)
+        v11.9.0
+        v10.15.3 (default)
+
+    Package managers:
+        npm:
+            v6.13.1 (default)
+            v6.12.0 (current @ ~/path/to/project.json)
+            v5.6.0
+
+    Packages:
+";
+
+            let runtimes = [
+                Node {
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NODE_12.clone(),
+                },
+                Node {
+                    source: Source::None,
+                    version: NODE_11.clone(),
+                },
+                Node {
+                    source: Source::Default,
+                    version: NODE_10.clone(),
+                },
+            ];
+
+            let package_managers = [
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Default,
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: Version::from((6, 12, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::None,
+                    version: Version::from((5, 6, 0)),
+                },
+            ];
+
+            let packages = vec![];
+            assert_eq!(
+                display_all(&runtimes, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn runtime_and_yarn() {
+            let expected = "⚡️ User toolchain:
+
+    Node runtimes:
+        v12.2.0 (current @ ~/path/to/project.json)
+        v11.9.0
+        v10.15.3 (default)
+
+    Package managers:
+        Yarn:
+            v1.16.0 (default)
+            v1.17.0 (current @ ~/path/to/project.json)
+            v1.4.0
+
+    Packages:
+";
+
+            let runtimes = [
+                Node {
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NODE_12.clone(),
+                },
+                Node {
+                    source: Source::None,
+                    version: NODE_11.clone(),
+                },
+                Node {
+                    source: Source::Default,
+                    version: NODE_10.clone(),
+                },
+            ];
+
+            let package_managers = [
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Default,
+                    version: YARN_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: Version::from((1, 17, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::None,
+                    version: Version::from((1, 4, 0)),
+                },
+            ];
+
+            let packages = vec![];
+            assert_eq!(
+                display_all(&runtimes, &package_managers, &packages),
+                expected
+            );
+        }
+
+        #[test]
+        fn full() {
+            let expected = "⚡️ User toolchain:
+
+    Node runtimes:
+        v12.2.0 (current @ ~/path/to/project.json)
+        v11.9.0
+        v10.15.3 (default)
+
+    Package managers:
+        npm:
+            v6.13.1 (default)
+            v6.12.0 (current @ ~/path/to/project.json)
+            v5.6.0
+        Yarn:
+            v1.16.0 (default)
+            v1.17.0 (current @ ~/path/to/project.json)
+            v1.4.0
+
+    Packages:
+        typescript@3.4.3 (default)
+            binary tools: tsc, tsserver
+            platform:
+                runtime: node@12.2.0
+                package manager: npm@built-in
+        typescript (current @ ~/path/to/project.json)
+            binary tools: tsc, tsserver
+        ember-cli (current @ ~/path/to/project.json)
+            binary tools: ember
+        ember-cli@3.8.2 (default)
+            binary tools: ember
+            platform:
+                runtime: node@12.2.0
+                package manager: npm@built-in";
+
+            let runtimes = [
+                Node {
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NODE_12.clone(),
+                },
+                Node {
+                    source: Source::None,
+                    version: NODE_11.clone(),
+                },
+                Node {
+                    source: Source::Default,
+                    version: NODE_10.clone(),
+                },
+            ];
+
+            let package_managers = [
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Default,
+                    version: NPM_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: Version::from((6, 12, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::None,
+                    version: Version::from((5, 6, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Default,
+                    version: YARN_VERSION.clone(),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: Version::from((1, 17, 0)),
+                },
+                PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::None,
+                    version: Version::from((1, 4, 0)),
+                },
+            ];
+
+            let packages = [
+                Package::Default {
+                    details: PackageDetails {
+                        name: "typescript".to_string(),
+                        version: Version::from((3, 4, 3)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["tsc".to_string(), "tsserver".to_string()],
+                },
+                Package::Project {
+                    name: "typescript".to_string(),
+                    path: PROJECT_PATH.clone(),
+                    tools: vec!["tsc".to_string(), "tsserver".to_string()],
+                },
+                Package::Project {
+                    name: "ember-cli".to_string(),
+                    path: PROJECT_PATH.clone(),
+                    tools: vec!["ember".to_string()],
+                },
+                Package::Default {
+                    details: PackageDetails {
+                        name: "ember-cli".to_string(),
+                        version: Version::from((3, 8, 2)),
+                    },
+                    node: NODE_12.clone(),
+                    tools: vec!["ember".to_string()],
+                },
+            ];
+            assert_eq!(
+                display_all(&runtimes, &package_managers, &packages),
+                expected
+            );
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/list/mod.rs.html b/main/src/volta/command/list/mod.rs.html new file mode 100644 index 000000000..5993909c2 --- /dev/null +++ b/main/src/volta/command/list/mod.rs.html @@ -0,0 +1,603 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+
mod human;
+mod plain;
+mod toolchain;
+
+use std::io::IsTerminal as _;
+use std::{fmt, path::PathBuf, str::FromStr};
+
+use node_semver::Version;
+
+use crate::command::Command;
+use toolchain::Toolchain;
+use volta_core::error::{ExitCode, Fallible};
+use volta_core::inventory::package_configs;
+use volta_core::project::Project;
+use volta_core::session::{ActivityKind, Session};
+use volta_core::tool::PackageConfig;
+
+#[derive(clap::ValueEnum, Copy, Clone)]
+enum Format {
+    Human,
+    Plain,
+}
+
+/// The source of a given item, from the perspective of a user.
+///
+/// Note: this is distinct from `volta_core::platform::sourced::Source`, which
+/// represents the source only of a `Platform`, which is a composite structure.
+/// By contrast, this `Source` is concerned *only* with a single item.
+#[derive(Clone, PartialEq, Debug)]
+enum Source {
+    /// The item is from a project. The wrapped `PathBuf` is the path to the
+    /// project's `package.json`.
+    Project(PathBuf),
+
+    /// The item is the user's default.
+    Default,
+
+    /// The item is one that has been *fetched* but is not *installed* anywhere.
+    None,
+}
+
+impl Source {
+    fn allowed_with(&self, filter: &Filter) -> bool {
+        match filter {
+            Filter::Default => self == &Source::Default,
+            Filter::Current => matches!(self, Source::Default | Source::Project(_)),
+            Filter::None => true,
+        }
+    }
+}
+
+impl fmt::Display for Source {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(
+            f,
+            "{}",
+            match self {
+                Source::Project(path) => format!(" (current @ {})", path.display()),
+                Source::Default => String::from(" (default)"),
+                Source::None => String::from(""),
+            }
+        )
+    }
+}
+
+/// A package and its associated tools, for displaying to the user as part of
+/// their toolchain.
+struct PackageDetails {
+    /// The name of the package.
+    pub name: String,
+    /// The package's own version.
+    pub version: Version,
+}
+
+enum Package {
+    Default {
+        details: PackageDetails,
+        /// The version of Node the package is installed against.
+        node: Version,
+        /// The names of the tools associated with the package.
+        tools: Vec<String>,
+    },
+    Project {
+        name: String,
+        /// The names of the tools associated with the package.
+        tools: Vec<String>,
+        path: PathBuf,
+    },
+    Fetched(PackageDetails),
+}
+
+impl Package {
+    fn new(config: &PackageConfig, source: &Source) -> Package {
+        let details = PackageDetails {
+            name: config.name.clone(),
+            version: config.version.clone(),
+        };
+
+        match source {
+            Source::Default => Package::Default {
+                details,
+                node: config.platform.node.clone(),
+                tools: config.bins.clone(),
+            },
+            Source::Project(path) => Package::Project {
+                name: details.name,
+                tools: config.bins.clone(),
+                path: path.clone(),
+            },
+            Source::None => Package::Fetched(details),
+        }
+    }
+
+    fn from_inventory_and_project(project: Option<&Project>) -> Fallible<Vec<Package>> {
+        package_configs().map(|configs| {
+            configs
+                .iter()
+                .map(|config| {
+                    let source = Self::source(&config.name, project);
+                    Package::new(config, &source)
+                })
+                .collect()
+        })
+    }
+
+    fn source(name: &str, project: Option<&Project>) -> Source {
+        match project {
+            Some(project) if project.has_direct_dependency(name) => {
+                Source::Project(project.manifest_file().to_owned())
+            }
+            _ => Source::Default,
+        }
+    }
+}
+
+#[derive(Clone)]
+struct Node {
+    pub source: Source,
+    pub version: Version,
+}
+
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+enum PackageManagerKind {
+    Npm,
+    Pnpm,
+    Yarn,
+}
+
+impl fmt::Display for PackageManagerKind {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(
+            f,
+            "{}",
+            match self {
+                PackageManagerKind::Npm => "npm",
+                PackageManagerKind::Pnpm => "pnpm",
+                PackageManagerKind::Yarn => "yarn",
+            }
+        )
+    }
+}
+
+#[derive(Clone)]
+struct PackageManager {
+    kind: PackageManagerKind,
+    source: Source,
+    version: Version,
+}
+
+/// How (if at all) should the list query be narrowed?
+enum Filter {
+    /// Display only the currently active tool(s).
+    ///
+    /// For example, if the user queries `volta list --current yarn`, show only
+    /// the version of Yarn currently in use: project, default, or none.
+    Current,
+
+    /// Show only the user's default tool(s).
+    ///
+    /// For example, if the user queries `volta list --default node`, show only
+    /// the user's default Node version.
+    Default,
+
+    /// Do not filter at all. Show all tool(s) matching the query.
+    None,
+}
+
+#[derive(clap::Args)]
+pub(crate) struct List {
+    /// The tool to lookup - `all`, `node`, `npm`, `yarn`, `pnpm`, or the name
+    /// of a package or binary.
+    #[arg(value_name = "tool")]
+    subcommand: Option<Subcommand>,
+
+    /// Specify the output format.
+    ///
+    /// Defaults to `human` for TTYs, `plain` otherwise.
+    #[arg(long)]
+    format: Option<Format>,
+
+    /// Show the currently-active tool(s).
+    ///
+    /// Equivalent to `volta list` when not specifying a specific tool.
+    #[arg(short, long, conflicts_with = "default")]
+    current: bool,
+
+    /// Show your default tool(s).
+    #[arg(short, long, conflicts_with = "current")]
+    default: bool,
+}
+
+/// Which tool should we look up?
+#[derive(Clone)]
+enum Subcommand {
+    /// Show every item in the toolchain.
+    All,
+
+    /// Show locally cached Node versions.
+    Node,
+
+    /// Show locally cached npm versions.
+    Npm,
+
+    /// Show locally cached pnpm versions.
+    Pnpm,
+
+    /// Show locally cached Yarn versions.
+    Yarn,
+
+    /// Show locally cached versions of a package or a package binary.
+    PackageOrTool { name: String },
+}
+
+impl FromStr for Subcommand {
+    type Err = std::convert::Infallible;
+
+    fn from_str(s: &str) -> Result<Self, Self::Err> {
+        Ok(match s {
+            "all" => Subcommand::All,
+            "node" => Subcommand::Node,
+            "npm" => Subcommand::Npm,
+            "pnpm" => Subcommand::Pnpm,
+            "yarn" => Subcommand::Yarn,
+            s => Subcommand::PackageOrTool { name: s.into() },
+        })
+    }
+}
+
+impl List {
+    fn output_format(&self) -> Format {
+        // We start by checking if the user has explicitly set a value: if they
+        // have, that trumps our TTY-checking. Then, if the user has *not*
+        // specified an option, we use `Human` mode for TTYs and `Plain` for
+        // non-TTY contexts.
+        self.format.unwrap_or(if std::io::stdout().is_terminal() {
+            Format::Human
+        } else {
+            Format::Plain
+        })
+    }
+}
+
+impl Command for List {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::List);
+
+        let project = session.project()?;
+        let default_platform = session.default_platform()?;
+        let format = match self.output_format() {
+            Format::Human => human::format,
+            Format::Plain => plain::format,
+        };
+
+        let filter = match (self.current, self.default) {
+            (true, false) => Filter::Current,
+            (false, true) => Filter::Default,
+            (true, true) => unreachable!("simultaneous `current` and `default` forbidden by clap"),
+            _ => Filter::None,
+        };
+
+        let toolchain = match self.subcommand {
+            // For no subcommand, show the user's current toolchain
+            None => Toolchain::active(project, default_platform)?,
+            Some(Subcommand::All) => Toolchain::all(project, default_platform)?,
+            Some(Subcommand::Node) => Toolchain::node(project, default_platform, &filter)?,
+            Some(Subcommand::Npm) => Toolchain::npm(project, default_platform, &filter)?,
+            Some(Subcommand::Pnpm) => Toolchain::pnpm(project, default_platform, &filter)?,
+            Some(Subcommand::Yarn) => Toolchain::yarn(project, default_platform, &filter)?,
+            Some(Subcommand::PackageOrTool { name }) => {
+                Toolchain::package_or_tool(&name, project, &filter)?
+            }
+        };
+
+        if let Some(string) = format(&toolchain) {
+            println!("{}", string)
+        };
+
+        session.add_event_end(ActivityKind::List, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/list/plain.rs.html b/main/src/volta/command/list/plain.rs.html new file mode 100644 index 000000000..a01475255 --- /dev/null +++ b/main/src/volta/command/list/plain.rs.html @@ -0,0 +1,1107 @@ +plain.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+
//! Define the "plain" format style for list commands.
+
+use node_semver::Version;
+
+use volta_core::style::tool_version;
+
+use super::{Node, Package, PackageManager, Source, Toolchain};
+
+pub(super) fn format(toolchain: &Toolchain) -> Option<String> {
+    let (runtimes, package_managers, packages) = match toolchain {
+        Toolchain::Node(runtimes) => (describe_runtimes(runtimes), None, None),
+        Toolchain::PackageManagers { managers, .. } => {
+            (None, describe_package_managers(managers), None)
+        }
+        Toolchain::Packages(packages) => (None, None, describe_packages(packages)),
+        Toolchain::Tool {
+            name,
+            host_packages,
+        } => (None, None, Some(describe_tool_set(name, host_packages))),
+        Toolchain::Active {
+            runtime,
+            package_managers,
+            packages,
+        } => (
+            runtime
+                .as_ref()
+                .and_then(|r| describe_runtimes(&[(**r).clone()])),
+            describe_package_managers(package_managers),
+            describe_packages(packages),
+        ),
+        Toolchain::All {
+            runtimes,
+            package_managers,
+            packages,
+        } => (
+            describe_runtimes(runtimes),
+            describe_package_managers(package_managers),
+            describe_packages(packages),
+        ),
+    };
+
+    match (runtimes, package_managers, packages) {
+        (Some(runtimes), Some(package_managers), Some(packages)) => {
+            Some(format!("{}\n{}\n{}", runtimes, package_managers, packages))
+        }
+        (Some(runtimes), Some(package_managers), None) => {
+            Some(format!("{}\n{}", runtimes, package_managers))
+        }
+        (Some(runtimes), None, Some(packages)) => Some(format!("{}\n{}", runtimes, packages)),
+        (Some(runtimes), None, None) => Some(runtimes),
+        (None, Some(package_managers), Some(packages)) => {
+            Some(format!("{}\n{}", package_managers, packages))
+        }
+        (None, Some(package_managers), None) => Some(package_managers),
+        (None, None, Some(packages)) => Some(packages),
+        (None, None, None) => None,
+    }
+}
+
+fn describe_runtimes(runtimes: &[Node]) -> Option<String> {
+    if runtimes.is_empty() {
+        None
+    } else {
+        Some(
+            runtimes
+                .iter()
+                .map(|runtime| display_node(&runtime.source, &runtime.version))
+                .collect::<Vec<String>>()
+                .join("\n"),
+        )
+    }
+}
+
+fn describe_package_managers(package_managers: &[PackageManager]) -> Option<String> {
+    if package_managers.is_empty() {
+        None
+    } else {
+        Some(
+            package_managers
+                .iter()
+                .map(display_package_manager)
+                .collect::<Vec<String>>()
+                .join("\n"),
+        )
+    }
+}
+
+fn describe_packages(packages: &[Package]) -> Option<String> {
+    if packages.is_empty() {
+        None
+    } else {
+        Some(
+            packages
+                .iter()
+                .map(display_package)
+                .collect::<Vec<String>>()
+                .join("\n"),
+        )
+    }
+}
+
+fn describe_tool_set(name: &str, hosts: &[Package]) -> String {
+    hosts
+        .iter()
+        .filter_map(|package| display_tool(name, package))
+        .collect::<Vec<String>>()
+        .join("\n")
+}
+
+fn display_node(source: &Source, version: &Version) -> String {
+    format!("runtime {}{}", tool_version("node", version), source)
+}
+
+fn display_package_manager(package_manager: &PackageManager) -> String {
+    format!(
+        "package-manager {}{}",
+        tool_version(package_manager.kind, &package_manager.version),
+        package_manager.source
+    )
+}
+
+fn package_source(package: &Package) -> String {
+    match package {
+        Package::Default { .. } => String::from(" (default)"),
+        Package::Project { path, .. } => format!(" (current @ {})", path.display()),
+        Package::Fetched(..) => String::new(),
+    }
+}
+
+fn display_package(package: &Package) -> String {
+    match package {
+        Package::Default {
+            details,
+            node,
+            tools,
+            ..
+        } => {
+            let tools = match tools.len() {
+                0 => String::from(" "),
+                _ => format!(" {} ", tools.join(", ")),
+            };
+
+            format!(
+                "package {} /{}/ {} {}{}",
+                tool_version(&details.name, &details.version),
+                tools,
+                tool_version("node", node),
+                // Should be updated when we support installing with custom package_managers,
+                // whether Yarn or non-built-in versions of npm
+                "npm@built-in",
+                package_source(package)
+            )
+        }
+        Package::Project { name, tools, .. } => {
+            let tools = match tools.len() {
+                0 => String::from(" "),
+                _ => format!(" {} ", tools.join(", ")),
+            };
+
+            format!(
+                "package {} /{}/ {} {}{}",
+                tool_version(name, "project"),
+                tools,
+                "node@project",
+                "npm@project",
+                package_source(package)
+            )
+        }
+        Package::Fetched(details) => format!(
+            "package {} (fetched)",
+            tool_version(&details.name, &details.version)
+        ),
+    }
+}
+
+fn display_tool(name: &str, host: &Package) -> Option<String> {
+    match host {
+        Package::Default { details, node, .. } => Some(format!(
+            "tool {} / {} / {} {}{}",
+            name,
+            tool_version(&details.name, &details.version),
+            tool_version("node", node),
+            "npm@built-in",
+            package_source(host)
+        )),
+        Package::Project {
+            name: host_name, ..
+        } => Some(format!(
+            "tool {} / {} / {} {}{}",
+            name,
+            tool_version(host_name, "project"),
+            "node@project",
+            "npm@project",
+            package_source(host)
+        )),
+        Package::Fetched(..) => None,
+    }
+}
+
+// These tests are organized by way of the *item* being printed, unlike in the
+// `human` module, because the formatting is consistent across command formats.
+#[cfg(test)]
+mod tests {
+    use std::path::PathBuf;
+
+    use node_semver::Version;
+    use once_cell::sync::Lazy;
+
+    use crate::command::list::PackageDetails;
+
+    static NODE_VERSION: Lazy<Version> = Lazy::new(|| Version::from((12, 4, 0)));
+    static TYPESCRIPT_VERSION: Lazy<Version> = Lazy::new(|| Version::from((3, 4, 1)));
+    static NPM_VERSION: Lazy<Version> = Lazy::new(|| Version::from((6, 13, 4)));
+    static YARN_VERSION: Lazy<Version> = Lazy::new(|| Version::from((1, 16, 0)));
+    static PROJECT_PATH: Lazy<PathBuf> = Lazy::new(|| PathBuf::from("/a/b/c"));
+
+    mod node {
+        use super::super::*;
+        use super::*;
+
+        #[test]
+        fn default() {
+            let source = Source::Default;
+            assert_eq!(
+                display_node(&source, &NODE_VERSION).as_str(),
+                "runtime node@12.4.0 (default)"
+            );
+        }
+
+        #[test]
+        fn project() {
+            let source = Source::Project(PROJECT_PATH.clone());
+            assert_eq!(
+                display_node(&source, &NODE_VERSION).as_str(),
+                "runtime node@12.4.0 (current @ /a/b/c)"
+            );
+        }
+
+        #[test]
+        fn installed_not_set() {
+            let source = Source::None;
+            assert_eq!(
+                display_node(&source, &NODE_VERSION).as_str(),
+                "runtime node@12.4.0"
+            );
+        }
+    }
+
+    mod npm {
+        use super::super::*;
+        use super::*;
+        use crate::command::list::*;
+
+        #[test]
+        fn default() {
+            assert_eq!(
+                display_package_manager(&PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Default,
+                    version: NPM_VERSION.clone(),
+                })
+                .as_str(),
+                "package-manager npm@6.13.4 (default)"
+            );
+        }
+
+        #[test]
+        fn project() {
+            assert_eq!(
+                display_package_manager(&PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: NPM_VERSION.clone(),
+                })
+                .as_str(),
+                "package-manager npm@6.13.4 (current @ /a/b/c)"
+            );
+        }
+
+        #[test]
+        fn installed_not_set() {
+            assert_eq!(
+                display_package_manager(&PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source: Source::None,
+                    version: NPM_VERSION.clone(),
+                })
+                .as_str(),
+                "package-manager npm@6.13.4"
+            );
+        }
+    }
+
+    mod yarn {
+        use super::super::*;
+        use super::*;
+        use crate::command::list::*;
+
+        #[test]
+        fn default() {
+            assert_eq!(
+                display_package_manager(&PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Default,
+                    version: YARN_VERSION.clone(),
+                })
+                .as_str(),
+                "package-manager yarn@1.16.0 (default)"
+            );
+        }
+
+        #[test]
+        fn project() {
+            assert_eq!(
+                display_package_manager(&PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::Project(PROJECT_PATH.clone()),
+                    version: YARN_VERSION.clone()
+                })
+                .as_str(),
+                "package-manager yarn@1.16.0 (current @ /a/b/c)"
+            );
+        }
+
+        #[test]
+        fn installed_not_set() {
+            assert_eq!(
+                display_package_manager(&PackageManager {
+                    kind: PackageManagerKind::Yarn,
+                    source: Source::None,
+                    version: YARN_VERSION.clone()
+                })
+                .as_str(),
+                "package-manager yarn@1.16.0"
+            );
+        }
+    }
+
+    mod package {
+        use super::super::*;
+        use super::*;
+
+        #[test]
+        fn single_default() {
+            assert_eq!(
+                describe_packages(&[Package::Default {
+                    details: PackageDetails {
+                        name: "typescript".into(),
+                        version: TYPESCRIPT_VERSION.clone(),
+                    },
+                    node: NODE_VERSION.clone(),
+                    tools: vec!["tsc".into(), "tsserver".into()]
+                }])
+                .expect("Should always return a `String` if given a non-empty set")
+                .as_str(),
+                "package typescript@3.4.1 / tsc, tsserver / node@12.4.0 npm@built-in (default)"
+            );
+        }
+
+        #[test]
+        fn single_project() {
+            assert_eq!(
+                describe_packages(&[Package::Project {
+                    name: "typescript".into(),
+                    path: PROJECT_PATH.clone(),
+                    tools: vec!["tsc".into(), "tsserver".into()]
+                }])
+                .expect("Should always return a `String` if given a non-empty set")
+                .as_str(),
+                "package typescript@project / tsc, tsserver / node@project npm@project (current @ /a/b/c)"
+            );
+        }
+
+        #[test]
+        fn mixed() {
+            assert_eq!(
+                describe_packages(&[
+                    Package::Project {
+                        name: "typescript".into(),
+                        path: PROJECT_PATH.clone(),
+                        tools: vec!["tsc".into(), "tsserver".into()]
+                    },
+                    Package::Default {
+                        details: PackageDetails {
+                            name: "ember-cli".into(),
+                            version: Version::from((3, 10, 0)),
+                        },
+                        node: NODE_VERSION.clone(),
+                        tools: vec!["ember".into()],
+                    },
+                    Package::Fetched(PackageDetails {
+                        name: "create-react-app".into(),
+                        version: Version::from((1, 0, 0)),
+                    })
+                ])
+                .expect("Should always return a `String` if given a non-empty set")
+                .as_str(),
+                "package typescript@project / tsc, tsserver / node@project npm@project (current @ /a/b/c)\n\
+                 package ember-cli@3.10.0 / ember / node@12.4.0 npm@built-in (default)\n\
+                 package create-react-app@1.0.0 (fetched)"
+            );
+        }
+
+        #[test]
+        fn installed_not_set() {
+            assert_eq!(
+                describe_packages(&[Package::Fetched(PackageDetails {
+                    name: "typescript".into(),
+                    version: TYPESCRIPT_VERSION.clone(),
+                })])
+                .expect("Should always return a `String` if given a non-empty set")
+                .as_str(),
+                "package typescript@3.4.1 (fetched)"
+            );
+        }
+    }
+
+    mod tool {
+        use super::super::*;
+        use super::*;
+
+        #[test]
+        fn default() {
+            assert_eq!(
+                display_tool(
+                    "tsc",
+                    &Package::Default {
+                        details: PackageDetails {
+                            name: "typescript".into(),
+                            version: TYPESCRIPT_VERSION.clone(),
+                        },
+                        node: NODE_VERSION.clone(),
+                        tools: vec!["tsc".into(), "tsserver".into()],
+                    }
+                )
+                .expect("should always return `Some` for `Default`")
+                .as_str(),
+                "tool tsc / typescript@3.4.1 / node@12.4.0 npm@built-in (default)"
+            );
+        }
+
+        #[test]
+        fn project() {
+            assert_eq!(
+                display_tool(
+                    "tsc",
+                    &Package::Project {
+                        name: "typescript".into(),
+                        path: PROJECT_PATH.clone(),
+                        tools: vec!["tsc".into(), "tsserver".into()],
+                    }
+                )
+                .expect("should always return `Some` for `Project`")
+                .as_str(),
+                "tool tsc / typescript@project / node@project npm@project (current @ /a/b/c)"
+            );
+        }
+
+        #[test]
+        fn fetched() {
+            assert_eq!(
+                display_tool(
+                    "tsc",
+                    &Package::Fetched(PackageDetails {
+                        name: "typescript".into(),
+                        version: TYPESCRIPT_VERSION.clone()
+                    })
+                ),
+                None
+            );
+        }
+    }
+
+    mod toolchain {
+        use super::super::*;
+        use super::*;
+        use crate::command::list::{Node, PackageManager, PackageManagerKind, Toolchain};
+
+        #[test]
+        fn full() {
+            assert_eq!(
+                format(&Toolchain::All {
+                    runtimes: vec![
+                        Node {
+                            source: Source::Default,
+                            version: NODE_VERSION.clone()
+                        },
+                        Node {
+                            source: Source::None,
+                            version: Version::from((8, 2, 4))
+                        }
+                    ],
+                    package_managers: vec![
+                        PackageManager {
+                            kind: PackageManagerKind::Npm,
+                            source: Source::Project(PROJECT_PATH.clone()),
+                            version: NPM_VERSION.clone(),
+                        },
+                        PackageManager {
+                            kind: PackageManagerKind::Npm,
+                            source: Source::Default,
+                            version: Version::from((5, 10, 0))
+                        },
+                        PackageManager {
+                            kind: PackageManagerKind::Yarn,
+                            source: Source::Project(PROJECT_PATH.clone()),
+                            version: YARN_VERSION.clone()
+                        },
+                        PackageManager {
+                            kind: PackageManagerKind::Yarn,
+                            source: Source::Default,
+                            version: Version::from((1, 17, 0))
+                        }
+                    ],
+                    packages: vec![
+                        Package::Default {
+                            details: PackageDetails {
+                                name: "ember-cli".into(),
+                                version: Version::from((3, 10, 2)),
+                            },
+                            node: NODE_VERSION.clone(),
+                            tools: vec!["ember".into()]
+                        },
+                        Package::Project {
+                            name: "ember-cli".into(),
+                            path: PROJECT_PATH.clone(),
+                            tools: vec!["ember".into()]
+                        },
+                        Package::Default {
+                            details: PackageDetails {
+                                name: "typescript".into(),
+                                version: TYPESCRIPT_VERSION.clone(),
+                            },
+                            node: NODE_VERSION.clone(),
+                            tools: vec!["tsc".into(), "tsserver".into()]
+                        }
+                    ]
+                })
+                .expect("`format` with a non-empty toolchain returns `Some`")
+                .as_str(),
+                "runtime node@12.4.0 (default)\n\
+                 runtime node@8.2.4\n\
+                 package-manager npm@6.13.4 (current @ /a/b/c)\n\
+                 package-manager npm@5.10.0 (default)\n\
+                 package-manager yarn@1.16.0 (current @ /a/b/c)\n\
+                 package-manager yarn@1.17.0 (default)\n\
+                 package ember-cli@3.10.2 / ember / node@12.4.0 npm@built-in (default)\n\
+                 package ember-cli@project / ember / node@project npm@project (current @ /a/b/c)\n\
+                 package typescript@3.4.1 / tsc, tsserver / node@12.4.0 npm@built-in (default)"
+            )
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/list/toolchain.rs.html b/main/src/volta/command/list/toolchain.rs.html new file mode 100644 index 000000000..68b5341b1 --- /dev/null +++ b/main/src/volta/command/list/toolchain.rs.html @@ -0,0 +1,819 @@ +toolchain.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+
use super::{Filter, Node, Package, PackageManager, Source};
+use crate::command::list::PackageManagerKind;
+use node_semver::Version;
+use volta_core::error::Fallible;
+use volta_core::inventory::{
+    node_versions, npm_versions, package_configs, pnpm_versions, yarn_versions,
+};
+use volta_core::platform::PlatformSpec;
+use volta_core::project::Project;
+use volta_core::tool::PackageConfig;
+
+pub(super) enum Toolchain {
+    Node(Vec<Node>),
+    PackageManagers {
+        kind: PackageManagerKind,
+        managers: Vec<PackageManager>,
+    },
+    Packages(Vec<Package>),
+    Tool {
+        name: String,
+        host_packages: Vec<Package>,
+    },
+    Active {
+        runtime: Option<Box<Node>>,
+        package_managers: Vec<PackageManager>,
+        packages: Vec<Package>,
+    },
+    All {
+        runtimes: Vec<Node>,
+        package_managers: Vec<PackageManager>,
+        packages: Vec<Package>,
+    },
+}
+
+/// Lightweight rule for which item to get the `Source` for.
+enum Lookup {
+    /// Look up the Node runtime
+    Runtime,
+    /// Look up the npm package manager
+    Npm,
+    /// Look up the pnpm package manager
+    Pnpm,
+    /// Look up the Yarn package manager
+    Yarn,
+}
+
+impl Lookup {
+    fn version_from_spec(&self) -> impl Fn(&PlatformSpec) -> Option<Version> + '_ {
+        move |spec| match self {
+            Lookup::Runtime => Some(spec.node.clone()),
+            Lookup::Npm => spec.npm.clone(),
+            Lookup::Pnpm => spec.pnpm.clone(),
+            Lookup::Yarn => spec.yarn.clone(),
+        }
+    }
+
+    fn version_source(
+        self,
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+        version: &Version,
+    ) -> Source {
+        project
+            .and_then(|proj| {
+                proj.platform()
+                    .and_then(self.version_from_spec())
+                    .and_then(|project_version| {
+                        if &project_version == version {
+                            Some(Source::Project(proj.manifest_file().to_owned()))
+                        } else {
+                            None
+                        }
+                    })
+            })
+            .or_else(|| {
+                default_platform
+                    .and_then(self.version_from_spec())
+                    .and_then(|default_version| {
+                        if &default_version == version {
+                            Some(Source::Default)
+                        } else {
+                            None
+                        }
+                    })
+            })
+            .unwrap_or(Source::None)
+    }
+
+    /// Determine the `Source` for a given kind of tool (`Lookup`).
+    fn active_tool(
+        self,
+        project: Option<&Project>,
+        default: Option<&PlatformSpec>,
+    ) -> Option<(Source, Version)> {
+        project
+            .and_then(|proj| {
+                proj.platform()
+                    .and_then(self.version_from_spec())
+                    .map(|version| (Source::Project(proj.manifest_file().to_owned()), version))
+            })
+            .or_else(|| {
+                default
+                    .and_then(self.version_from_spec())
+                    .map(|version| (Source::Default, version))
+            })
+    }
+}
+
+/// Look up the `Source` for a tool with a given name.
+fn tool_source(name: &str, project: Option<&Project>) -> Fallible<Source> {
+    match project {
+        Some(project) => {
+            if project.has_direct_bin(name.as_ref())? {
+                Ok(Source::Project(project.manifest_file().to_owned()))
+            } else {
+                Ok(Source::Default)
+            }
+        }
+        _ => Ok(Source::Default),
+    }
+}
+
+impl Toolchain {
+    pub(super) fn active(
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+    ) -> Fallible<Toolchain> {
+        let runtime = Lookup::Runtime
+            .active_tool(project, default_platform)
+            .map(|(source, version)| Box::new(Node { source, version }));
+
+        let package_managers =
+            Lookup::Npm
+                .active_tool(project, default_platform)
+                .map(|(source, version)| PackageManager {
+                    kind: PackageManagerKind::Npm,
+                    source,
+                    version,
+                })
+                .into_iter()
+                .chain(Lookup::Pnpm.active_tool(project, default_platform).map(
+                    |(source, version)| PackageManager {
+                        kind: PackageManagerKind::Pnpm,
+                        source,
+                        version,
+                    },
+                ))
+                .chain(Lookup::Yarn.active_tool(project, default_platform).map(
+                    |(source, version)| PackageManager {
+                        kind: PackageManagerKind::Yarn,
+                        source,
+                        version,
+                    },
+                ))
+                .collect();
+
+        let packages = Package::from_inventory_and_project(project)?;
+
+        Ok(Toolchain::Active {
+            runtime,
+            package_managers,
+            packages,
+        })
+    }
+
+    pub(super) fn all(
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+    ) -> Fallible<Toolchain> {
+        let runtimes = node_versions()?
+            .iter()
+            .map(|version| Node {
+                source: Lookup::Runtime.version_source(project, default_platform, version),
+                version: version.clone(),
+            })
+            .collect();
+
+        let package_managers = npm_versions()?
+            .iter()
+            .map(|version| PackageManager {
+                kind: PackageManagerKind::Npm,
+                source: Lookup::Npm.version_source(project, default_platform, version),
+                version: version.clone(),
+            })
+            .chain(pnpm_versions()?.iter().map(|version| PackageManager {
+                kind: PackageManagerKind::Pnpm,
+                source: Lookup::Pnpm.version_source(project, default_platform, version),
+                version: version.clone(),
+            }))
+            .chain(yarn_versions()?.iter().map(|version| PackageManager {
+                kind: PackageManagerKind::Yarn,
+                source: Lookup::Yarn.version_source(project, default_platform, version),
+                version: version.clone(),
+            }))
+            .collect();
+
+        let packages = Package::from_inventory_and_project(project)?;
+
+        Ok(Toolchain::All {
+            runtimes,
+            package_managers,
+            packages,
+        })
+    }
+
+    pub(super) fn node(
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+        filter: &Filter,
+    ) -> Fallible<Toolchain> {
+        let runtimes = node_versions()?
+            .iter()
+            .filter_map(|version| {
+                let source = Lookup::Runtime.version_source(project, default_platform, version);
+                if source.allowed_with(filter) {
+                    let version = version.clone();
+                    Some(Node { source, version })
+                } else {
+                    None
+                }
+            })
+            .collect();
+
+        Ok(Toolchain::Node(runtimes))
+    }
+
+    pub(super) fn npm(
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+        filter: &Filter,
+    ) -> Fallible<Toolchain> {
+        let managers = npm_versions()?
+            .iter()
+            .filter_map(|version| {
+                let source = Lookup::Npm.version_source(project, default_platform, version);
+                if source.allowed_with(filter) {
+                    Some(PackageManager {
+                        kind: PackageManagerKind::Npm,
+                        source,
+                        version: version.clone(),
+                    })
+                } else {
+                    None
+                }
+            })
+            .collect();
+
+        Ok(Toolchain::PackageManagers {
+            kind: PackageManagerKind::Npm,
+            managers,
+        })
+    }
+
+    pub(super) fn pnpm(
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+        filter: &Filter,
+    ) -> Fallible<Toolchain> {
+        let managers = pnpm_versions()?
+            .iter()
+            .filter_map(|version| {
+                let source = Lookup::Pnpm.version_source(project, default_platform, version);
+                if source.allowed_with(filter) {
+                    Some(PackageManager {
+                        kind: PackageManagerKind::Pnpm,
+                        source,
+                        version: version.clone(),
+                    })
+                } else {
+                    None
+                }
+            })
+            .collect();
+
+        Ok(Toolchain::PackageManagers {
+            kind: PackageManagerKind::Pnpm,
+            managers,
+        })
+    }
+
+    pub(super) fn yarn(
+        project: Option<&Project>,
+        default_platform: Option<&PlatformSpec>,
+        filter: &Filter,
+    ) -> Fallible<Toolchain> {
+        let managers = yarn_versions()?
+            .iter()
+            .filter_map(|version| {
+                let source = Lookup::Yarn.version_source(project, default_platform, version);
+                if source.allowed_with(filter) {
+                    Some(PackageManager {
+                        kind: PackageManagerKind::Yarn,
+                        source,
+                        version: version.clone(),
+                    })
+                } else {
+                    None
+                }
+            })
+            .collect();
+
+        Ok(Toolchain::PackageManagers {
+            kind: PackageManagerKind::Yarn,
+            managers,
+        })
+    }
+
+    pub(super) fn package_or_tool(
+        name: &str,
+        project: Option<&Project>,
+        filter: &Filter,
+    ) -> Fallible<Toolchain> {
+        /// An internal-only helper for tracking whether we found a given item
+        /// from the `PackageCollection` as a *package* or as a *tool*.
+        #[derive(PartialEq, Debug)]
+        enum Kind {
+            Package,
+            Tool,
+        }
+
+        /// A convenient name for this tuple, since we have to name it in a few
+        /// spots below.
+        type Triple<'p> = (Kind, &'p PackageConfig, Source);
+
+        let configs = package_configs()?;
+        let packages_and_tools = configs
+            .iter()
+            .filter_map(|config| {
+                // Start with the package itself, since tools often match
+                // the package name and we prioritize packages.
+                if config.name == name {
+                    let source = Package::source(name, project);
+                    if source.allowed_with(filter) {
+                        Some(Ok((Kind::Package, config, source)))
+                    } else {
+                        None
+                    }
+
+                // Then check if the passed name matches an installed package's
+                // binaries. If it does, we have a tool.
+                } else if config.bins.iter().any(|bin| bin.as_str() == name) {
+                    tool_source(name, project)
+                        .map(|source| {
+                            if source.allowed_with(filter) {
+                                Some((Kind::Tool, config, source))
+                            } else {
+                                None
+                            }
+                        })
+                        .transpose()
+
+                // Otherwise, we don't have any match all.
+                } else {
+                    None
+                }
+            })
+            // Then eagerly collect the first error (if there are any) and
+            // return it; otherwise we have a totally valid collection.
+            .collect::<Fallible<Vec<Triple>>>()?;
+
+        let (has_packages, has_tools) =
+            packages_and_tools
+                .iter()
+                .fold((false, false), |(packages, tools), (kind, ..)| {
+                    (
+                        packages || kind == &Kind::Package,
+                        tools || kind == &Kind::Tool,
+                    )
+                });
+
+        let toolchain = match (has_packages, has_tools) {
+            // If there are neither packages nor tools, treat it as `Packages`,
+            // but don't re-process the data just to construct an empty `Vec`!
+            (false, false) => Toolchain::Packages(vec![]),
+            // If there are any packages, we resolve this *as* `Packages`, even
+            // if there are also matching tools, since we give priority to
+            // listing packages between packages and tools.
+            (true, _) => {
+                let packages = packages_and_tools
+                    .into_iter()
+                    .filter_map(|(kind, config, source)| match kind {
+                        Kind::Package => Some(Package::new(config, &source)),
+                        Kind::Tool => None,
+                    })
+                    .collect();
+
+                Toolchain::Packages(packages)
+            }
+            // If there are no packages matching, but we do have tools matching,
+            // we return `Tool`.
+            (false, true) => {
+                let host_packages = packages_and_tools
+                    .into_iter()
+                    .filter_map(|(kind, config, source)| match kind {
+                        Kind::Tool => Some(Package::new(config, &source)),
+                        Kind::Package => None, // should be none of these!
+                    })
+                    .collect();
+
+                Toolchain::Tool {
+                    name: name.into(),
+                    host_packages,
+                }
+            }
+        };
+
+        Ok(toolchain)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/mod.rs.html b/main/src/volta/command/mod.rs.html new file mode 100644 index 000000000..fe434e2e0 --- /dev/null +++ b/main/src/volta/command/mod.rs.html @@ -0,0 +1,65 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+
pub(crate) mod completions;
+pub(crate) mod fetch;
+pub(crate) mod install;
+pub(crate) mod list;
+pub(crate) mod pin;
+pub(crate) mod run;
+pub(crate) mod setup;
+pub(crate) mod uninstall;
+pub(crate) mod r#use;
+pub(crate) mod which;
+
+pub(crate) use self::which::Which;
+pub(crate) use completions::Completions;
+pub(crate) use fetch::Fetch;
+pub(crate) use install::Install;
+pub(crate) use list::List;
+pub(crate) use pin::Pin;
+pub(crate) use r#use::Use;
+pub(crate) use run::Run;
+pub(crate) use setup::Setup;
+pub(crate) use uninstall::Uninstall;
+
+use volta_core::error::{ExitCode, Fallible};
+use volta_core::session::Session;
+
+/// A Volta command.
+pub(crate) trait Command: Sized {
+    /// Executes the command. Returns `Ok(true)` if the process should return 0,
+    /// `Ok(false)` if the process should return 1, and `Err(e)` if the process
+    /// should return `e.exit_code()`.
+    fn run(self, session: &mut Session) -> Fallible<ExitCode>;
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/pin.rs.html b/main/src/volta/command/pin.rs.html new file mode 100644 index 000000000..dfd0c37f7 --- /dev/null +++ b/main/src/volta/command/pin.rs.html @@ -0,0 +1,51 @@ +pin.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+
use volta_core::error::{ExitCode, Fallible};
+use volta_core::session::{ActivityKind, Session};
+use volta_core::tool::Spec;
+
+use crate::command::Command;
+
+#[derive(clap::Args)]
+pub(crate) struct Pin {
+    /// Tools to pin, like `node@lts` or `yarn@^1.14`.
+    #[arg(value_name = "tool[@version]", required = true)]
+    tools: Vec<String>,
+}
+
+impl Command for Pin {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Pin);
+
+        for tool in Spec::from_strings(&self.tools, "pin")? {
+            tool.resolve(session)?.pin(session)?;
+        }
+
+        session.add_event_end(ActivityKind::Pin, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/run.rs.html b/main/src/volta/command/run.rs.html new file mode 100644 index 000000000..805cf6f68 --- /dev/null +++ b/main/src/volta/command/run.rs.html @@ -0,0 +1,305 @@ +run.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+
use std::collections::HashMap;
+use std::ffi::OsString;
+
+use crate::command::Command;
+use crate::common::{Error, IntoResult};
+use log::warn;
+use volta_core::error::{report_error, ExitCode, Fallible};
+use volta_core::platform::{CliPlatform, InheritOption};
+use volta_core::run::execute_tool;
+use volta_core::session::{ActivityKind, Session};
+use volta_core::tool::{node, npm, pnpm, yarn};
+
+#[derive(Debug, clap::Args)]
+pub(crate) struct Run {
+    /// Set the custom Node version
+    #[arg(long, value_name = "version")]
+    node: Option<String>,
+
+    /// Set the custom npm version
+    #[arg(long, value_name = "version", conflicts_with = "bundled_npm")]
+    npm: Option<String>,
+
+    /// Forces npm to be the version bundled with Node
+    #[arg(long, conflicts_with = "npm")]
+    bundled_npm: bool,
+
+    /// Set the custon pnpm version
+    #[arg(long, value_name = "version", conflicts_with = "no_pnpm")]
+    pnpm: Option<String>,
+
+    /// Disables pnpm
+    #[arg(long, conflicts_with = "pnpm")]
+    no_pnpm: bool,
+
+    /// Set the custom Yarn version
+    #[arg(long, value_name = "version", conflicts_with = "no_yarn")]
+    yarn: Option<String>,
+
+    /// Disables Yarn
+    #[arg(long, conflicts_with = "yarn")]
+    no_yarn: bool,
+
+    /// Set an environment variable (can be used multiple times)
+    #[arg(long = "env", value_name = "NAME=value", num_args = 1)]
+    envs: Vec<String>,
+
+    /// The command to run, along with any arguments
+    #[arg(
+        allow_hyphen_values = true,
+        trailing_var_arg = true,
+        value_name = "COMMAND",
+        required = true
+    )]
+    command_and_args: Vec<OsString>,
+}
+
+impl Command for Run {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Run);
+
+        let envs = self.parse_envs();
+        let platform = self.parse_platform(session)?;
+
+        // Safety: At least one value is required for `command_and_args`, so there must be at
+        // least one value in the list. If no value is provided, Clap will show a "required
+        // argument missing" message and this function won't be called.
+        let command = &self.command_and_args[0];
+        let args = &self.command_and_args[1..];
+
+        match execute_tool(command, args, &envs, platform, session).into_result() {
+            Ok(()) => {
+                session.add_event_end(ActivityKind::Run, ExitCode::Success);
+                Ok(ExitCode::Success)
+            }
+            Err(Error::Tool(code)) => {
+                session.add_event_tool_end(ActivityKind::Run, code);
+                Ok(ExitCode::ExecutionFailure)
+            }
+            Err(Error::Volta(err)) => {
+                report_error(env!("CARGO_PKG_VERSION"), &err);
+                session.add_event_error(ActivityKind::Run, &err);
+                session.add_event_end(ActivityKind::Run, err.exit_code());
+                Ok(err.exit_code())
+            }
+        }
+    }
+}
+
+impl Run {
+    /// Builds a CliPlatform from the provided cli options
+    ///
+    /// Will resolve a semver / tag version if necessary
+    fn parse_platform(&self, session: &mut Session) -> Fallible<CliPlatform> {
+        let node = self
+            .node
+            .as_ref()
+            .map(|version| node::resolve(version.parse()?, session))
+            .transpose()?;
+
+        let npm = match (self.bundled_npm, &self.npm) {
+            (true, _) => InheritOption::None,
+            (false, None) => InheritOption::Inherit,
+            (false, Some(version)) => match npm::resolve(version.parse()?, session)? {
+                None => InheritOption::Inherit,
+                Some(npm) => InheritOption::Some(npm),
+            },
+        };
+
+        let pnpm = match (self.no_pnpm, &self.pnpm) {
+            (true, _) => InheritOption::None,
+            (false, None) => InheritOption::Inherit,
+            (false, Some(version)) => {
+                InheritOption::Some(pnpm::resolve(version.parse()?, session)?)
+            }
+        };
+
+        let yarn = match (self.no_yarn, &self.yarn) {
+            (true, _) => InheritOption::None,
+            (false, None) => InheritOption::Inherit,
+            (false, Some(version)) => {
+                InheritOption::Some(yarn::resolve(version.parse()?, session)?)
+            }
+        };
+
+        Ok(CliPlatform {
+            node,
+            npm,
+            pnpm,
+            yarn,
+        })
+    }
+
+    /// Convert the environment variable settings passed to the command line into a map
+    ///
+    /// We ignore any setting that doesn't have a value associated with it
+    /// We also ignore the PATH environment variable as that is set when running a command
+    fn parse_envs(&self) -> HashMap<&str, &str> {
+        self.envs.iter().filter_map(|entry| {
+            let mut key_value = entry.splitn(2, '=');
+
+            match (key_value.next(), key_value.next()) {
+                (None, _) => None,
+                (Some(_), None) => None,
+                (Some(key), _) if key.eq_ignore_ascii_case("PATH") => {
+                    warn!("Ignoring {} environment variable as it will be overwritten when executing the command", key);
+                    None
+                }
+                (Some(key), Some(value)) => Some((key, value)),
+            }
+        }).collect()
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/setup.rs.html b/main/src/volta/command/setup.rs.html new file mode 100644 index 000000000..3b412d84f --- /dev/null +++ b/main/src/volta/command/setup.rs.html @@ -0,0 +1,533 @@ +setup.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+
use log::info;
+use volta_core::error::{ExitCode, Fallible};
+use volta_core::layout::volta_home;
+use volta_core::session::{ActivityKind, Session};
+use volta_core::shim::regenerate_shims_for_dir;
+use volta_core::style::success_prefix;
+
+use crate::command::Command;
+
+#[derive(clap::Args)]
+pub(crate) struct Setup {}
+
+impl Command for Setup {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Setup);
+
+        os::setup_environment()?;
+        regenerate_shims_for_dir(volta_home()?.shim_dir())?;
+
+        info!(
+            "{} Setup complete. Open a new terminal to start using Volta!",
+            success_prefix()
+        );
+
+        session.add_event_end(ActivityKind::Setup, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
+#[cfg(unix)]
+mod os {
+    use std::env;
+    use std::fs::File;
+    use std::io::{self, BufRead, BufReader, Write};
+    use std::path::{Path, PathBuf};
+
+    use log::{debug, warn};
+    use volta_core::error::{ErrorKind, Fallible};
+    use volta_core::layout::volta_home;
+
+    pub fn setup_environment() -> Fallible<()> {
+        let home = volta_home()?;
+        let formatted_home = format_home(home.root());
+
+        // Don't update the user's shell config files if VOLTA_HOME and PATH already contain what we need.
+        let home_in_path = match env::var_os("PATH") {
+            Some(paths) => env::split_paths(&paths).find(|p| p == home.shim_dir()),
+            None => None,
+        };
+
+        if env::var_os("VOLTA_HOME").is_some() && home_in_path.is_some() {
+            debug!(
+                "Skipping dot-file modification as VOLTA_HOME is set, and included in the PATH."
+            );
+            return Ok(());
+        }
+
+        debug!("Searching for profiles to update");
+        let profiles = determine_profiles()?;
+
+        let found_profile = profiles.into_iter().fold(false, |prev, profile| {
+            let contents = read_profile_without_volta(&profile).unwrap_or_default();
+
+            let write_profile = match profile.extension() {
+                Some(ext) if ext == "fish" => write_profile_fish,
+                _ => write_profile_sh,
+            };
+
+            match write_profile(&profile, contents, &formatted_home) {
+                Ok(()) => true,
+                Err(err) => {
+                    warn!(
+                        "Found profile script, but could not modify it: {}",
+                        profile.display()
+                    );
+                    debug!("Profile modification error: {}", err);
+                    prev
+                }
+            }
+        });
+
+        if found_profile {
+            Ok(())
+        } else {
+            Err(ErrorKind::NoShellProfile {
+                env_profile: String::new(),
+                bin_dir: home.shim_dir().to_owned(),
+            }
+            .into())
+        }
+    }
+
+    /// Returns a list of profile files to modify / create.
+    ///
+    /// Any file in the list should be created if it doesn't already exist
+    fn determine_profiles() -> Fallible<Vec<PathBuf>> {
+        let home_dir = dirs::home_dir().ok_or(ErrorKind::NoHomeEnvironmentVar)?;
+        let shell = env::var("SHELL").unwrap_or_else(|_| String::new());
+        // Always include `~/.profile`
+        let mut profiles = vec![home_dir.join(".profile")];
+
+        // PROFILE environment variable, if set
+        if let Ok(profile_env) = env::var("PROFILE") {
+            if !profile_env.is_empty() {
+                profiles.push(profile_env.into());
+            }
+        }
+
+        add_zsh_profile(&home_dir, &shell, &mut profiles);
+        add_bash_profiles(&home_dir, &shell, &mut profiles);
+        add_fish_profile(&home_dir, &shell, &mut profiles);
+
+        Ok(profiles)
+    }
+
+    /// Add zsh profile script, if necessary
+    fn add_zsh_profile(home_dir: &Path, shell: &str, profiles: &mut Vec<PathBuf>) {
+        let zdotdir_env = env::var("ZDOTDIR").unwrap_or_else(|_| String::new());
+        let zdotdir = if zdotdir_env.is_empty() {
+            home_dir
+        } else {
+            Path::new(&zdotdir_env)
+        };
+
+        let zshenv = zdotdir.join(".zshenv");
+
+        let zshrc = zdotdir.join(".zshrc");
+
+        if shell.contains("zsh") || zshenv.exists() {
+            profiles.push(zshenv);
+        } else if zshrc.exists() {
+            profiles.push(zshrc);
+        }
+    }
+
+    /// Add bash profile scripts, if necessary
+    ///
+    /// Note: We only add the bash scripts if they already exist, as creating new files can impact
+    /// the processing of existing files in bash (e.g. preventing ~/.profile from being loaded)
+    fn add_bash_profiles(home_dir: &Path, shell: &str, profiles: &mut Vec<PathBuf>) {
+        let mut bash_added = false;
+
+        let bashrc = home_dir.join(".bashrc");
+        if bashrc.exists() {
+            bash_added = true;
+            profiles.push(bashrc);
+        }
+
+        let bash_profile = home_dir.join(".bash_profile");
+        if bash_profile.exists() {
+            bash_added = true;
+            profiles.push(bash_profile);
+        }
+
+        if shell.contains("bash") && !bash_added {
+            let suggested_bash_profile = if cfg!(target_os = "macos") {
+                "~/.bash_profile"
+            } else {
+                "~/.bashrc"
+            };
+
+            warn!(
+                "We detected that you are using bash, however we couldn't find any bash profile scripts.
+If you run into problems running Volta, create {} and run `volta setup` again.",
+                suggested_bash_profile
+            );
+        }
+    }
+
+    /// Add fish profile scripts, if necessary
+    fn add_fish_profile(home_dir: &Path, shell: &str, profiles: &mut Vec<PathBuf>) {
+        let fish_config = home_dir.join(".config/fish/config.fish");
+
+        if shell.contains("fish") || fish_config.exists() {
+            profiles.push(fish_config);
+        }
+    }
+
+    fn read_profile_without_volta(path: &Path) -> Option<String> {
+        let file = File::open(path).ok()?;
+        let reader = BufReader::new(file);
+
+        reader
+            .lines()
+            .filter(|line_result| match line_result {
+                Ok(line) if !line.contains("VOLTA") => true,
+                Ok(_) => false,
+                Err(_) => true,
+            })
+            .collect::<io::Result<Vec<String>>>()
+            .map(|lines| lines.join("\n"))
+            .ok()
+    }
+
+    fn format_home(volta_home: &Path) -> String {
+        if let Some(home_dir) = env::var_os("HOME") {
+            if let Ok(suffix) = volta_home.strip_prefix(home_dir) {
+                // If the HOME environment variable is set _and_ the proposed VOLTA_HOME starts
+                // with that value, use $HOME when writing the profile scripts
+                return format!("$HOME/{}", suffix.display());
+            }
+        }
+
+        volta_home.display().to_string()
+    }
+
+    fn write_profile_sh(path: &Path, contents: String, volta_home: &str) -> io::Result<()> {
+        let mut file = File::create(path)?;
+        write!(
+            file,
+            "{}\nexport VOLTA_HOME=\"{}\"\nexport PATH=\"$VOLTA_HOME/bin:$PATH\"\n",
+            contents, volta_home,
+        )
+    }
+
+    fn write_profile_fish(path: &Path, contents: String, volta_home: &str) -> io::Result<()> {
+        let mut file = File::create(path)?;
+        write!(
+            file,
+            "{}\nset -gx VOLTA_HOME \"{}\"\nset -gx PATH \"$VOLTA_HOME/bin\" $PATH\n",
+            contents, volta_home,
+        )
+    }
+}
+
+#[cfg(windows)]
+mod os {
+    use std::process::Command;
+
+    use log::debug;
+    use volta_core::error::{Context, ErrorKind, Fallible};
+    use volta_core::layout::volta_home;
+    use winreg::enums::HKEY_CURRENT_USER;
+    use winreg::RegKey;
+
+    pub fn setup_environment() -> Fallible<()> {
+        let shim_dir = volta_home()?.shim_dir().to_string_lossy().to_string();
+        let hkcu = RegKey::predef(HKEY_CURRENT_USER);
+        let env = hkcu
+            .open_subkey("Environment")
+            .with_context(|| ErrorKind::ReadUserPathError)?;
+        let path: String = env
+            .get_value("Path")
+            .with_context(|| ErrorKind::ReadUserPathError)?;
+
+        if !path.contains(&shim_dir) {
+            // Use `setx` command to edit the user Path environment variable
+            let mut command = Command::new("setx");
+            command.arg("Path");
+            command.arg(format!("{};{}", shim_dir, path));
+
+            debug!("Modifying User Path with command: {:?}", command);
+            let output = command
+                .output()
+                .with_context(|| ErrorKind::WriteUserPathError)?;
+
+            if !output.status.success() {
+                debug!("[setx stderr]\n{}", String::from_utf8_lossy(&output.stderr));
+                debug!("[setx stdout]\n{}", String::from_utf8_lossy(&output.stdout));
+                return Err(ErrorKind::WriteUserPathError.into());
+            }
+        }
+
+        Ok(())
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/uninstall.rs.html b/main/src/volta/command/uninstall.rs.html new file mode 100644 index 000000000..1be58ab03 --- /dev/null +++ b/main/src/volta/command/uninstall.rs.html @@ -0,0 +1,77 @@ +uninstall.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+
use volta_core::error::{ErrorKind, ExitCode, Fallible};
+use volta_core::session::{ActivityKind, Session};
+use volta_core::tool;
+use volta_core::version::VersionSpec;
+
+use crate::command::Command;
+
+#[derive(clap::Args)]
+pub(crate) struct Uninstall {
+    /// The tool to uninstall, like `ember-cli-update`, `typescript`, or <package>
+    tool: String,
+}
+
+impl Command for Uninstall {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Uninstall);
+
+        let tool = tool::Spec::try_from_str(&self.tool)?;
+
+        // For packages, specifically report that we do not support uninstalling
+        // specific versions. For runtimes and package managers, we currently
+        // *intentionally* let this fall through to inform the user that we do
+        // not support uninstalling those *at all*.
+        if let tool::Spec::Package(_name, version) = &tool {
+            let VersionSpec::None = version else {
+                return Err(ErrorKind::Unimplemented {
+                    feature: "uninstalling specific versions of tools".into(),
+                }
+                .into());
+            };
+        }
+
+        tool.uninstall()?;
+
+        session.add_event_end(ActivityKind::Uninstall, ExitCode::Success);
+        Ok(ExitCode::Success)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/use.rs.html b/main/src/volta/command/use.rs.html new file mode 100644 index 000000000..47933e6fd --- /dev/null +++ b/main/src/volta/command/use.rs.html @@ -0,0 +1,73 @@ +use.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+
use crate::command::Command;
+use volta_core::error::{ErrorKind, ExitCode, Fallible};
+use volta_core::session::{ActivityKind, Session};
+
+// NOTE: These use the same text as the `long_about` in crate::cli.
+//       It's hard to abstract since it's in an attribute string.
+
+pub(crate) const USAGE: &str = "The subcommand `use` is deprecated.
+
+    To install a tool in your toolchain, use `volta install`.
+    To pin your project's runtime or package manager, use `volta pin`.
+";
+
+const ADVICE: &str = "
+    To install a tool in your toolchain, use `volta install`.
+    To pin your project's runtime or package manager, use `volta pin`.
+";
+
+#[derive(clap::Args)]
+pub(crate) struct Use {
+    #[allow(dead_code)]
+    anything: Vec<String>, // Prevent Clap argument errors when invoking e.g. `volta use node`
+}
+
+impl Command for Use {
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Help);
+        let result = Err(ErrorKind::DeprecatedCommandError {
+            command: "use".to_string(),
+            advice: ADVICE.to_string(),
+        }
+        .into());
+        session.add_event_end(ActivityKind::Help, ExitCode::InvalidArguments);
+        result
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/command/which.rs.html b/main/src/volta/command/which.rs.html new file mode 100644 index 000000000..4b0537d5c --- /dev/null +++ b/main/src/volta/command/which.rs.html @@ -0,0 +1,151 @@ +which.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+
use std::env;
+use std::ffi::OsString;
+
+use which::which_in;
+
+use volta_core::error::{Context, ErrorKind, ExitCode, Fallible};
+use volta_core::platform::{Platform, System};
+use volta_core::run::binary::DefaultBinary;
+use volta_core::session::{ActivityKind, Session};
+
+use crate::command::Command;
+
+#[derive(clap::Args)]
+pub(crate) struct Which {
+    /// The binary to find, e.g. `node` or `npm`
+    binary: OsString,
+}
+
+impl Command for Which {
+    // 1. Start by checking if the user has a tool installed in the project or
+    //    as a user default. If so, we're done.
+    // 2. Otherwise, use the platform image and/or the system environment to
+    //    determine a lookup path to run `which` in.
+    fn run(self, session: &mut Session) -> Fallible<ExitCode> {
+        session.add_event_start(ActivityKind::Which);
+
+        let default_tool = DefaultBinary::from_name(&self.binary, session)?;
+        let project_bin_path = session
+            .project()?
+            .and_then(|project| project.find_bin(&self.binary));
+
+        let tool_path = match (default_tool, project_bin_path) {
+            (Some(_), Some(bin_path)) => Some(bin_path),
+            (Some(tool), _) => Some(tool.bin_path),
+            _ => None,
+        };
+
+        if let Some(path) = tool_path {
+            println!("{}", path.to_string_lossy());
+
+            let exit_code = ExitCode::Success;
+            session.add_event_end(ActivityKind::Which, exit_code);
+            return Ok(exit_code);
+        }
+
+        // Treat any error with obtaining the current platform image as if the image doesn't exist
+        // However, errors in obtaining the current working directory or the System path should
+        // still be treated as errors.
+        let path = match Platform::current(session)
+            .unwrap_or(None)
+            .and_then(|platform| platform.checkout(session).ok())
+            .and_then(|image| image.path().ok())
+        {
+            Some(path) => path,
+            None => System::path()?,
+        };
+
+        let cwd = env::current_dir().with_context(|| ErrorKind::CurrentDirError)?;
+        let exit_code = match which_in(&self.binary, Some(path), cwd) {
+            Ok(result) => {
+                println!("{}", result.to_string_lossy());
+                ExitCode::Success
+            }
+            Err(_) => {
+                // `which_in` Will return an Err if it can't find the binary in the path
+                // In that case, we don't want to print anything out, but we want to return
+                // Exit Code 1 (ExitCode::UnknownError)
+                ExitCode::UnknownError
+            }
+        };
+
+        session.add_event_end(ActivityKind::Which, exit_code);
+        Ok(exit_code)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/common.rs.html b/main/src/volta/common.rs.html new file mode 100644 index 000000000..5be4d5528 --- /dev/null +++ b/main/src/volta/common.rs.html @@ -0,0 +1,89 @@ +common.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
use std::process::{Command, ExitStatus};
+
+use volta_core::error::{Context, ErrorKind, VoltaError};
+use volta_core::layout::{volta_home, volta_install};
+
+pub enum Error {
+    Volta(VoltaError),
+    Tool(i32),
+}
+
+pub fn ensure_layout() -> Result<(), Error> {
+    let home = volta_home().map_err(Error::Volta)?;
+
+    if !home.layout_file().exists() {
+        let install = volta_install().map_err(Error::Volta)?;
+        Command::new(install.migrate_executable())
+            .env("VOLTA_LOGLEVEL", format!("{}", log::max_level()))
+            .status()
+            .with_context(|| ErrorKind::CouldNotStartMigration)
+            .into_result()?;
+    }
+
+    Ok(())
+}
+
+pub trait IntoResult<T> {
+    fn into_result(self) -> Result<T, Error>;
+}
+
+impl IntoResult<()> for Result<ExitStatus, VoltaError> {
+    fn into_result(self) -> Result<(), Error> {
+        match self {
+            Ok(status) => {
+                if status.success() {
+                    Ok(())
+                } else {
+                    let code = status.code().unwrap_or(1);
+                    Err(Error::Tool(code))
+                }
+            }
+            Err(err) => Err(Error::Volta(err)),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta/main.rs.html b/main/src/volta/main.rs.html new file mode 100644 index 000000000..b3ccd4d0a --- /dev/null +++ b/main/src/volta/main.rs.html @@ -0,0 +1,111 @@ +main.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+
#[macro_use]
+mod command;
+mod cli;
+
+use clap::Parser;
+
+use volta_core::error::report_error;
+use volta_core::log::{LogContext, LogVerbosity, Logger};
+use volta_core::session::{ActivityKind, Session};
+
+mod common;
+use common::{ensure_layout, Error};
+
+/// The entry point for the `volta` CLI.
+pub fn main() {
+    let volta = cli::Volta::parse();
+    let verbosity = match (&volta.verbose, &volta.quiet) {
+        (false, false) => LogVerbosity::Default,
+        (true, false) => {
+            if volta.very_verbose {
+                LogVerbosity::VeryVerbose
+            } else {
+                LogVerbosity::Verbose
+            }
+        }
+        (false, true) => LogVerbosity::Quiet,
+        (true, true) => {
+            unreachable!("Clap should prevent the user from providing both --verbose and --quiet")
+        }
+    };
+    Logger::init(LogContext::Volta, verbosity).expect("Only a single logger should be initialized");
+    log::trace!("log level: {verbosity:?}");
+
+    let mut session = Session::init();
+    session.add_event_start(ActivityKind::Volta);
+
+    let result = ensure_layout().and_then(|()| volta.run(&mut session).map_err(Error::Volta));
+    match result {
+        Ok(exit_code) => {
+            session.add_event_end(ActivityKind::Volta, exit_code);
+            session.exit(exit_code);
+        }
+        Err(Error::Tool(code)) => {
+            session.add_event_tool_end(ActivityKind::Volta, code);
+            session.exit_tool(code);
+        }
+        Err(Error::Volta(err)) => {
+            report_error(env!("CARGO_PKG_VERSION"), &err);
+            session.add_event_error(ActivityKind::Volta, &err);
+            let code = err.exit_code();
+            session.add_event_end(ActivityKind::Volta, code);
+            session.exit(code);
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/command.rs.html b/main/src/volta_core/command.rs.html new file mode 100644 index 000000000..c09a77116 --- /dev/null +++ b/main/src/volta_core/command.rs.html @@ -0,0 +1,61 @@ +command.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+
use std::ffi::OsStr;
+use std::process::Command;
+
+use cfg_if::cfg_if;
+
+cfg_if! {
+    if #[cfg(windows)] {
+        pub fn create_command<E>(exe: E) -> Command
+        where
+            E: AsRef<OsStr>
+        {
+            // Several of the node utilities are implemented as `.bat` or `.cmd` files
+            // When executing those files with `Command`, we need to call them with:
+            //    cmd.exe /C <COMMAND> <ARGUMENTS>
+            // Instead of: <COMMAND> <ARGUMENTS>
+            // See: https://github.com/rust-lang/rust/issues/42791 For a longer discussion
+            let mut command = Command::new("cmd.exe");
+            command.arg("/C");
+            command.arg(exe);
+            command
+        }
+    } else {
+        pub fn create_command<E>(exe: E) -> Command
+        where
+            E: AsRef<OsStr>
+        {
+            Command::new(exe)
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/error/kind.rs.html b/main/src/volta_core/error/kind.rs.html new file mode 100644 index 000000000..7d32d42bf --- /dev/null +++ b/main/src/volta_core/error/kind.rs.html @@ -0,0 +1,3165 @@ +kind.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+957
+958
+959
+960
+961
+962
+963
+964
+965
+966
+967
+968
+969
+970
+971
+972
+973
+974
+975
+976
+977
+978
+979
+980
+981
+982
+983
+984
+985
+986
+987
+988
+989
+990
+991
+992
+993
+994
+995
+996
+997
+998
+999
+1000
+1001
+1002
+1003
+1004
+1005
+1006
+1007
+1008
+1009
+1010
+1011
+1012
+1013
+1014
+1015
+1016
+1017
+1018
+1019
+1020
+1021
+1022
+1023
+1024
+1025
+1026
+1027
+1028
+1029
+1030
+1031
+1032
+1033
+1034
+1035
+1036
+1037
+1038
+1039
+1040
+1041
+1042
+1043
+1044
+1045
+1046
+1047
+1048
+1049
+1050
+1051
+1052
+1053
+1054
+1055
+1056
+1057
+1058
+1059
+1060
+1061
+1062
+1063
+1064
+1065
+1066
+1067
+1068
+1069
+1070
+1071
+1072
+1073
+1074
+1075
+1076
+1077
+1078
+1079
+1080
+1081
+1082
+1083
+1084
+1085
+1086
+1087
+1088
+1089
+1090
+1091
+1092
+1093
+1094
+1095
+1096
+1097
+1098
+1099
+1100
+1101
+1102
+1103
+1104
+1105
+1106
+1107
+1108
+1109
+1110
+1111
+1112
+1113
+1114
+1115
+1116
+1117
+1118
+1119
+1120
+1121
+1122
+1123
+1124
+1125
+1126
+1127
+1128
+1129
+1130
+1131
+1132
+1133
+1134
+1135
+1136
+1137
+1138
+1139
+1140
+1141
+1142
+1143
+1144
+1145
+1146
+1147
+1148
+1149
+1150
+1151
+1152
+1153
+1154
+1155
+1156
+1157
+1158
+1159
+1160
+1161
+1162
+1163
+1164
+1165
+1166
+1167
+1168
+1169
+1170
+1171
+1172
+1173
+1174
+1175
+1176
+1177
+1178
+1179
+1180
+1181
+1182
+1183
+1184
+1185
+1186
+1187
+1188
+1189
+1190
+1191
+1192
+1193
+1194
+1195
+1196
+1197
+1198
+1199
+1200
+1201
+1202
+1203
+1204
+1205
+1206
+1207
+1208
+1209
+1210
+1211
+1212
+1213
+1214
+1215
+1216
+1217
+1218
+1219
+1220
+1221
+1222
+1223
+1224
+1225
+1226
+1227
+1228
+1229
+1230
+1231
+1232
+1233
+1234
+1235
+1236
+1237
+1238
+1239
+1240
+1241
+1242
+1243
+1244
+1245
+1246
+1247
+1248
+1249
+1250
+1251
+1252
+1253
+1254
+1255
+1256
+1257
+1258
+1259
+1260
+1261
+1262
+1263
+1264
+1265
+1266
+1267
+1268
+1269
+1270
+1271
+1272
+1273
+1274
+1275
+1276
+1277
+1278
+1279
+1280
+1281
+1282
+1283
+1284
+1285
+1286
+1287
+1288
+1289
+1290
+1291
+1292
+1293
+1294
+1295
+1296
+1297
+1298
+1299
+1300
+1301
+1302
+1303
+1304
+1305
+1306
+1307
+1308
+1309
+1310
+1311
+1312
+1313
+1314
+1315
+1316
+1317
+1318
+1319
+1320
+1321
+1322
+1323
+1324
+1325
+1326
+1327
+1328
+1329
+1330
+1331
+1332
+1333
+1334
+1335
+1336
+1337
+1338
+1339
+1340
+1341
+1342
+1343
+1344
+1345
+1346
+1347
+1348
+1349
+1350
+1351
+1352
+1353
+1354
+1355
+1356
+1357
+1358
+1359
+1360
+1361
+1362
+1363
+1364
+1365
+1366
+1367
+1368
+1369
+1370
+1371
+1372
+1373
+1374
+1375
+1376
+1377
+1378
+1379
+1380
+1381
+1382
+1383
+1384
+1385
+1386
+1387
+1388
+1389
+1390
+1391
+1392
+1393
+1394
+1395
+1396
+1397
+1398
+1399
+1400
+1401
+1402
+1403
+1404
+1405
+1406
+1407
+1408
+1409
+1410
+1411
+1412
+1413
+1414
+1415
+1416
+1417
+1418
+1419
+1420
+1421
+1422
+1423
+1424
+1425
+1426
+1427
+1428
+1429
+1430
+1431
+1432
+1433
+1434
+1435
+1436
+1437
+1438
+1439
+1440
+1441
+1442
+1443
+1444
+1445
+1446
+1447
+1448
+1449
+1450
+1451
+1452
+1453
+1454
+1455
+1456
+1457
+1458
+1459
+1460
+1461
+1462
+1463
+1464
+1465
+1466
+1467
+1468
+1469
+1470
+1471
+1472
+1473
+1474
+1475
+1476
+1477
+1478
+1479
+1480
+1481
+1482
+1483
+1484
+1485
+1486
+1487
+1488
+1489
+1490
+1491
+1492
+1493
+1494
+1495
+1496
+1497
+1498
+1499
+1500
+1501
+1502
+1503
+1504
+1505
+1506
+1507
+1508
+1509
+1510
+1511
+1512
+1513
+1514
+1515
+1516
+1517
+1518
+1519
+1520
+1521
+1522
+1523
+1524
+1525
+1526
+1527
+1528
+1529
+1530
+1531
+1532
+1533
+1534
+1535
+1536
+1537
+1538
+1539
+1540
+1541
+1542
+1543
+1544
+1545
+1546
+1547
+1548
+1549
+1550
+1551
+1552
+1553
+1554
+1555
+1556
+1557
+1558
+1559
+1560
+1561
+1562
+1563
+1564
+1565
+1566
+1567
+1568
+1569
+1570
+1571
+1572
+1573
+1574
+1575
+1576
+1577
+1578
+1579
+1580
+1581
+1582
+
use std::fmt;
+use std::path::PathBuf;
+
+use super::ExitCode;
+use crate::style::{text_width, tool_version};
+use crate::tool;
+use crate::tool::package::PackageManager;
+use textwrap::{fill, indent};
+
+const REPORT_BUG_CTA: &str =
+    "Please rerun the command that triggered this error with the environment
+variable `VOLTA_LOGLEVEL` set to `debug` and open an issue at
+https://github.com/volta-cli/volta/issues with the details!";
+
+const PERMISSIONS_CTA: &str = "Please ensure you have correct permissions to the Volta directory.";
+
+#[derive(Debug)]
+#[cfg_attr(test, derive(PartialEq, Eq))]
+pub enum ErrorKind {
+    /// Thrown when package tries to install a binary that is already installed.
+    BinaryAlreadyInstalled {
+        bin_name: String,
+        existing_package: String,
+        new_package: String,
+    },
+
+    /// Thrown when executing an external binary fails
+    BinaryExecError,
+
+    /// Thrown when a binary could not be found in the local inventory
+    BinaryNotFound {
+        name: String,
+    },
+
+    /// Thrown when building the virtual environment path fails
+    BuildPathError,
+
+    /// Thrown when unable to launch a command with VOLTA_BYPASS set
+    BypassError {
+        command: String,
+    },
+
+    /// Thrown when a user tries to `volta fetch` something other than node/yarn/npm.
+    CannotFetchPackage {
+        package: String,
+    },
+
+    /// Thrown when a user tries to `volta pin` something other than node/yarn/npm.
+    CannotPinPackage {
+        package: String,
+    },
+
+    /// Thrown when the Completions out-dir is not a directory
+    CompletionsOutFileError {
+        path: PathBuf,
+    },
+
+    /// Thrown when the containing directory could not be determined
+    ContainingDirError {
+        path: PathBuf,
+    },
+
+    CouldNotDetermineTool,
+
+    /// Thrown when unable to start the migration executable
+    CouldNotStartMigration,
+
+    CreateDirError {
+        dir: PathBuf,
+    },
+
+    /// Thrown when unable to create the layout file
+    CreateLayoutFileError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to create a link to the shared global library directory
+    CreateSharedLinkError {
+        name: String,
+    },
+
+    /// Thrown when creating a temporary directory fails
+    CreateTempDirError {
+        in_dir: PathBuf,
+    },
+
+    /// Thrown when creating a temporary file fails
+    CreateTempFileError {
+        in_dir: PathBuf,
+    },
+
+    CurrentDirError,
+
+    /// Thrown when deleting a directory fails
+    DeleteDirectoryError {
+        directory: PathBuf,
+    },
+
+    /// Thrown when deleting a file fails
+    DeleteFileError {
+        file: PathBuf,
+    },
+
+    DeprecatedCommandError {
+        command: String,
+        advice: String,
+    },
+
+    DownloadToolNetworkError {
+        tool: tool::Spec,
+        from_url: String,
+    },
+
+    /// Thrown when unable to execute a hook command
+    ExecuteHookError {
+        command: String,
+    },
+
+    /// Thrown when `volta.extends` keys result in an infinite cycle
+    ExtensionCycleError {
+        paths: Vec<PathBuf>,
+        duplicate: PathBuf,
+    },
+
+    /// Thrown when determining the path to an extension manifest fails
+    ExtensionPathError {
+        path: PathBuf,
+    },
+
+    /// Thrown when a hook command returns a non-zero exit code
+    HookCommandFailed {
+        command: String,
+    },
+
+    /// Thrown when a hook contains multiple fields (prefix, template, or bin)
+    HookMultipleFieldsSpecified,
+
+    /// Thrown when a hook doesn't contain any of the known fields (prefix, template, or bin)
+    HookNoFieldsSpecified,
+
+    /// Thrown when determining the path to a hook fails
+    HookPathError {
+        command: String,
+    },
+
+    /// Thrown when determining the name of a newly-installed package fails
+    InstalledPackageNameError,
+
+    InvalidHookCommand {
+        command: String,
+    },
+
+    /// Thrown when output from a hook command could not be read
+    InvalidHookOutput {
+        command: String,
+    },
+
+    /// Thrown when a user does e.g. `volta install node 12` instead of
+    /// `volta install node@12`.
+    InvalidInvocation {
+        action: String,
+        name: String,
+        version: String,
+    },
+
+    /// Thrown when a user does e.g. `volta install 12` instead of
+    /// `volta install node@12`.
+    InvalidInvocationOfBareVersion {
+        action: String,
+        version: String,
+    },
+
+    /// Thrown when a format other than "npm" or "github" is given for yarn.index in the hooks
+    InvalidRegistryFormat {
+        format: String,
+    },
+
+    /// Thrown when a tool name is invalid per npm's rules.
+    InvalidToolName {
+        name: String,
+        errors: Vec<String>,
+    },
+
+    /// Thrown when unable to acquire a lock on the Volta directory
+    LockAcquireError,
+
+    /// Thrown when pinning or installing npm@bundled and couldn't detect the bundled version
+    NoBundledNpm {
+        command: String,
+    },
+
+    /// Thrown when pnpm is not set at the command-line
+    NoCommandLinePnpm,
+
+    /// Thrown when Yarn is not set at the command-line
+    NoCommandLineYarn,
+
+    /// Thrown when a user tries to install a Yarn or npm version before installing a Node version.
+    NoDefaultNodeVersion {
+        tool: String,
+    },
+
+    /// Thrown when there is no Node version matching a requested semver specifier.
+    NodeVersionNotFound {
+        matching: String,
+    },
+
+    NoHomeEnvironmentVar,
+
+    /// Thrown when the install dir could not be determined
+    NoInstallDir,
+
+    NoLocalDataDir,
+
+    /// Thrown when a user tries to pin a npm, pnpm, or Yarn version before pinning a Node version.
+    NoPinnedNodeVersion {
+        tool: String,
+    },
+
+    /// Thrown when the platform (Node version) could not be determined
+    NoPlatform,
+
+    /// Thrown when parsing the project manifest and there is a `"volta"` key without Node
+    NoProjectNodeInManifest,
+
+    /// Thrown when Yarn is not set in a project
+    NoProjectYarn,
+
+    /// Thrown when pnpm is not set in a project
+    NoProjectPnpm,
+
+    /// Thrown when no shell profiles could be found
+    NoShellProfile {
+        env_profile: String,
+        bin_dir: PathBuf,
+    },
+
+    /// Thrown when the user tries to pin Node or Yarn versions outside of a package.
+    NotInPackage,
+
+    /// Thrown when default Yarn is not set
+    NoDefaultYarn,
+
+    /// Thrown when default pnpm is not set
+    NoDefaultPnpm,
+
+    /// Thrown when `npm link` is called with a package that isn't available
+    NpmLinkMissingPackage {
+        package: String,
+    },
+
+    /// Thrown when `npm link` is called with a package that was not installed / linked with npm
+    NpmLinkWrongManager {
+        package: String,
+    },
+
+    /// Thrown when there is no npm version matching the requested Semver/Tag
+    NpmVersionNotFound {
+        matching: String,
+    },
+
+    NpxNotAvailable {
+        version: String,
+    },
+
+    /// Thrown when the command to install a global package is not successful
+    PackageInstallFailed {
+        package: String,
+    },
+
+    /// Thrown when parsing the package manifest fails
+    PackageManifestParseError {
+        package: String,
+    },
+
+    /// Thrown when reading the package manifest fails
+    PackageManifestReadError {
+        package: String,
+    },
+
+    /// Thrown when a specified package could not be found on the npm registry
+    PackageNotFound {
+        package: String,
+    },
+
+    /// Thrown when parsing a package manifest fails
+    PackageParseError {
+        file: PathBuf,
+    },
+
+    /// Thrown when reading a package manifest fails
+    PackageReadError {
+        file: PathBuf,
+    },
+
+    /// Thrown when a package has been unpacked but is not formed correctly.
+    PackageUnpackError,
+
+    /// Thrown when writing a package manifest fails
+    PackageWriteError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to parse a bin config file
+    ParseBinConfigError,
+
+    /// Thrown when unable to parse a hooks.json file
+    ParseHooksError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to parse the node index cache
+    ParseNodeIndexCacheError,
+
+    /// Thrown when unable to parse the node index
+    ParseNodeIndexError {
+        from_url: String,
+    },
+
+    /// Thrown when unable to parse the node index cache expiration
+    ParseNodeIndexExpiryError,
+
+    /// Thrown when unable to parse the npm manifest file from a node install
+    ParseNpmManifestError,
+
+    /// Thrown when unable to parse a package configuration
+    ParsePackageConfigError,
+
+    /// Thrown when unable to parse the platform.json file
+    ParsePlatformError,
+
+    /// Thrown when unable to parse a tool spec (`<tool>[@<version>]`)
+    ParseToolSpecError {
+        tool_spec: String,
+    },
+
+    /// Thrown when persisting an archive to the inventory fails
+    PersistInventoryError {
+        tool: String,
+    },
+
+    /// Thrown when there is no pnpm version matching a requested semver specifier.
+    PnpmVersionNotFound {
+        matching: String,
+    },
+
+    /// Thrown when executing a project-local binary fails
+    ProjectLocalBinaryExecError {
+        command: String,
+    },
+
+    /// Thrown when a project-local binary could not be found
+    ProjectLocalBinaryNotFound {
+        command: String,
+    },
+
+    /// Thrown when a publish hook contains both the url and bin fields
+    PublishHookBothUrlAndBin,
+
+    /// Thrown when a publish hook contains neither url nor bin fields
+    PublishHookNeitherUrlNorBin,
+
+    /// Thrown when there was an error reading the user bin directory
+    ReadBinConfigDirError {
+        dir: PathBuf,
+    },
+
+    /// Thrown when there was an error reading the config for a binary
+    ReadBinConfigError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to read the default npm version file
+    ReadDefaultNpmError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to read the contents of a directory
+    ReadDirError {
+        dir: PathBuf,
+    },
+
+    /// Thrown when there was an error opening a hooks.json file
+    ReadHooksError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error reading the Node Index Cache
+    ReadNodeIndexCacheError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error reading the Node Index Cache Expiration
+    ReadNodeIndexExpiryError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error reading the npm manifest file
+    ReadNpmManifestError,
+
+    /// Thrown when there was an error reading a package configuration file
+    ReadPackageConfigError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error opening the user platform file
+    ReadPlatformError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to read the user Path environment variable from the registry
+    #[cfg(windows)]
+    ReadUserPathError,
+
+    /// Thrown when the public registry for Node or Yarn could not be downloaded.
+    RegistryFetchError {
+        tool: String,
+        from_url: String,
+    },
+
+    /// Thrown when the shim binary is called directly, not through a symlink
+    RunShimDirectly,
+
+    /// Thrown when there was an error setting a tool to executable
+    SetToolExecutable {
+        tool: String,
+    },
+
+    /// Thrown when there was an error copying an unpacked tool to the image directory
+    SetupToolImageError {
+        tool: String,
+        version: String,
+        dir: PathBuf,
+    },
+
+    /// Thrown when Volta is unable to create a shim
+    ShimCreateError {
+        name: String,
+    },
+
+    /// Thrown when Volta is unable to remove a shim
+    ShimRemoveError {
+        name: String,
+    },
+
+    /// Thrown when serializing a bin config to JSON fails
+    StringifyBinConfigError,
+
+    /// Thrown when serializing a package config to JSON fails
+    StringifyPackageConfigError,
+
+    /// Thrown when serializing the platform to JSON fails
+    StringifyPlatformError,
+
+    /// Thrown when a given feature has not yet been implemented
+    Unimplemented {
+        feature: String,
+    },
+
+    /// Thrown when unpacking an archive (tarball or zip) fails
+    UnpackArchiveError {
+        tool: String,
+        version: String,
+    },
+
+    /// Thrown when a package to upgrade was not found
+    UpgradePackageNotFound {
+        package: String,
+        manager: PackageManager,
+    },
+
+    /// Thrown when a package to upgrade was installed with a different package manager
+    UpgradePackageWrongManager {
+        package: String,
+        manager: PackageManager,
+    },
+
+    VersionParseError {
+        version: String,
+    },
+
+    /// Thrown when there was an error writing a bin config file
+    WriteBinConfigError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error writing the default npm to file
+    WriteDefaultNpmError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error writing the npm launcher
+    WriteLauncherError {
+        tool: String,
+    },
+
+    /// Thrown when there was an error writing the node index cache
+    WriteNodeIndexCacheError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error writing the node index expiration
+    WriteNodeIndexExpiryError {
+        file: PathBuf,
+    },
+
+    /// Thrown when there was an error writing a package config
+    WritePackageConfigError {
+        file: PathBuf,
+    },
+
+    /// Thrown when writing the platform.json file fails
+    WritePlatformError {
+        file: PathBuf,
+    },
+
+    /// Thrown when unable to write the user PATH environment variable
+    #[cfg(windows)]
+    WriteUserPathError,
+
+    /// Thrown when a user attempts to install a version of Yarn2
+    Yarn2NotSupported,
+
+    /// Thrown when there is an error fetching the latest version of Yarn
+    YarnLatestFetchError {
+        from_url: String,
+    },
+
+    /// Thrown when there is no Yarn version matching a requested semver specifier.
+    YarnVersionNotFound {
+        matching: String,
+    },
+}
+
+impl fmt::Display for ErrorKind {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            ErrorKind::BinaryAlreadyInstalled {
+                bin_name,
+                existing_package,
+                new_package,
+            } => write!(
+                f,
+                "Executable '{}' is already installed by {}
+
+Please remove {} before installing {}",
+                bin_name, existing_package, existing_package, new_package
+            ),
+            ErrorKind::BinaryExecError => write!(
+                f,
+                "Could not execute command.
+
+See `volta help install` and `volta help pin` for info about making tools available."
+            ),
+            ErrorKind::BinaryNotFound { name } => write!(
+                f,
+                r#"Could not find executable "{}"
+
+Use `volta install` to add a package to your toolchain (see `volta help install` for more info)."#,
+                name
+            ),
+            ErrorKind::BuildPathError => write!(
+                f,
+                "Could not create execution environment.
+
+Please ensure your PATH is valid."
+            ),
+            ErrorKind::BypassError { command } => write!(
+                f,
+                "Could not execute command '{}'
+
+VOLTA_BYPASS is enabled, please ensure that the command exists on your system or unset VOLTA_BYPASS",
+                command,
+            ),
+            ErrorKind::CannotFetchPackage { package } => write!(
+                f,
+                "Fetching packages without installing them is not supported.
+
+Use `volta install {}` to update the default version.",
+                package
+            ),
+            ErrorKind::CannotPinPackage { package } => write!(
+                f,
+                "Only node and yarn can be pinned in a project
+
+Use `npm install` or `yarn add` to select a version of {} for this project.",
+                package
+            ),
+            ErrorKind::CompletionsOutFileError { path } => write!(
+                f,
+                "Completions file `{}` already exists.
+
+Please remove the file or pass `-f` or `--force` to override.",
+                path.display()
+            ),
+            ErrorKind::ContainingDirError { path } => write!(
+                f,
+                "Could not create the containing directory for {}
+
+{}",
+                path.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::CouldNotDetermineTool => write!(
+                f,
+                "Could not determine tool name
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::CouldNotStartMigration => write!(
+                f,
+                "Could not start migration process to upgrade your Volta directory.
+
+Please ensure you have 'volta-migrate' on your PATH and run it directly."
+            ),
+            ErrorKind::CreateDirError { dir } => write!(
+                f,
+                "Could not create directory {}
+
+Please ensure that you have the correct permissions.",
+                dir.display()
+            ),
+            ErrorKind::CreateLayoutFileError { file } => write!(
+                f,
+                "Could not create layout file {}
+
+{}",
+                file.display(), PERMISSIONS_CTA
+            ),
+            ErrorKind::CreateSharedLinkError { name } => write!(
+                f,
+                "Could not create shared environment for package '{}'
+
+{}",
+                name, PERMISSIONS_CTA
+            ),
+            ErrorKind::CreateTempDirError { in_dir } => write!(
+                f,
+                "Could not create temporary directory
+in {}
+
+{}",
+                in_dir.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::CreateTempFileError { in_dir } => write!(
+                f,
+                "Could not create temporary file
+in {}
+
+{}",
+                in_dir.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::CurrentDirError => write!(
+                f,
+                "Could not determine current directory
+
+Please ensure that you have the correct permissions."
+            ),
+            ErrorKind::DeleteDirectoryError { directory } => write!(
+                f,
+                "Could not remove directory
+at {}
+
+{}",
+                directory.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::DeleteFileError { file } => write!(
+                f,
+                "Could not remove file
+at {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::DeprecatedCommandError { command, advice } => {
+                write!(f, "The subcommand `{}` is deprecated.\n{}", command, advice)
+            }
+            ErrorKind::DownloadToolNetworkError { tool, from_url } => write!(
+                f,
+                "Could not download {}
+from {}
+
+Please verify your internet connection and ensure the correct version is specified.",
+                tool, from_url
+            ),
+            ErrorKind::ExecuteHookError { command } => write!(
+                f,
+                "Could not execute hook command: '{}'
+
+Please ensure that the correct command is specified.",
+                command
+            ),
+            ErrorKind::ExtensionCycleError { paths, duplicate } => {
+                // Detected infinite loop in project workspace:
+                //
+                // --> /home/user/workspace/project/package.json
+                //     /home/user/workspace/package.json
+                // --> /home/user/workspace/project/package.json
+                //
+                // Please ensure that project workspaces do not depend on each other.
+                f.write_str("Detected infinite loop in project workspace:\n\n")?;
+
+                for path in paths {
+                    if path == duplicate {
+                        f.write_str("--> ")?;
+                    } else {
+                        f.write_str("    ")?;
+                    }
+
+                    writeln!(f, "{}", path.display())?;
+                }
+
+                writeln!(f, "--> {}", duplicate.display())?;
+                writeln!(f)?;
+
+                f.write_str("Please ensure that project workspaces do not depend on each other.")
+            }
+            ErrorKind::ExtensionPathError { path } => write!(
+                f,
+                "Could not determine path to project workspace: '{}'
+
+Please ensure that the file exists and is accessible.",
+                path.display(),
+            ),
+            ErrorKind::HookCommandFailed { command } => write!(
+                f,
+                "Hook command '{}' indicated a failure.
+
+Please verify the requested tool and version.",
+                command
+            ),
+            ErrorKind::HookMultipleFieldsSpecified => write!(
+                f,
+                "Hook configuration includes multiple hook types.
+
+Please include only one of 'bin', 'prefix', or 'template'"
+            ),
+            ErrorKind::HookNoFieldsSpecified => write!(
+                f,
+                "Hook configuration includes no hook types.
+
+Please include one of 'bin', 'prefix', or 'template'"
+            ),
+            ErrorKind::HookPathError { command } => write!(
+                f,
+                "Could not determine path to hook command: '{}'
+
+Please ensure that the correct command is specified.",
+                command
+            ),
+            ErrorKind::InstalledPackageNameError => write!(
+                f,
+                "Could not determine the name of the package that was just installed.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::InvalidHookCommand { command } => write!(
+                f,
+                "Invalid hook command: '{}'
+
+Please ensure that the correct command is specified.",
+                command
+            ),
+            ErrorKind::InvalidHookOutput { command } => write!(
+                f,
+                "Could not read output from hook command: '{}'
+
+Please ensure that the command output is valid UTF-8 text.",
+                command
+            ),
+
+            ErrorKind::InvalidInvocation {
+                action,
+                name,
+                version,
+            } => {
+                let error = format!(
+                    "`volta {action} {name} {version}` is not supported.",
+                    action = action,
+                    name = name,
+                    version = version
+                );
+
+                let call_to_action = format!(
+"To {action} '{name}' version '{version}', please run `volta {action} {formatted}`. \
+To {action} the packages '{name}' and '{version}', please {action} them in separate commands, or with explicit versions.",
+                    action=action,
+                    name=name,
+                    version=version,
+                    formatted=tool_version(name, version)
+                );
+
+                let wrapped_cta = match text_width() {
+                    Some(width) => fill(&call_to_action, width),
+                    None => call_to_action,
+                };
+
+                write!(f, "{}\n\n{}", error, wrapped_cta)
+            }
+
+            ErrorKind::InvalidInvocationOfBareVersion {
+                action,
+                version,
+            } => {
+                let error = format!(
+                    "`volta {action} {version}` is not supported.",
+                    action = action,
+                    version = version
+                );
+
+                let call_to_action = format!(
+"To {action} node version '{version}', please run `volta {action} {formatted}`. \
+To {action} the package '{version}', please use an explicit version such as '{version}@latest'.",
+                    action=action,
+                    version=version,
+                    formatted=tool_version("node", version)
+                );
+
+                let wrapped_cta = match text_width() {
+                    Some(width) => fill(&call_to_action, width),
+                    None => call_to_action,
+                };
+
+                write!(f, "{}\n\n{}", error, wrapped_cta)
+            }
+
+            ErrorKind::InvalidRegistryFormat { format } => write!(
+                f,
+                "Unrecognized index registry format: '{}'
+
+Please specify either 'npm' or 'github' for the format.",
+format
+            ),
+
+            ErrorKind::InvalidToolName { name, errors } => {
+                let indentation = "    ";
+                let wrapped = match text_width() {
+                    Some(width) => fill(&errors.join("\n"), width - indentation.len()),
+                    None => errors.join("\n"),
+                };
+                let formatted_errs = indent(&wrapped, indentation);
+
+                let call_to_action = if errors.len() > 1 {
+                    "Please fix the following errors:"
+                } else {
+                    "Please fix the following error:"
+                };
+
+                write!(
+                    f,
+                    "Invalid tool name `{}`\n\n{}\n{}",
+                    name, call_to_action, formatted_errs
+                )
+            }
+            // Note: No CTA as this error is purely informational and shouldn't be exposed to the user
+            ErrorKind::LockAcquireError => write!(
+                f,
+                "Unable to acquire lock on Volta directory"
+            ),
+            ErrorKind::NoBundledNpm { command } => write!(
+                f,
+                "Could not detect bundled npm version.
+
+Please ensure you have a Node version selected with `volta {} node` (see `volta help {0}` for more info).",
+                command
+            ),
+            ErrorKind::NoCommandLinePnpm => write!(
+                f,
+                "No pnpm version specified.
+
+Use `volta run --pnpm` to select a version (see `volta help run` for more info)."
+            ),
+            ErrorKind::NoCommandLineYarn => write!(
+                f,
+                "No Yarn version specified.
+
+Use `volta run --yarn` to select a version (see `volta help run` for more info)."
+            ),
+            ErrorKind::NoDefaultNodeVersion { tool } => write!(
+                f,
+                "Cannot install {} because the default Node version is not set.
+
+Use `volta install node` to select a default Node first, then install a {0} version.",
+                                tool
+            ),
+            ErrorKind::NodeVersionNotFound { matching } => write!(
+                f,
+                r#"Could not find Node version matching "{}" in the version registry.
+
+Please verify that the version is correct."#,
+                matching
+            ),
+            ErrorKind::NoHomeEnvironmentVar => write!(
+                f,
+                "Could not determine home directory.
+
+Please ensure the environment variable 'HOME' is set."
+            ),
+            ErrorKind::NoInstallDir => write!(
+                f,
+                "Could not determine Volta install directory.
+
+Please ensure Volta was installed correctly"
+            ),
+            ErrorKind::NoLocalDataDir => write!(
+                f,
+                "Could not determine LocalAppData directory.
+
+Please ensure the directory is available."
+            ),
+            ErrorKind::NoPinnedNodeVersion { tool } => write!(
+                f,
+                "Cannot pin {} because the Node version is not pinned in this project.
+
+Use `volta pin node` to pin Node first, then pin a {0} version.",
+                tool
+            ),
+            ErrorKind::NoPlatform => write!(
+                f,
+                "Node is not available.
+
+To run any Node command, first set a default version using `volta install node`"
+            ),
+            ErrorKind::NoProjectNodeInManifest => write!(
+                f,
+                "No Node version found in this project.
+
+Use `volta pin node` to select a version (see `volta help pin` for more info)."
+            ),
+            ErrorKind::NoProjectPnpm => write!(
+                f,
+                "No pnpm version found in this project.
+
+Use `volta pin pnpm` to select a version (see `volta help pin` for more info)."
+            ),
+            ErrorKind::NoProjectYarn => write!(
+                f,
+                "No Yarn version found in this project.
+
+Use `volta pin yarn` to select a version (see `volta help pin` for more info)."
+            ),
+            ErrorKind::NoShellProfile { env_profile, bin_dir } => write!(
+                f,
+                "Could not locate user profile.
+Tried $PROFILE ({}), ~/.bashrc, ~/.bash_profile, ~/.zshenv ~/.zshrc, ~/.profile, and ~/.config/fish/config.fish
+
+Please create one of these and try again; or you can edit your profile manually to add '{}' to your PATH",
+                env_profile, bin_dir.display()
+            ),
+            ErrorKind::NotInPackage => write!(
+                f,
+                "Not in a node package.
+
+Use `volta install` to select a default version of a tool."
+            ),
+            ErrorKind::NoDefaultPnpm => write!(
+                f,
+                "pnpm is not available.
+
+Use `volta install pnpm` to select a default version (see `volta help install` for more info)."
+            ),
+            ErrorKind::NoDefaultYarn => write!(
+                f,
+                "Yarn is not available.
+
+Use `volta install yarn` to select a default version (see `volta help install` for more info)."
+            ),
+            ErrorKind::NpmLinkMissingPackage { package } => write!(
+                f,
+                "Could not locate the package '{}'
+
+Please ensure it is available by running `npm link` in its source directory.",
+                package
+            ),
+            ErrorKind::NpmLinkWrongManager { package } => write!(
+                f,
+                "The package '{}' was not installed using npm and cannot be linked with `npm link`
+
+Please ensure it is linked with `npm link` or installed with `npm i -g {0}`.",
+                package
+            ),
+            ErrorKind::NpmVersionNotFound { matching } => write!(
+                f,
+                r#"Could not find Node version matching "{}" in the version registry.
+
+Please verify that the version is correct."#,
+                matching
+            ),
+            ErrorKind::NpxNotAvailable { version } => write!(
+                f,
+                "'npx' is only available with npm >= 5.2.0
+
+This project is configured to use version {} of npm.",
+                version
+            ),
+            ErrorKind::PackageInstallFailed { package } => write!(
+                f,
+                "Could not install package '{}'
+
+Please confirm the package is valid and run with `--verbose` for more diagnostics.",
+                package
+            ),
+            ErrorKind::PackageManifestParseError { package } => write!(
+                f,
+                "Could not parse package.json manifest for {}
+
+Please ensure the package includes a valid manifest file.",
+                package
+            ),
+            ErrorKind::PackageManifestReadError { package } => write!(
+                f,
+                "Could not read package.json manifest for {}
+
+Please ensure the package includes a valid manifest file.",
+                package
+            ),
+            ErrorKind::PackageNotFound { package } => write!(
+                f,
+                "Could not find '{}' in the package registry.
+
+Please verify the requested package is correct.",
+                package
+            ),
+            ErrorKind::PackageParseError { file } => write!(
+                f,
+                "Could not parse project manifest
+at {}
+
+Please ensure that the file is correctly formatted.",
+                file.display()
+            ),
+            ErrorKind::PackageReadError { file } => write!(
+                f,
+                "Could not read project manifest
+from {}
+
+Please ensure that the file exists.",
+                file.display()
+            ),
+            ErrorKind::PackageUnpackError => write!(
+                f,
+                "Could not determine package directory layout.
+
+Please ensure the package is correctly formatted."
+            ),
+            ErrorKind::PackageWriteError { file } => write!(
+                f,
+                "Could not write project manifest
+to {}
+
+Please ensure you have correct permissions.",
+                file.display()
+            ),
+            ErrorKind::ParseBinConfigError => write!(
+                f,
+                "Could not parse executable configuration file.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::ParseHooksError { file } => write!(
+                f,
+                "Could not parse hooks configuration file.
+from {}
+
+Please ensure the file is correctly formatted.",
+                file.display()
+            ),
+            ErrorKind::ParseNodeIndexCacheError => write!(
+                f,
+                "Could not parse Node index cache file.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::ParseNodeIndexError { from_url } => write!(
+                f,
+                "Could not parse Node version index
+from {}
+
+Please verify your internet connection.",
+                from_url
+            ),
+            ErrorKind::ParseNodeIndexExpiryError => write!(
+                f,
+                "Could not parse Node index cache expiration file.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::ParseNpmManifestError => write!(
+                f,
+                "Could not parse package.json file for bundled npm.
+
+Please ensure the version of Node is correct."
+            ),
+            ErrorKind::ParsePackageConfigError => write!(
+                f,
+                "Could not parse package configuration file.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::ParsePlatformError => write!(
+                f,
+                "Could not parse platform settings file.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::ParseToolSpecError { tool_spec } => write!(
+                f,
+                "Could not parse tool spec `{}`
+
+Please supply a spec in the format `<tool name>[@<version>]`.",
+                tool_spec
+            ),
+            ErrorKind::PersistInventoryError { tool } => write!(
+                f,
+                "Could not store {} archive in inventory cache
+
+{}",
+                tool, PERMISSIONS_CTA
+            ),
+            ErrorKind::PnpmVersionNotFound { matching } => write!(
+                f,
+                r#"Could not find pnpm version matching "{}" in the version registry.
+
+Please verify that the version is correct."#,
+                matching
+            ),
+            ErrorKind::ProjectLocalBinaryExecError { command } => write!(
+                f,
+                "Could not execute `{}`
+
+Please ensure you have correct permissions to access the file.",
+                command
+            ),
+            ErrorKind::ProjectLocalBinaryNotFound { command } => write!(
+                f,
+                "Could not locate executable `{}` in your project.
+
+Please ensure that all project dependencies are installed with `npm install` or `yarn install`",
+                command
+            ),
+            ErrorKind::PublishHookBothUrlAndBin => write!(
+                f,
+                "Publish hook configuration includes both hook types.
+
+Please include only one of 'bin' or 'url'"
+            ),
+            ErrorKind::PublishHookNeitherUrlNorBin => write!(
+                f,
+                "Publish hook configuration includes no hook types.
+
+Please include one of 'bin' or 'url'"
+            ),
+            ErrorKind::ReadBinConfigDirError { dir } => write!(
+                f,
+                "Could not read executable metadata directory
+at {}
+
+{}",
+                dir.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadBinConfigError { file } => write!(
+                f,
+                "Could not read executable configuration
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadDefaultNpmError { file } => write!(
+                f,
+                "Could not read default npm version
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadDirError { dir } => write!(
+                f,
+                "Could not read contents from directory {}
+
+{}",
+                dir.display(), PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadHooksError { file } => write!(
+                f,
+                "Could not read hooks file
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadNodeIndexCacheError { file } => write!(
+                f,
+                "Could not read Node index cache
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadNodeIndexExpiryError { file } => write!(
+                f,
+                "Could not read Node index cache expiration
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadNpmManifestError => write!(
+                f,
+                "Could not read package.json file for bundled npm.
+
+Please ensure the version of Node is correct."
+            ),
+            ErrorKind::ReadPackageConfigError { file } => write!(
+                f,
+                "Could not read package configuration file
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ReadPlatformError { file } => write!(
+                f,
+                "Could not read default platform file
+from {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            #[cfg(windows)]
+            ErrorKind::ReadUserPathError => write!(
+                f,
+                "Could not read user Path environment variable.
+
+Please ensure you have access to the your environment variables."
+            ),
+            ErrorKind::RegistryFetchError { tool, from_url } => write!(
+                f,
+                "Could not download {} version registry
+from {}
+
+Please verify your internet connection.",
+                tool, from_url
+            ),
+            ErrorKind::RunShimDirectly => write!(
+                f,
+                "'volta-shim' should not be called directly.
+
+Please use the existing shims provided by Volta (node, yarn, etc.) to run tools."
+            ),
+            ErrorKind::SetToolExecutable { tool } => write!(
+                f,
+                r#"Could not set "{}" to executable
+
+{}"#,
+                tool, PERMISSIONS_CTA
+            ),
+            ErrorKind::SetupToolImageError { tool, version, dir } => write!(
+                f,
+                "Could not create environment for {} v{}
+at {}
+
+{}",
+                tool,
+                version,
+                dir.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::ShimCreateError { name } => write!(
+                f,
+                r#"Could not create shim for "{}"
+
+{}"#,
+                name, PERMISSIONS_CTA
+            ),
+            ErrorKind::ShimRemoveError { name } => write!(
+                f,
+                r#"Could not remove shim for "{}"
+
+{}"#,
+                name, PERMISSIONS_CTA
+            ),
+            ErrorKind::StringifyBinConfigError => write!(
+                f,
+                "Could not serialize executable configuration.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::StringifyPackageConfigError => write!(
+                f,
+                "Could not serialize package configuration.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::StringifyPlatformError => write!(
+                f,
+                "Could not serialize platform settings.
+
+{}",
+                REPORT_BUG_CTA
+            ),
+            ErrorKind::Unimplemented { feature } => {
+                write!(f, "{} is not supported yet.", feature)
+            }
+            ErrorKind::UnpackArchiveError { tool, version } => write!(
+                f,
+                "Could not unpack {} v{}
+
+Please ensure the correct version is specified.",
+                tool, version
+            ),
+            ErrorKind::UpgradePackageNotFound { package, manager } => write!(
+                f,
+                r#"Could not locate the package '{}' to upgrade.
+
+Please ensure it is installed with `{} {0}`"#,
+                package,
+                match manager {
+                    PackageManager::Npm => "npm i -g",
+                    PackageManager::Pnpm => "pnpm add -g",
+                    PackageManager::Yarn => "yarn global add",
+                }
+            ),
+            ErrorKind::UpgradePackageWrongManager { package, manager } => {
+                let (name, command) = match manager {
+                    PackageManager::Npm => ("npm", "npm update -g"),
+                    PackageManager::Pnpm => ("pnpm", "pnpm update -g"),
+                    PackageManager::Yarn => ("Yarn", "yarn global upgrade"),
+                };
+                write!(
+                    f,
+                    r#"The package '{}' was installed using {}.
+
+To upgrade it, please use the command `{} {0}`"#,
+                    package, name, command
+                )
+            }
+            ErrorKind::VersionParseError { version } => write!(
+                f,
+                r#"Could not parse version "{}"
+
+Please verify the intended version."#,
+                version
+            ),
+            ErrorKind::WriteBinConfigError { file } => write!(
+                f,
+                "Could not write executable configuration
+to {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::WriteDefaultNpmError { file } => write!(
+                f,
+                "Could not write bundled npm version
+to {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::WriteLauncherError { tool } => write!(
+                f,
+                "Could not set up launcher for {}
+
+This is most likely an intermittent failure, please try again.",
+                tool
+            ),
+            ErrorKind::WriteNodeIndexCacheError { file } => write!(
+                f,
+                "Could not write Node index cache
+to {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::WriteNodeIndexExpiryError { file } => write!(
+                f,
+                "Could not write Node index cache expiration
+to {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::WritePackageConfigError { file } => write!(
+                f,
+                "Could not write package configuration
+to {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            ErrorKind::WritePlatformError { file } => write!(
+                f,
+                "Could not save platform settings
+to {}
+
+{}",
+                file.display(),
+                PERMISSIONS_CTA
+            ),
+            #[cfg(windows)]
+            ErrorKind::WriteUserPathError => write!(
+                f,
+                "Could not write Path environment variable.
+
+Please ensure you have permissions to edit your environment variables."
+            ),
+            ErrorKind::Yarn2NotSupported => write!(
+                f,
+                "Yarn version 2 is not recommended for use, and not supported by Volta.
+
+Please use version 3 or greater instead."
+            ),
+            ErrorKind::YarnLatestFetchError { from_url } => write!(
+                f,
+                "Could not fetch latest version of Yarn
+from {}
+
+Please verify your internet connection.",
+                from_url
+            ),
+            ErrorKind::YarnVersionNotFound { matching } => write!(
+                f,
+                r#"Could not find Yarn version matching "{}" in the version registry.
+
+Please verify that the version is correct."#,
+                matching
+            ),
+        }
+    }
+}
+
+impl ErrorKind {
+    pub fn exit_code(&self) -> ExitCode {
+        match self {
+            ErrorKind::BinaryAlreadyInstalled { .. } => ExitCode::FileSystemError,
+            ErrorKind::BinaryExecError => ExitCode::ExecutionFailure,
+            ErrorKind::BinaryNotFound { .. } => ExitCode::ExecutableNotFound,
+            ErrorKind::BuildPathError => ExitCode::EnvironmentError,
+            ErrorKind::BypassError { .. } => ExitCode::ExecutionFailure,
+            ErrorKind::CannotFetchPackage { .. } => ExitCode::InvalidArguments,
+            ErrorKind::CannotPinPackage { .. } => ExitCode::InvalidArguments,
+            ErrorKind::CompletionsOutFileError { .. } => ExitCode::InvalidArguments,
+            ErrorKind::ContainingDirError { .. } => ExitCode::FileSystemError,
+            ErrorKind::CouldNotDetermineTool => ExitCode::UnknownError,
+            ErrorKind::CouldNotStartMigration => ExitCode::EnvironmentError,
+            ErrorKind::CreateDirError { .. } => ExitCode::FileSystemError,
+            ErrorKind::CreateLayoutFileError { .. } => ExitCode::FileSystemError,
+            ErrorKind::CreateSharedLinkError { .. } => ExitCode::FileSystemError,
+            ErrorKind::CreateTempDirError { .. } => ExitCode::FileSystemError,
+            ErrorKind::CreateTempFileError { .. } => ExitCode::FileSystemError,
+            ErrorKind::CurrentDirError => ExitCode::EnvironmentError,
+            ErrorKind::DeleteDirectoryError { .. } => ExitCode::FileSystemError,
+            ErrorKind::DeleteFileError { .. } => ExitCode::FileSystemError,
+            ErrorKind::DeprecatedCommandError { .. } => ExitCode::InvalidArguments,
+            ErrorKind::DownloadToolNetworkError { .. } => ExitCode::NetworkError,
+            ErrorKind::ExecuteHookError { .. } => ExitCode::ExecutionFailure,
+            ErrorKind::ExtensionCycleError { .. } => ExitCode::ConfigurationError,
+            ErrorKind::ExtensionPathError { .. } => ExitCode::FileSystemError,
+            ErrorKind::HookCommandFailed { .. } => ExitCode::ConfigurationError,
+            ErrorKind::HookMultipleFieldsSpecified => ExitCode::ConfigurationError,
+            ErrorKind::HookNoFieldsSpecified => ExitCode::ConfigurationError,
+            ErrorKind::HookPathError { .. } => ExitCode::ConfigurationError,
+            ErrorKind::InstalledPackageNameError => ExitCode::UnknownError,
+            ErrorKind::InvalidHookCommand { .. } => ExitCode::ExecutableNotFound,
+            ErrorKind::InvalidHookOutput { .. } => ExitCode::ExecutionFailure,
+            ErrorKind::InvalidInvocation { .. } => ExitCode::InvalidArguments,
+            ErrorKind::InvalidInvocationOfBareVersion { .. } => ExitCode::InvalidArguments,
+            ErrorKind::InvalidRegistryFormat { .. } => ExitCode::ConfigurationError,
+            ErrorKind::InvalidToolName { .. } => ExitCode::InvalidArguments,
+            ErrorKind::LockAcquireError => ExitCode::FileSystemError,
+            ErrorKind::NoBundledNpm { .. } => ExitCode::ConfigurationError,
+            ErrorKind::NoCommandLinePnpm => ExitCode::ConfigurationError,
+            ErrorKind::NoCommandLineYarn => ExitCode::ConfigurationError,
+            ErrorKind::NoDefaultNodeVersion { .. } => ExitCode::ConfigurationError,
+            ErrorKind::NodeVersionNotFound { .. } => ExitCode::NoVersionMatch,
+            ErrorKind::NoHomeEnvironmentVar => ExitCode::EnvironmentError,
+            ErrorKind::NoInstallDir => ExitCode::EnvironmentError,
+            ErrorKind::NoLocalDataDir => ExitCode::EnvironmentError,
+            ErrorKind::NoPinnedNodeVersion { .. } => ExitCode::ConfigurationError,
+            ErrorKind::NoPlatform => ExitCode::ConfigurationError,
+            ErrorKind::NoProjectNodeInManifest => ExitCode::ConfigurationError,
+            ErrorKind::NoProjectPnpm => ExitCode::ConfigurationError,
+            ErrorKind::NoProjectYarn => ExitCode::ConfigurationError,
+            ErrorKind::NoShellProfile { .. } => ExitCode::EnvironmentError,
+            ErrorKind::NotInPackage => ExitCode::ConfigurationError,
+            ErrorKind::NoDefaultPnpm => ExitCode::ConfigurationError,
+            ErrorKind::NoDefaultYarn => ExitCode::ConfigurationError,
+            ErrorKind::NpmLinkMissingPackage { .. } => ExitCode::ConfigurationError,
+            ErrorKind::NpmLinkWrongManager { .. } => ExitCode::ConfigurationError,
+            ErrorKind::NpmVersionNotFound { .. } => ExitCode::NoVersionMatch,
+            ErrorKind::NpxNotAvailable { .. } => ExitCode::ExecutableNotFound,
+            ErrorKind::PackageInstallFailed { .. } => ExitCode::UnknownError,
+            ErrorKind::PackageManifestParseError { .. } => ExitCode::ConfigurationError,
+            ErrorKind::PackageManifestReadError { .. } => ExitCode::FileSystemError,
+            ErrorKind::PackageNotFound { .. } => ExitCode::InvalidArguments,
+            ErrorKind::PackageParseError { .. } => ExitCode::ConfigurationError,
+            ErrorKind::PackageReadError { .. } => ExitCode::FileSystemError,
+            ErrorKind::PackageUnpackError => ExitCode::ConfigurationError,
+            ErrorKind::PackageWriteError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ParseBinConfigError => ExitCode::UnknownError,
+            ErrorKind::ParseHooksError { .. } => ExitCode::ConfigurationError,
+            ErrorKind::ParseToolSpecError { .. } => ExitCode::InvalidArguments,
+            ErrorKind::ParseNodeIndexCacheError => ExitCode::UnknownError,
+            ErrorKind::ParseNodeIndexError { .. } => ExitCode::NetworkError,
+            ErrorKind::ParseNodeIndexExpiryError => ExitCode::UnknownError,
+            ErrorKind::ParseNpmManifestError => ExitCode::UnknownError,
+            ErrorKind::ParsePackageConfigError => ExitCode::UnknownError,
+            ErrorKind::ParsePlatformError => ExitCode::ConfigurationError,
+            ErrorKind::PersistInventoryError { .. } => ExitCode::FileSystemError,
+            ErrorKind::PnpmVersionNotFound { .. } => ExitCode::NoVersionMatch,
+            ErrorKind::ProjectLocalBinaryExecError { .. } => ExitCode::ExecutionFailure,
+            ErrorKind::ProjectLocalBinaryNotFound { .. } => ExitCode::FileSystemError,
+            ErrorKind::PublishHookBothUrlAndBin => ExitCode::ConfigurationError,
+            ErrorKind::PublishHookNeitherUrlNorBin => ExitCode::ConfigurationError,
+            ErrorKind::ReadBinConfigDirError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadBinConfigError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadDefaultNpmError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadDirError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadHooksError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadNodeIndexCacheError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadNodeIndexExpiryError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadNpmManifestError => ExitCode::UnknownError,
+            ErrorKind::ReadPackageConfigError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ReadPlatformError { .. } => ExitCode::FileSystemError,
+            #[cfg(windows)]
+            ErrorKind::ReadUserPathError => ExitCode::EnvironmentError,
+            ErrorKind::RegistryFetchError { .. } => ExitCode::NetworkError,
+            ErrorKind::RunShimDirectly => ExitCode::InvalidArguments,
+            ErrorKind::SetupToolImageError { .. } => ExitCode::FileSystemError,
+            ErrorKind::SetToolExecutable { .. } => ExitCode::FileSystemError,
+            ErrorKind::ShimCreateError { .. } => ExitCode::FileSystemError,
+            ErrorKind::ShimRemoveError { .. } => ExitCode::FileSystemError,
+            ErrorKind::StringifyBinConfigError => ExitCode::UnknownError,
+            ErrorKind::StringifyPackageConfigError => ExitCode::UnknownError,
+            ErrorKind::StringifyPlatformError => ExitCode::UnknownError,
+            ErrorKind::Unimplemented { .. } => ExitCode::UnknownError,
+            ErrorKind::UnpackArchiveError { .. } => ExitCode::UnknownError,
+            ErrorKind::UpgradePackageNotFound { .. } => ExitCode::ConfigurationError,
+            ErrorKind::UpgradePackageWrongManager { .. } => ExitCode::ConfigurationError,
+            ErrorKind::VersionParseError { .. } => ExitCode::NoVersionMatch,
+            ErrorKind::WriteBinConfigError { .. } => ExitCode::FileSystemError,
+            ErrorKind::WriteDefaultNpmError { .. } => ExitCode::FileSystemError,
+            ErrorKind::WriteLauncherError { .. } => ExitCode::FileSystemError,
+            ErrorKind::WriteNodeIndexCacheError { .. } => ExitCode::FileSystemError,
+            ErrorKind::WriteNodeIndexExpiryError { .. } => ExitCode::FileSystemError,
+            ErrorKind::WritePackageConfigError { .. } => ExitCode::FileSystemError,
+            ErrorKind::WritePlatformError { .. } => ExitCode::FileSystemError,
+            #[cfg(windows)]
+            ErrorKind::WriteUserPathError => ExitCode::EnvironmentError,
+            ErrorKind::Yarn2NotSupported => ExitCode::NoVersionMatch,
+            ErrorKind::YarnLatestFetchError { .. } => ExitCode::NetworkError,
+            ErrorKind::YarnVersionNotFound { .. } => ExitCode::NoVersionMatch,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/error/mod.rs.html b/main/src/volta_core/error/mod.rs.html new file mode 100644 index 000000000..2e916c3a0 --- /dev/null +++ b/main/src/volta_core/error/mod.rs.html @@ -0,0 +1,261 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+
use std::error::Error;
+use std::fmt;
+use std::process::exit;
+
+mod kind;
+mod reporter;
+
+pub use kind::ErrorKind;
+pub use reporter::report_error;
+
+pub type Fallible<T> = Result<T, VoltaError>;
+
+/// Error type for Volta
+#[derive(Debug)]
+pub struct VoltaError {
+    inner: Box<Inner>,
+}
+
+#[derive(Debug)]
+struct Inner {
+    kind: ErrorKind,
+    source: Option<Box<dyn Error>>,
+}
+
+impl VoltaError {
+    /// The exit code Volta should use when this error stops execution
+    pub fn exit_code(&self) -> ExitCode {
+        self.inner.kind.exit_code()
+    }
+
+    /// Create a new VoltaError instance including a source error
+    pub fn from_source<E>(source: E, kind: ErrorKind) -> Self
+    where
+        E: Into<Box<dyn Error>>,
+    {
+        VoltaError {
+            inner: Box::new(Inner {
+                kind,
+                source: Some(source.into()),
+            }),
+        }
+    }
+
+    /// Get a reference to the ErrorKind for this error
+    pub fn kind(&self) -> &ErrorKind {
+        &self.inner.kind
+    }
+}
+
+impl fmt::Display for VoltaError {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        self.inner.kind.fmt(f)
+    }
+}
+
+impl Error for VoltaError {
+    fn source(&self) -> Option<&(dyn Error + 'static)> {
+        self.inner.source.as_ref().map(|b| b.as_ref())
+    }
+}
+
+impl From<ErrorKind> for VoltaError {
+    fn from(kind: ErrorKind) -> Self {
+        VoltaError {
+            inner: Box::new(Inner { kind, source: None }),
+        }
+    }
+}
+
+/// Trait providing the with_context method to easily convert any Result error into a VoltaError
+pub trait Context<T> {
+    fn with_context<F>(self, f: F) -> Fallible<T>
+    where
+        F: FnOnce() -> ErrorKind;
+}
+
+impl<T, E> Context<T> for Result<T, E>
+where
+    E: Error + 'static,
+{
+    fn with_context<F>(self, f: F) -> Fallible<T>
+    where
+        F: FnOnce() -> ErrorKind,
+    {
+        self.map_err(|e| VoltaError::from_source(e, f()))
+    }
+}
+
+/// Exit codes supported by Volta Errors
+#[derive(Copy, Clone, Debug)]
+pub enum ExitCode {
+    /// No error occurred.
+    Success = 0,
+
+    /// An unknown error occurred.
+    UnknownError = 1,
+
+    /// An invalid combination of command-line arguments was supplied.
+    InvalidArguments = 3,
+
+    /// No match could be found for the requested version string.
+    NoVersionMatch = 4,
+
+    /// A network error occurred.
+    NetworkError = 5,
+
+    /// A required environment variable was unset or invalid.
+    EnvironmentError = 6,
+
+    /// A file could not be read or written.
+    FileSystemError = 7,
+
+    /// Package configuration is missing or incorrect.
+    ConfigurationError = 8,
+
+    /// The command or feature is not yet implemented.
+    NotYetImplemented = 9,
+
+    /// The requested executable could not be run.
+    ExecutionFailure = 126,
+
+    /// The requested executable is not available.
+    ExecutableNotFound = 127,
+}
+
+impl ExitCode {
+    pub fn exit(self) -> ! {
+        exit(self as i32);
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/error/reporter.rs.html b/main/src/volta_core/error/reporter.rs.html new file mode 100644 index 000000000..73804423b --- /dev/null +++ b/main/src/volta_core/error/reporter.rs.html @@ -0,0 +1,201 @@ +reporter.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+
use std::env::args_os;
+use std::error::Error;
+use std::fs::File;
+use std::io::Write;
+use std::path::PathBuf;
+
+use super::VoltaError;
+use crate::layout::volta_home;
+use crate::style::format_error_cause;
+use chrono::Local;
+use ci_info::is_ci;
+use console::strip_ansi_codes;
+use fs_utils::ensure_containing_dir_exists;
+use log::{debug, error};
+
+/// Report an error, both to the console and to error logs
+pub fn report_error(volta_version: &str, err: &VoltaError) {
+    let message = err.to_string();
+    error!("{}", message);
+
+    if let Some(details) = compose_error_details(err) {
+        if is_ci() {
+            // In CI, we write the error details to the log so that they are available in the CI logs
+            // A log file may not even exist by the time the user is reviewing a failure
+            error!("{}", details);
+        } else {
+            // Outside of CI, we write the error details as Debug (Verbose) information
+            // And we write an actual error log that the user can review
+            debug!("{}", details);
+
+            // Note: Writing the error log info directly to stderr as it is a message for the user
+            // Any custom logs will have all of the details already, so showing a message about writing
+            // the error log would be redundant
+            match write_error_log(volta_version, message, details) {
+                Ok(log_file) => {
+                    eprintln!("Error details written to {}", log_file.to_string_lossy());
+                }
+                Err(_) => {
+                    eprintln!("Unable to write error log!");
+                }
+            }
+        }
+    }
+}
+
+/// Write an error log with all details about the error
+fn write_error_log(
+    volta_version: &str,
+    message: String,
+    details: String,
+) -> Result<PathBuf, Box<dyn Error>> {
+    let file_name = Local::now()
+        .format("volta-error-%Y-%m-%d_%H_%M_%S%.3f.log")
+        .to_string();
+    let log_file_path = volta_home()?.log_dir().join(file_name);
+
+    ensure_containing_dir_exists(&log_file_path)?;
+    let mut log_file = File::create(&log_file_path)?;
+
+    writeln!(log_file, "{}", collect_arguments())?;
+    writeln!(log_file, "Volta v{}", volta_version)?;
+    writeln!(log_file)?;
+    writeln!(log_file, "{}", strip_ansi_codes(&message))?;
+    writeln!(log_file)?;
+    writeln!(log_file, "{}", strip_ansi_codes(&details))?;
+
+    Ok(log_file_path)
+}
+
+fn compose_error_details(err: &VoltaError) -> Option<String> {
+    // Only compose details if there is an underlying cause for the error
+    let mut current = err.source()?;
+    let mut details = String::new();
+
+    // Walk up the tree of causes and include all of them
+    loop {
+        details.push_str(&format_error_cause(current));
+
+        match current.source() {
+            Some(cause) => {
+                details.push_str("\n\n");
+                current = cause;
+            }
+            None => {
+                break;
+            }
+        };
+    }
+
+    Some(details)
+}
+
+/// Combines all the arguments into a single String
+fn collect_arguments() -> String {
+    // The Debug formatter for OsString properly quotes and escapes each value
+    args_os()
+        .map(|arg| format!("{:?}", arg))
+        .collect::<Vec<String>>()
+        .join(" ")
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/event.rs.html b/main/src/volta_core/event.rs.html new file mode 100644 index 000000000..ca3e89d09 --- /dev/null +++ b/main/src/volta_core/event.rs.html @@ -0,0 +1,423 @@ +event.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+
//! Events for the sessions in executables and shims and everything
+
+use std::env;
+use std::time::{SystemTime, UNIX_EPOCH};
+
+use serde::{Deserialize, Serialize};
+
+use crate::error::{ExitCode, VoltaError};
+use crate::hook::Publish;
+use crate::monitor::send_events;
+use crate::session::ActivityKind;
+
+// the Event data that is serialized to JSON and sent the plugin
+#[derive(Deserialize, Serialize)]
+pub struct Event {
+    timestamp: u64,
+    pub name: String,
+    pub event: EventKind,
+}
+
+#[derive(Deserialize, Serialize, PartialEq, Eq, Debug)]
+pub struct ErrorEnv {
+    argv: String,
+    exec_path: String,
+    path: String,
+    platform: String,
+    platform_version: String,
+}
+
+#[derive(Deserialize, Serialize, PartialEq, Eq, Debug)]
+#[serde(rename_all = "lowercase")]
+pub enum EventKind {
+    Start,
+    End {
+        exit_code: i32,
+    },
+    Error {
+        exit_code: i32,
+        error: String,
+        env: ErrorEnv,
+    },
+    ToolEnd {
+        exit_code: i32,
+    },
+    Args {
+        argv: String,
+    },
+}
+
+impl EventKind {
+    pub fn into_event(self, activity_kind: ActivityKind) -> Event {
+        Event {
+            timestamp: unix_timestamp(),
+            name: activity_kind.to_string(),
+            event: self,
+        }
+    }
+}
+
+// returns the current number of milliseconds since the epoch
+fn unix_timestamp() -> u64 {
+    let start = SystemTime::now();
+    let duration = start
+        .duration_since(UNIX_EPOCH)
+        .expect("Time went backwards");
+    let nanosecs_since_epoch = duration.as_secs() * 1_000_000_000 + duration.subsec_nanos() as u64;
+    nanosecs_since_epoch / 1_000_000
+}
+
+fn get_error_env() -> ErrorEnv {
+    let path = match env::var("PATH") {
+        Ok(p) => p,
+        Err(_e) => "error: Unable to get path from environment".to_string(),
+    };
+    let argv = env::args().collect::<Vec<String>>().join(" ");
+    let exec_path = match env::current_exe() {
+        Ok(ep) => ep.display().to_string(),
+        Err(_e) => "error: Unable to get executable path from environment".to_string(),
+    };
+
+    let info = os_info::get();
+    let platform = info.os_type().to_string();
+    let platform_version = info.version().to_string();
+
+    ErrorEnv {
+        argv,
+        exec_path,
+        path,
+        platform,
+        platform_version,
+    }
+}
+
+pub struct EventLog {
+    events: Vec<Event>,
+}
+
+impl EventLog {
+    /// Constructs a new 'EventLog'
+    pub fn init() -> Self {
+        EventLog { events: Vec::new() }
+    }
+
+    pub fn add_event_start(&mut self, activity_kind: ActivityKind) {
+        self.add_event(EventKind::Start, activity_kind)
+    }
+    pub fn add_event_end(&mut self, activity_kind: ActivityKind, exit_code: ExitCode) {
+        self.add_event(
+            EventKind::End {
+                exit_code: exit_code as i32,
+            },
+            activity_kind,
+        )
+    }
+    pub fn add_event_tool_end(&mut self, activity_kind: ActivityKind, exit_code: i32) {
+        self.add_event(EventKind::ToolEnd { exit_code }, activity_kind)
+    }
+    pub fn add_event_error(&mut self, activity_kind: ActivityKind, error: &VoltaError) {
+        self.add_event(
+            EventKind::Error {
+                exit_code: error.exit_code() as i32,
+                error: error.to_string(),
+                env: get_error_env(),
+            },
+            activity_kind,
+        )
+    }
+    pub fn add_event_args(&mut self) {
+        let argv = env::args_os()
+            .enumerate()
+            .fold(String::new(), |mut result, (i, arg)| {
+                if i > 0 {
+                    result.push(' ');
+                }
+                result.push_str(&arg.to_string_lossy());
+                result
+            });
+        self.add_event(EventKind::Args { argv }, ActivityKind::Args)
+    }
+
+    fn add_event(&mut self, event_kind: EventKind, activity_kind: ActivityKind) {
+        let event = event_kind.into_event(activity_kind);
+        self.events.push(event);
+    }
+
+    pub fn publish(&self, plugin: Option<&Publish>) {
+        match plugin {
+            // Note: This call to unimplemented is left in, as it's not a Fallible operation that can use ErrorKind::Unimplemented
+            Some(Publish::Url(_)) => unimplemented!(),
+            Some(Publish::Bin(command)) => {
+                send_events(command, &self.events);
+            }
+            None => {}
+        }
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use super::{EventKind, EventLog};
+    use crate::error::{ErrorKind, ExitCode};
+    use crate::session::ActivityKind;
+    use regex::Regex;
+
+    #[test]
+    fn test_adding_events() {
+        let mut event_log = EventLog::init();
+        assert_eq!(event_log.events.len(), 0);
+
+        event_log.add_event_start(ActivityKind::Current);
+        assert_eq!(event_log.events.len(), 1);
+        assert_eq!(event_log.events[0].name, "current");
+        assert_eq!(event_log.events[0].event, EventKind::Start);
+
+        event_log.add_event_end(ActivityKind::Pin, ExitCode::NetworkError);
+        assert_eq!(event_log.events.len(), 2);
+        assert_eq!(event_log.events[1].name, "pin");
+        assert_eq!(event_log.events[1].event, EventKind::End { exit_code: 5 });
+
+        event_log.add_event_tool_end(ActivityKind::Version, 12);
+        assert_eq!(event_log.events.len(), 3);
+        assert_eq!(event_log.events[2].name, "version");
+        assert_eq!(
+            event_log.events[2].event,
+            EventKind::ToolEnd { exit_code: 12 }
+        );
+
+        let error = ErrorKind::BinaryExecError.into();
+        event_log.add_event_error(ActivityKind::Install, &error);
+        assert_eq!(event_log.events.len(), 4);
+        assert_eq!(event_log.events[3].name, "install");
+        // not checking the error because it has too much machine-specific info
+
+        event_log.add_event_args();
+        assert_eq!(event_log.events.len(), 5);
+        assert_eq!(event_log.events[4].name, "args");
+        match event_log.events[4].event {
+            EventKind::Args { ref argv } => {
+                let re = Regex::new("volta_core").unwrap();
+                assert!(re.is_match(argv));
+            }
+            _ => {
+                panic!(
+                    "Expected EventKind::Args {{ argv }}, Got: {:?}",
+                    event_log.events[4].event
+                );
+            }
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/fs.rs.html b/main/src/volta_core/fs.rs.html new file mode 100644 index 000000000..437c824ab --- /dev/null +++ b/main/src/volta_core/fs.rs.html @@ -0,0 +1,389 @@ +fs.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+
//! Provides utilities for operating on the filesystem.
+
+use std::fs::{self, create_dir_all, read_dir, DirEntry, File, Metadata};
+use std::io;
+#[cfg(unix)]
+use std::os::unix::fs::PermissionsExt;
+use std::path::Path;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::layout::volta_home;
+use retry::delay::Fibonacci;
+use retry::{retry, OperationResult};
+use tempfile::{tempdir_in, NamedTempFile, TempDir};
+
+/// Opens a file, creating it if it doesn't exist
+pub fn touch(path: &Path) -> io::Result<File> {
+    if !path.is_file() {
+        if let Some(basedir) = path.parent() {
+            create_dir_all(basedir)?;
+        }
+        File::create(path)?;
+    }
+    File::open(path)
+}
+
+/// Removes the target directory, if it exists. If the directory doesn't exist, that is treated as
+/// success.
+pub fn remove_dir_if_exists<P: AsRef<Path>>(path: P) -> Fallible<()> {
+    fs::remove_dir_all(&path)
+        .or_else(ok_if_not_found)
+        .with_context(|| ErrorKind::DeleteDirectoryError {
+            directory: path.as_ref().to_owned(),
+        })
+}
+
+/// Removes the target file, if it exists. If the file doesn't exist, that is treated as success.
+pub fn remove_file_if_exists<P: AsRef<Path>>(path: P) -> Fallible<()> {
+    fs::remove_file(&path)
+        .or_else(ok_if_not_found)
+        .with_context(|| ErrorKind::DeleteFileError {
+            file: path.as_ref().to_owned(),
+        })
+}
+
+/// Converts a failure because of file not found into a success.
+///
+/// Handling the error is preferred over checking if a file exists before removing it, since
+/// that avoids a potential race condition between the check and the removal.
+pub fn ok_if_not_found<T: Default>(err: io::Error) -> io::Result<T> {
+    match err.kind() {
+        io::ErrorKind::NotFound => Ok(T::default()),
+        _ => Err(err),
+    }
+}
+
+/// Reads a file, if it exists.
+pub fn read_file<P: AsRef<Path>>(path: P) -> io::Result<Option<String>> {
+    let result: io::Result<String> = fs::read_to_string(path);
+
+    match result {
+        Ok(string) => Ok(Some(string)),
+        Err(error) => match error.kind() {
+            io::ErrorKind::NotFound => Ok(None),
+            _ => Err(error),
+        },
+    }
+}
+
+/// Reads the full contents of a directory, eagerly extracting each directory entry
+/// and its metadata and returning an iterator over them. Returns `Error` if any of
+/// these steps fails.
+///
+/// This function makes it easier to write high level logic for manipulating the
+/// contents of directories (map, filter, etc).
+///
+/// Note that this function allocates an intermediate vector of directory entries to
+/// construct the iterator from, so if a directory is expected to be very large, it
+/// will allocate temporary data proportional to the number of entries.
+pub fn read_dir_eager(dir: &Path) -> io::Result<impl Iterator<Item = (DirEntry, Metadata)>> {
+    let entries = read_dir(dir)?;
+    let vec = entries
+        .map(|entry| {
+            let entry = entry?;
+            let metadata = entry.metadata()?;
+            Ok((entry, metadata))
+        })
+        .collect::<io::Result<Vec<(DirEntry, Metadata)>>>()?;
+
+    Ok(vec.into_iter())
+}
+
+/// Reads the contents of a directory and returns a Vec of the matched results
+/// from the input function
+pub fn dir_entry_match<T, F>(dir: &Path, mut f: F) -> io::Result<Vec<T>>
+where
+    F: FnMut(&DirEntry) -> Option<T>,
+{
+    let entries = read_dir_eager(dir)?;
+    Ok(entries
+        .filter(|(_, metadata)| metadata.is_file())
+        .filter_map(|(entry, _)| f(&entry))
+        .collect::<Vec<T>>())
+}
+
+/// Creates a NamedTempFile in the Volta tmp directory
+pub fn create_staging_file() -> Fallible<NamedTempFile> {
+    let tmp_dir = volta_home()?.tmp_dir();
+    NamedTempFile::new_in(tmp_dir).with_context(|| ErrorKind::CreateTempFileError {
+        in_dir: tmp_dir.to_owned(),
+    })
+}
+
+/// Creates a staging directory in the Volta tmp directory
+pub fn create_staging_dir() -> Fallible<TempDir> {
+    let tmp_root = volta_home()?.tmp_dir();
+    tempdir_in(tmp_root).with_context(|| ErrorKind::CreateTempDirError {
+        in_dir: tmp_root.to_owned(),
+    })
+}
+
+/// Create a file symlink. The `dst` path will be a symbolic link pointing to the `src` path.
+pub fn symlink_file<S, D>(src: S, dest: D) -> io::Result<()>
+where
+    S: AsRef<Path>,
+    D: AsRef<Path>,
+{
+    #[cfg(windows)]
+    return std::os::windows::fs::symlink_file(src, dest);
+
+    #[cfg(unix)]
+    return std::os::unix::fs::symlink(src, dest);
+}
+
+/// Create a directory symlink. The `dst` path will be a symbolic link pointing to the `src` path
+pub fn symlink_dir<S, D>(src: S, dest: D) -> io::Result<()>
+where
+    S: AsRef<Path>,
+    D: AsRef<Path>,
+{
+    #[cfg(windows)]
+    return junction::create(src, dest);
+
+    #[cfg(unix)]
+    return std::os::unix::fs::symlink(src, dest);
+}
+
+/// Ensure that a given file has 'executable' permissions, otherwise we won't be able to call it
+#[cfg(unix)]
+pub fn set_executable(bin: &Path) -> io::Result<()> {
+    let mut permissions = fs::metadata(bin)?.permissions();
+    let mode = permissions.mode();
+
+    if mode & 0o111 != 0o111 {
+        permissions.set_mode(mode | 0o111);
+        fs::set_permissions(bin, permissions)
+    } else {
+        Ok(())
+    }
+}
+
+/// Ensure that a given file has 'executable' permissions, otherwise we won't be able to call it
+///
+/// Note: This is a no-op on Windows, which has no concept of 'executable' permissions
+#[cfg(windows)]
+pub fn set_executable(_bin: &Path) -> io::Result<()> {
+    Ok(())
+}
+
+/// Rename a file or directory to a new name, retrying if the operation fails because of permissions
+///
+/// Will retry for ~30 seconds with longer and longer delays between each, to allow for virus scan
+/// and other automated operations to complete.
+pub fn rename<F, T>(from: F, to: T) -> io::Result<()>
+where
+    F: AsRef<Path>,
+    T: AsRef<Path>,
+{
+    // 21 Fibonacci steps starting at 1 ms is ~28 seconds total
+    // See https://github.com/rust-lang/rustup/pull/1873 where this was used by Rustup to work around
+    // virus scanning file locks
+    let from = from.as_ref();
+    let to = to.as_ref();
+
+    retry(Fibonacci::from_millis(1).take(21), || {
+        match fs::rename(from, to) {
+            Ok(_) => OperationResult::Ok(()),
+            Err(e) => match e.kind() {
+                io::ErrorKind::PermissionDenied => OperationResult::Retry(e),
+                _ => OperationResult::Err(e),
+            },
+        }
+    })
+    .map_err(|e| e.error)
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/hook/mod.rs.html b/main/src/volta_core/hook/mod.rs.html new file mode 100644 index 000000000..3767cd1d3 --- /dev/null +++ b/main/src/volta_core/hook/mod.rs.html @@ -0,0 +1,1499 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+
//! Provides types for working with Volta hooks.
+
+use std::borrow::Cow;
+use std::fs::File;
+use std::iter::once;
+use std::marker::PhantomData;
+use std::path::Path;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::layout::volta_home;
+use crate::project::Project;
+use crate::tool::{Node, Npm, Pnpm, Tool};
+use log::debug;
+use once_cell::unsync::OnceCell;
+
+pub(crate) mod serial;
+pub mod tool;
+
+/// A hook for publishing Volta events.
+#[derive(PartialEq, Eq, Debug)]
+pub enum Publish {
+    /// Reports an event by sending a POST request to a URL.
+    Url(String),
+
+    /// Reports an event by forking a process and sending the event by IPC.
+    Bin(String),
+}
+
+/// Lazily loaded Volta hook configuration
+pub struct LazyHookConfig {
+    settings: OnceCell<HookConfig>,
+}
+
+impl LazyHookConfig {
+    /// Constructs a new `LazyHookConfig`
+    pub fn init() -> LazyHookConfig {
+        LazyHookConfig {
+            settings: OnceCell::new(),
+        }
+    }
+
+    /// Forces the loading of the hook configuration from both project-local and user-default hooks
+    pub fn get(&self, project: Option<&Project>) -> Fallible<&HookConfig> {
+        self.settings
+            .get_or_try_init(|| HookConfig::current(project))
+    }
+}
+
+/// Volta hook configuration
+pub struct HookConfig {
+    node: Option<ToolHooks<Node>>,
+    npm: Option<ToolHooks<Npm>>,
+    pnpm: Option<ToolHooks<Pnpm>>,
+    yarn: Option<YarnHooks>,
+    events: Option<EventHooks>,
+}
+
+/// Volta hooks for an individual tool
+pub struct ToolHooks<T: Tool> {
+    /// The hook for resolving the URL for a distro version
+    pub distro: Option<tool::DistroHook>,
+    /// The hook for resolving the URL for the latest version
+    pub latest: Option<tool::MetadataHook>,
+    /// The hook for resolving the Tool Index URL
+    pub index: Option<tool::MetadataHook>,
+
+    phantom: PhantomData<T>,
+}
+
+/// Volta hooks for Yarn
+pub struct YarnHooks {
+    /// The hook for resolving the URL for a distro version
+    pub distro: Option<tool::DistroHook>,
+    /// The hook for resolving the URL for the latest version
+    pub latest: Option<tool::MetadataHook>,
+    /// The hook for resolving the Tool Index URL
+    pub index: Option<tool::YarnIndexHook>,
+}
+
+impl<T: Tool> ToolHooks<T> {
+    /// Extends this ToolHooks with another, giving precendence to the current instance
+    fn merge(self, other: Self) -> Self {
+        Self {
+            distro: self.distro.or(other.distro),
+            latest: self.latest.or(other.latest),
+            index: self.index.or(other.index),
+            phantom: PhantomData,
+        }
+    }
+}
+
+impl YarnHooks {
+    /// Extends this YarnHooks with another, giving precendence to the current instance
+    fn merge(self, other: Self) -> Self {
+        Self {
+            distro: self.distro.or(other.distro),
+            latest: self.latest.or(other.latest),
+            index: self.index.or(other.index),
+        }
+    }
+}
+
+macro_rules! merge_hooks {
+    ($self:ident, $other:ident, $field:ident) => {
+        match ($self.$field, $other.$field) {
+            (Some(current), Some(other)) => Some(current.merge(other)),
+            (Some(single), None) | (None, Some(single)) => Some(single),
+            (None, None) => None,
+        }
+    };
+}
+
+impl HookConfig {
+    pub fn node(&self) -> Option<&ToolHooks<Node>> {
+        self.node.as_ref()
+    }
+
+    pub fn npm(&self) -> Option<&ToolHooks<Npm>> {
+        self.npm.as_ref()
+    }
+
+    pub fn pnpm(&self) -> Option<&ToolHooks<Pnpm>> {
+        self.pnpm.as_ref()
+    }
+
+    pub fn yarn(&self) -> Option<&YarnHooks> {
+        self.yarn.as_ref()
+    }
+
+    pub fn events(&self) -> Option<&EventHooks> {
+        self.events.as_ref()
+    }
+
+    /// Returns the current hooks, which are a merge between the user hooks and
+    /// the project hooks (if any).
+    fn current(project: Option<&Project>) -> Fallible<Self> {
+        let default_hooks_file = volta_home()?.default_hooks_file();
+
+        // Since `from_paths` expects the paths to be sorted in descending precedence order, we
+        // include all project hooks first (workspace_roots is already sorted in descending
+        // precedence order)
+        // See the per-project configuration RFC for more details on the configuration precedence:
+        // https://github.com/volta-cli/rfcs/blob/main/text/0033-per-project-config.md#configuration-precedence
+        let paths = project
+            .into_iter()
+            .flat_map(Project::workspace_roots)
+            .map(|root| {
+                let mut path = root.join(".volta");
+                path.push("hooks.json");
+                Cow::Owned(path)
+            })
+            .chain(once(Cow::Borrowed(default_hooks_file)));
+
+        Self::from_paths(paths)
+    }
+
+    /// Returns the merged hooks loaded from an iterator of potential hook files
+    ///
+    /// `paths` should be sorted in order of descending precedence.
+    fn from_paths<P, I>(paths: I) -> Fallible<Self>
+    where
+        P: AsRef<Path>,
+        I: IntoIterator<Item = P>,
+    {
+        paths
+            .into_iter()
+            .try_fold(None, |acc: Option<Self>, hooks_file| {
+                // Try to load the hooks and merge with any already loaded hooks
+                match Self::from_file(hooks_file.as_ref())? {
+                    Some(hooks) => {
+                        debug!(
+                            "Loaded custom hooks file: {}",
+                            hooks_file.as_ref().display()
+                        );
+                        Ok(Some(match acc {
+                            Some(loaded) => loaded.merge(hooks),
+                            None => hooks,
+                        }))
+                    }
+                    None => Ok(acc),
+                }
+            })
+            // If there were no hooks loaded at all, provide a default empty HookConfig
+            .map(|maybe_config| {
+                maybe_config.unwrap_or_else(|| {
+                    debug!("No custom hooks found");
+                    Self {
+                        node: None,
+                        npm: None,
+                        pnpm: None,
+                        yarn: None,
+                        events: None,
+                    }
+                })
+            })
+    }
+
+    fn from_file(file_path: &Path) -> Fallible<Option<Self>> {
+        if !file_path.is_file() {
+            return Ok(None);
+        }
+
+        let file = File::open(file_path).with_context(|| ErrorKind::ReadHooksError {
+            file: file_path.to_path_buf(),
+        })?;
+
+        let raw: serial::RawHookConfig =
+            serde_json::de::from_reader(file).with_context(|| ErrorKind::ParseHooksError {
+                file: file_path.to_path_buf(),
+            })?;
+
+        // Invariant: Since we successfully loaded it, we know we have a valid file path
+        let hooks_path = file_path.parent().expect("File paths always have a parent");
+
+        raw.into_hook_config(hooks_path).map(Some)
+    }
+
+    /// Merges this HookConfig with another, giving precedence to the current instance
+    fn merge(self, other: Self) -> Self {
+        Self {
+            node: merge_hooks!(self, other, node),
+            npm: merge_hooks!(self, other, npm),
+            pnpm: merge_hooks!(self, other, pnpm),
+            yarn: merge_hooks!(self, other, yarn),
+            events: merge_hooks!(self, other, events),
+        }
+    }
+}
+
+/// Format of the registry used for Yarn (Npm or Github)
+#[derive(PartialEq, Eq, Debug)]
+pub enum RegistryFormat {
+    Npm,
+    Github,
+}
+
+impl RegistryFormat {
+    pub fn from_str(raw_format: &str) -> Fallible<RegistryFormat> {
+        match raw_format {
+            "npm" => Ok(RegistryFormat::Npm),
+            "github" => Ok(RegistryFormat::Github),
+            other => Err(ErrorKind::InvalidRegistryFormat {
+                format: String::from(other),
+            }
+            .into()),
+        }
+    }
+}
+
+/// Volta hooks related to events.
+pub struct EventHooks {
+    /// The hook for publishing events, if any.
+    pub publish: Option<Publish>,
+}
+
+impl EventHooks {
+    /// Merges this EventHooks with another, giving precedence to the current instance
+    fn merge(self, other: Self) -> Self {
+        Self {
+            publish: self.publish.or(other.publish),
+        }
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use super::{tool, HookConfig, Publish, RegistryFormat};
+    use std::path::PathBuf;
+
+    fn fixture_path(fixture_dir: &str) -> PathBuf {
+        let mut cargo_manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+        cargo_manifest_dir.push("fixtures");
+        cargo_manifest_dir.push(fixture_dir);
+        cargo_manifest_dir
+    }
+
+    #[test]
+    fn test_from_str_event_url() {
+        let fixture_dir = fixture_path("hooks");
+        let url_file = fixture_dir.join("event_url.json");
+        let hooks = HookConfig::from_file(&url_file).unwrap().unwrap();
+
+        assert_eq!(
+            hooks.events.unwrap().publish,
+            Some(Publish::Url("https://google.com".to_string()))
+        );
+    }
+
+    #[test]
+    fn test_from_str_bins() {
+        let fixture_dir = fixture_path("hooks");
+        let bin_file = fixture_dir.join("bins.json");
+        let hooks = HookConfig::from_file(&bin_file).unwrap().unwrap();
+        let node = hooks.node.unwrap();
+        let pnpm = hooks.pnpm.unwrap();
+        let yarn = hooks.yarn.unwrap();
+
+        assert_eq!(
+            node.distro,
+            Some(tool::DistroHook::Bin {
+                bin: "/some/bin/for/node/distro".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        assert_eq!(
+            node.latest,
+            Some(tool::MetadataHook::Bin {
+                bin: "/some/bin/for/node/latest".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Bin {
+                bin: "/some/bin/for/node/index".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        // pnpm
+        assert_eq!(
+            pnpm.distro,
+            Some(tool::DistroHook::Bin {
+                bin: "/bin/to/pnpm/distro".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        assert_eq!(
+            pnpm.latest,
+            Some(tool::MetadataHook::Bin {
+                bin: "/bin/to/pnpm/latest".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Bin {
+                bin: "/bin/to/pnpm/index".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        // Yarn
+        assert_eq!(
+            yarn.distro,
+            Some(tool::DistroHook::Bin {
+                bin: "/bin/to/yarn/distro".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        assert_eq!(
+            yarn.latest,
+            Some(tool::MetadataHook::Bin {
+                bin: "/bin/to/yarn/latest".to_string(),
+                base_path: fixture_dir.clone(),
+            })
+        );
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Github,
+                metadata: tool::MetadataHook::Bin {
+                    bin: "/bin/to/yarn/index".to_string(),
+                    base_path: fixture_dir,
+                },
+            })
+        );
+        assert_eq!(
+            hooks.events.unwrap().publish,
+            Some(Publish::Bin("/events/bin".to_string()))
+        );
+    }
+
+    #[test]
+    fn test_from_str_prefixes() {
+        let fixture_dir = fixture_path("hooks");
+        let prefix_file = fixture_dir.join("prefixes.json");
+        let hooks = HookConfig::from_file(&prefix_file).unwrap().unwrap();
+        let node = hooks.node.unwrap();
+        let pnpm = hooks.pnpm.unwrap();
+        let yarn = hooks.yarn.unwrap();
+
+        assert_eq!(
+            node.distro,
+            Some(tool::DistroHook::Prefix(
+                "http://localhost/node/distro/".to_string()
+            ))
+        );
+        assert_eq!(
+            node.latest,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/node/latest/".to_string()
+            ))
+        );
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/node/index/".to_string()
+            ))
+        );
+        // pnpm
+        assert_eq!(
+            pnpm.distro,
+            Some(tool::DistroHook::Prefix(
+                "http://localhost/pnpm/distro/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.latest,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/pnpm/latest/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/pnpm/index/".to_string()
+            ))
+        );
+        // Yarn
+        assert_eq!(
+            yarn.distro,
+            Some(tool::DistroHook::Prefix(
+                "http://localhost/yarn/distro/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.latest,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/yarn/latest/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Github,
+                metadata: tool::MetadataHook::Prefix("http://localhost/yarn/index/".to_string())
+            })
+        );
+    }
+
+    #[test]
+    fn test_from_str_templates() {
+        let fixture_dir = fixture_path("hooks");
+        let template_file = fixture_dir.join("templates.json");
+        let hooks = HookConfig::from_file(&template_file).unwrap().unwrap();
+        let node = hooks.node.unwrap();
+        let pnpm = hooks.pnpm.unwrap();
+        let yarn = hooks.yarn.unwrap();
+        assert_eq!(
+            node.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/node/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            node.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/node/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/node/index/{{version}}/".to_string()
+            ))
+        );
+        // pnpm
+        assert_eq!(
+            pnpm.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/pnpm/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/pnpm/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/pnpm/index/{{version}}/".to_string()
+            ))
+        );
+        // Yarn
+        assert_eq!(
+            yarn.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/yarn/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/yarn/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Github,
+                metadata: tool::MetadataHook::Template(
+                    "http://localhost/yarn/index/{{version}}/".to_string()
+                )
+            })
+        );
+    }
+
+    #[test]
+    fn test_from_str_format_npm() {
+        let fixture_dir = fixture_path("hooks");
+        let format_npm_file = fixture_dir.join("format_npm.json");
+        let hooks = HookConfig::from_file(&format_npm_file).unwrap().unwrap();
+        let yarn = hooks.yarn.unwrap();
+        let node = hooks.node.unwrap();
+        let npm = hooks.npm.unwrap();
+        let pnpm = hooks.pnpm.unwrap();
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Npm,
+                metadata: tool::MetadataHook::Prefix("http://localhost/yarn/index/".to_string())
+            })
+        );
+        // node and npm don't have format
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/node/index/".to_string()
+            ))
+        );
+        assert_eq!(
+            npm.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/npm/index/".to_string()
+            ))
+        );
+        // pnpm also doesn't have format
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/pnpm/index/".to_string()
+            ))
+        );
+    }
+
+    #[test]
+    fn test_from_str_format_github() {
+        let fixture_dir = fixture_path("hooks");
+        let format_github_file = fixture_dir.join("format_github.json");
+        let hooks = HookConfig::from_file(&format_github_file).unwrap().unwrap();
+        let yarn = hooks.yarn.unwrap();
+        let node = hooks.node.unwrap();
+        let npm = hooks.npm.unwrap();
+        let pnpm = hooks.pnpm.unwrap();
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Github,
+                metadata: tool::MetadataHook::Prefix("http://localhost/yarn/index/".to_string())
+            })
+        );
+        // node and npm don't have format
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/node/index/".to_string()
+            ))
+        );
+        assert_eq!(
+            npm.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/npm/index/".to_string()
+            ))
+        );
+        // pnpm also doesn't have format
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Prefix(
+                "http://localhost/pnpm/index/".to_string()
+            ))
+        );
+    }
+
+    #[test]
+    fn test_merge() {
+        let fixture_dir = fixture_path("hooks");
+        let default_hooks = HookConfig::from_file(&fixture_dir.join("templates.json"))
+            .unwrap()
+            .unwrap();
+        let project_hooks_dir = fixture_path("hooks/project/.volta");
+        let project_hooks_file = project_hooks_dir.join("hooks.json");
+        let project_hooks = HookConfig::from_file(&project_hooks_file)
+            .expect("Could not read project hooks.json")
+            .expect("Could not find project hooks.json");
+        let merged_hooks = project_hooks.merge(default_hooks);
+        let node = merged_hooks.node.expect("No node config found");
+        let pnpm = merged_hooks.pnpm.expect("No pnpm config found");
+        let yarn = merged_hooks.yarn.expect("No yarn config found");
+
+        assert_eq!(
+            node.distro,
+            Some(tool::DistroHook::Bin {
+                bin: "/some/bin/for/node/distro".to_string(),
+                base_path: project_hooks_dir.clone(),
+            })
+        );
+        assert_eq!(
+            node.latest,
+            Some(tool::MetadataHook::Bin {
+                bin: "/some/bin/for/node/latest".to_string(),
+                base_path: project_hooks_dir.clone(),
+            })
+        );
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Bin {
+                bin: "/some/bin/for/node/index".to_string(),
+                base_path: project_hooks_dir,
+            })
+        );
+        // pnpm
+        assert_eq!(
+            pnpm.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/pnpm/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/pnpm/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/pnpm/index/{{version}}/".to_string()
+            ))
+        );
+        // Yarn
+        assert_eq!(
+            yarn.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/yarn/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/yarn/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Github,
+                metadata: tool::MetadataHook::Template(
+                    "http://localhost/yarn/index/{{version}}/".to_string()
+                )
+            })
+        );
+        assert_eq!(
+            merged_hooks.events.expect("No events config found").publish,
+            Some(Publish::Bin("/events/bin".to_string()))
+        );
+    }
+
+    #[test]
+    fn test_from_paths() {
+        let project_hooks_dir = fixture_path("hooks/project/.volta");
+        let project_hooks_file = project_hooks_dir.join("hooks.json");
+        let default_hooks_file = fixture_path("hooks/templates.json");
+
+        let merged_hooks =
+            HookConfig::from_paths([project_hooks_file, default_hooks_file]).unwrap();
+        let node = merged_hooks.node.expect("No node config found");
+        let pnpm = merged_hooks.pnpm.expect("No pnpm config found");
+        let yarn = merged_hooks.yarn.expect("No yarn config found");
+
+        assert_eq!(
+            node.distro,
+            Some(tool::DistroHook::Bin {
+                bin: "/some/bin/for/node/distro".to_string(),
+                base_path: project_hooks_dir.clone(),
+            })
+        );
+        assert_eq!(
+            node.latest,
+            Some(tool::MetadataHook::Bin {
+                bin: "/some/bin/for/node/latest".to_string(),
+                base_path: project_hooks_dir.clone(),
+            })
+        );
+        assert_eq!(
+            node.index,
+            Some(tool::MetadataHook::Bin {
+                bin: "/some/bin/for/node/index".to_string(),
+                base_path: project_hooks_dir,
+            })
+        );
+        // pnpm
+        assert_eq!(
+            pnpm.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/pnpm/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/pnpm/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            pnpm.index,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/pnpm/index/{{version}}/".to_string()
+            ))
+        );
+        // Yarn
+        assert_eq!(
+            yarn.distro,
+            Some(tool::DistroHook::Template(
+                "http://localhost/yarn/distro/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.latest,
+            Some(tool::MetadataHook::Template(
+                "http://localhost/yarn/latest/{{version}}/".to_string()
+            ))
+        );
+        assert_eq!(
+            yarn.index,
+            Some(tool::YarnIndexHook {
+                format: RegistryFormat::Github,
+                metadata: tool::MetadataHook::Template(
+                    "http://localhost/yarn/index/{{version}}/".to_string()
+                )
+            })
+        );
+        assert_eq!(
+            merged_hooks.events.expect("No events config found").publish,
+            Some(Publish::Bin("/events/bin".to_string()))
+        );
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/hook/serial.rs.html b/main/src/volta_core/hook/serial.rs.html new file mode 100644 index 000000000..195f6aeef --- /dev/null +++ b/main/src/volta_core/hook/serial.rs.html @@ -0,0 +1,467 @@ +serial.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+
use std::marker::PhantomData;
+use std::path::Path;
+
+use super::tool;
+use super::RegistryFormat;
+use crate::error::{ErrorKind, Fallible, VoltaError};
+use crate::tool::{Node, Npm, Pnpm, Tool};
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deserialize)]
+pub struct RawResolveHook {
+    prefix: Option<String>,
+    template: Option<String>,
+    bin: Option<String>,
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct RawIndexHook {
+    prefix: Option<String>,
+    template: Option<String>,
+    bin: Option<String>,
+    format: Option<String>,
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct RawPublishHook {
+    url: Option<String>,
+    bin: Option<String>,
+}
+
+impl RawResolveHook {
+    fn into_hook<H, P, T, B>(self, to_prefix: P, to_template: T, to_bin: B) -> Fallible<H>
+    where
+        P: FnOnce(String) -> H,
+        T: FnOnce(String) -> H,
+        B: FnOnce(String) -> H,
+    {
+        match self {
+            RawResolveHook {
+                prefix: Some(prefix),
+                template: None,
+                bin: None,
+            } => Ok(to_prefix(prefix)),
+            RawResolveHook {
+                prefix: None,
+                template: Some(template),
+                bin: None,
+            } => Ok(to_template(template)),
+            RawResolveHook {
+                prefix: None,
+                template: None,
+                bin: Some(bin),
+            } => Ok(to_bin(bin)),
+            RawResolveHook {
+                prefix: None,
+                template: None,
+                bin: None,
+            } => Err(ErrorKind::HookNoFieldsSpecified.into()),
+            _ => Err(ErrorKind::HookMultipleFieldsSpecified.into()),
+        }
+    }
+
+    pub fn into_distro_hook(self, base_dir: &Path) -> Fallible<tool::DistroHook> {
+        self.into_hook(
+            tool::DistroHook::Prefix,
+            tool::DistroHook::Template,
+            |bin| tool::DistroHook::Bin {
+                bin,
+                base_path: base_dir.to_owned(),
+            },
+        )
+    }
+
+    pub fn into_metadata_hook(self, base_dir: &Path) -> Fallible<tool::MetadataHook> {
+        self.into_hook(
+            tool::MetadataHook::Prefix,
+            tool::MetadataHook::Template,
+            |bin| tool::MetadataHook::Bin {
+                bin,
+                base_path: base_dir.to_owned(),
+            },
+        )
+    }
+}
+
+impl RawIndexHook {
+    pub fn into_index_hook(self, base_dir: &Path) -> Fallible<tool::YarnIndexHook> {
+        // use user-specified format, or default to Github (legacy)
+        let format = match self.format {
+            Some(format_str) => RegistryFormat::from_str(&format_str)?,
+            None => RegistryFormat::Github,
+        };
+        Ok(tool::YarnIndexHook {
+            format,
+            metadata: RawResolveHook {
+                prefix: self.prefix,
+                template: self.template,
+                bin: self.bin,
+            }
+            .into_metadata_hook(base_dir)?,
+        })
+    }
+}
+
+impl TryFrom<RawPublishHook> for super::Publish {
+    type Error = VoltaError;
+
+    fn try_from(raw: RawPublishHook) -> Fallible<super::Publish> {
+        match raw {
+            RawPublishHook {
+                url: Some(url),
+                bin: None,
+            } => Ok(super::Publish::Url(url)),
+            RawPublishHook {
+                url: None,
+                bin: Some(bin),
+            } => Ok(super::Publish::Bin(bin)),
+            RawPublishHook {
+                url: None,
+                bin: None,
+            } => Err(ErrorKind::PublishHookNeitherUrlNorBin.into()),
+            _ => Err(ErrorKind::PublishHookBothUrlAndBin.into()),
+        }
+    }
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct RawHookConfig {
+    pub node: Option<RawToolHooks<Node>>,
+    pub npm: Option<RawToolHooks<Npm>>,
+    pub pnpm: Option<RawToolHooks<Pnpm>>,
+    pub yarn: Option<RawYarnHooks>,
+    pub events: Option<RawEventHooks>,
+}
+
+#[derive(Serialize, Deserialize)]
+#[serde(rename = "events")]
+pub struct RawEventHooks {
+    pub publish: Option<RawPublishHook>,
+}
+
+impl TryFrom<RawEventHooks> for super::EventHooks {
+    type Error = VoltaError;
+
+    fn try_from(raw: RawEventHooks) -> Fallible<super::EventHooks> {
+        let publish = raw.publish.map(|p| p.try_into()).transpose()?;
+
+        Ok(super::EventHooks { publish })
+    }
+}
+
+#[derive(Serialize, Deserialize)]
+#[serde(rename = "tool")]
+pub struct RawToolHooks<T: Tool> {
+    pub distro: Option<RawResolveHook>,
+    pub latest: Option<RawResolveHook>,
+    pub index: Option<RawResolveHook>,
+
+    #[serde(skip)]
+    phantom: PhantomData<T>,
+}
+
+#[derive(Serialize, Deserialize)]
+#[serde(rename = "yarn")]
+pub struct RawYarnHooks {
+    pub distro: Option<RawResolveHook>,
+    pub latest: Option<RawResolveHook>,
+    pub index: Option<RawIndexHook>,
+}
+
+impl RawHookConfig {
+    pub fn into_hook_config(self, base_dir: &Path) -> Fallible<super::HookConfig> {
+        let node = self.node.map(|n| n.into_tool_hooks(base_dir)).transpose()?;
+        let npm = self.npm.map(|n| n.into_tool_hooks(base_dir)).transpose()?;
+        let pnpm = self.pnpm.map(|p| p.into_tool_hooks(base_dir)).transpose()?;
+        let yarn = self.yarn.map(|y| y.into_yarn_hooks(base_dir)).transpose()?;
+        let events = self.events.map(|e| e.try_into()).transpose()?;
+        Ok(super::HookConfig {
+            node,
+            npm,
+            pnpm,
+            yarn,
+            events,
+        })
+    }
+}
+
+impl<T: Tool> RawToolHooks<T> {
+    pub fn into_tool_hooks(self, base_dir: &Path) -> Fallible<super::ToolHooks<T>> {
+        let distro = self
+            .distro
+            .map(|d| d.into_distro_hook(base_dir))
+            .transpose()?;
+        let latest = self
+            .latest
+            .map(|d| d.into_metadata_hook(base_dir))
+            .transpose()?;
+        let index = self
+            .index
+            .map(|d| d.into_metadata_hook(base_dir))
+            .transpose()?;
+
+        Ok(super::ToolHooks {
+            distro,
+            latest,
+            index,
+            phantom: PhantomData,
+        })
+    }
+}
+
+impl RawYarnHooks {
+    pub fn into_yarn_hooks(self, base_dir: &Path) -> Fallible<super::YarnHooks> {
+        let distro = self
+            .distro
+            .map(|d| d.into_distro_hook(base_dir))
+            .transpose()?;
+        let latest = self
+            .latest
+            .map(|d| d.into_metadata_hook(base_dir))
+            .transpose()?;
+        let index = self
+            .index
+            .map(|d| d.into_index_hook(base_dir))
+            .transpose()?;
+
+        Ok(super::YarnHooks {
+            distro,
+            latest,
+            index,
+        })
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/hook/tool.rs.html b/main/src/volta_core/hook/tool.rs.html new file mode 100644 index 000000000..bb2af0c14 --- /dev/null +++ b/main/src/volta_core/hook/tool.rs.html @@ -0,0 +1,549 @@ +tool.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+
//! Types representing Volta Tool Hooks.
+
+use std::ffi::OsString;
+use std::path::{Path, PathBuf};
+use std::process::Stdio;
+
+use crate::command::create_command;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::hook::RegistryFormat;
+use crate::tool::{NODE_DISTRO_ARCH, NODE_DISTRO_OS};
+use cmdline_words_parser::parse_posix;
+use dunce::canonicalize;
+use log::debug;
+use node_semver::Version;
+use once_cell::sync::Lazy;
+
+const ARCH_TEMPLATE: &str = "{{arch}}";
+const OS_TEMPLATE: &str = "{{os}}";
+const VERSION_TEMPLATE: &str = "{{version}}";
+const EXTENSION_TEMPLATE: &str = "{{ext}}";
+const FILENAME_TEMPLATE: &str = "{{filename}}";
+
+static REL_PATH: Lazy<String> = Lazy::new(|| format!(".{}", std::path::MAIN_SEPARATOR));
+static REL_PATH_PARENT: Lazy<String> = Lazy::new(|| format!("..{}", std::path::MAIN_SEPARATOR));
+
+/// A hook for resolving the distro URL for a given tool version
+#[derive(PartialEq, Eq, Debug)]
+pub enum DistroHook {
+    Prefix(String),
+    Template(String),
+    Bin { bin: String, base_path: PathBuf },
+}
+
+impl DistroHook {
+    /// Performs resolution of the distro URL based on the given version and file name
+    pub fn resolve(&self, version: &Version, filename: &str) -> Fallible<String> {
+        let extension = calculate_extension(filename).unwrap_or("");
+
+        match &self {
+            DistroHook::Prefix(prefix) => Ok(format!("{}{}", prefix, filename)),
+            DistroHook::Template(template) => Ok(template
+                .replace(ARCH_TEMPLATE, NODE_DISTRO_ARCH)
+                .replace(OS_TEMPLATE, NODE_DISTRO_OS)
+                .replace(EXTENSION_TEMPLATE, extension)
+                .replace(FILENAME_TEMPLATE, filename)
+                .replace(VERSION_TEMPLATE, &version.to_string())),
+            DistroHook::Bin { bin, base_path } => {
+                execute_binary(bin, base_path, Some(version.to_string()))
+            }
+        }
+    }
+}
+
+/// Use the expected filename to determine the extension for this hook
+///
+/// This will include the multi-part `tar.gz` extension if it is present, otherwise it will use
+/// the standard extension.
+fn calculate_extension(filename: &str) -> Option<&str> {
+    let mut parts = filename.rsplit('.');
+    match (parts.next(), parts.next(), parts.next()) {
+        (Some(ext), Some("tar"), Some(_)) => {
+            // .tar.gz style extension, return both parts
+            //                          tar  .   gz
+            let index = filename.len() - 3 - 1 - ext.len();
+            filename.get(index..)
+        }
+        (Some(_), Some(""), None) => {
+            // Dotfile, e.g. `.npmrc`, where the `.` character is at the beginning - No extension
+            None
+        }
+        (Some(ext), Some(_), _) => {
+            // Standard File Extension
+            Some(ext)
+        }
+        _ => None,
+    }
+}
+
+/// A hook for resolving the URL for metadata about a tool
+#[derive(PartialEq, Eq, Debug)]
+pub enum MetadataHook {
+    Prefix(String),
+    Template(String),
+    Bin { bin: String, base_path: PathBuf },
+}
+
+impl MetadataHook {
+    /// Performs resolution of the metadata URL based on the given default file name
+    pub fn resolve(&self, filename: &str) -> Fallible<String> {
+        match &self {
+            MetadataHook::Prefix(prefix) => Ok(format!("{}{}", prefix, filename)),
+            MetadataHook::Template(template) => Ok(template
+                .replace(ARCH_TEMPLATE, NODE_DISTRO_ARCH)
+                .replace(OS_TEMPLATE, NODE_DISTRO_OS)
+                .replace(FILENAME_TEMPLATE, filename)),
+            MetadataHook::Bin { bin, base_path } => execute_binary(bin, base_path, None),
+        }
+    }
+}
+
+/// A hook for resolving the URL for the Yarn index
+#[derive(PartialEq, Eq, Debug)]
+pub struct YarnIndexHook {
+    pub format: RegistryFormat,
+    pub metadata: MetadataHook,
+}
+
+impl YarnIndexHook {
+    /// Performs resolution of the metadata URL based on the given default file name
+    pub fn resolve(&self, filename: &str) -> Fallible<String> {
+        match &self.metadata {
+            MetadataHook::Prefix(prefix) => Ok(format!("{}{}", prefix, filename)),
+            MetadataHook::Template(template) => Ok(template
+                .replace(ARCH_TEMPLATE, NODE_DISTRO_ARCH)
+                .replace(OS_TEMPLATE, NODE_DISTRO_OS)
+                .replace(FILENAME_TEMPLATE, filename)),
+            MetadataHook::Bin { bin, base_path } => execute_binary(bin, base_path, None),
+        }
+    }
+}
+
+/// Execute a shell command and return the trimmed stdout from that command
+fn execute_binary(bin: &str, base_path: &Path, extra_arg: Option<String>) -> Fallible<String> {
+    let mut trimmed = bin.trim().to_string();
+    let mut words = parse_posix(&mut trimmed);
+    let cmd = match words.next() {
+        Some(word) => {
+            // Treat any path that starts with a './' or '../' as a relative path (using OS separator)
+            if word.starts_with(REL_PATH.as_str()) || word.starts_with(REL_PATH_PARENT.as_str()) {
+                canonicalize(base_path.join(word)).with_context(|| ErrorKind::HookPathError {
+                    command: String::from(word),
+                })?
+            } else {
+                PathBuf::from(word)
+            }
+        }
+        None => {
+            return Err(ErrorKind::InvalidHookCommand {
+                command: String::from(bin.trim()),
+            }
+            .into())
+        }
+    };
+
+    let mut args: Vec<OsString> = words.map(OsString::from).collect();
+    if let Some(arg) = extra_arg {
+        args.push(OsString::from(arg));
+    }
+
+    let mut command = create_command(cmd);
+    command
+        .args(&args)
+        .current_dir(base_path)
+        .stdin(Stdio::null())
+        .stdout(Stdio::piped())
+        .stderr(Stdio::inherit());
+
+    debug!("Running hook command: {:?}", command);
+    let output = command
+        .output()
+        .with_context(|| ErrorKind::ExecuteHookError {
+            command: String::from(bin.trim()),
+        })?;
+
+    if !output.status.success() {
+        return Err(ErrorKind::HookCommandFailed {
+            command: bin.trim().into(),
+        }
+        .into());
+    }
+
+    let url = String::from_utf8(output.stdout).with_context(|| ErrorKind::InvalidHookOutput {
+        command: String::from(bin.trim()),
+    })?;
+
+    Ok(url.trim().to_string())
+}
+
+#[cfg(test)]
+pub mod tests {
+    use super::{calculate_extension, DistroHook, MetadataHook};
+    use crate::tool::{NODE_DISTRO_ARCH, NODE_DISTRO_OS};
+    use node_semver::Version;
+
+    #[test]
+    fn test_distro_prefix_resolve() {
+        let prefix = "http://localhost/node/distro/";
+        let filename = "node.tar.gz";
+        let hook = DistroHook::Prefix(prefix.to_string());
+        let version = Version::parse("1.0.0").unwrap();
+
+        assert_eq!(
+            hook.resolve(&version, filename)
+                .expect("Could not resolve URL"),
+            format!("{}{}", prefix, filename)
+        );
+    }
+
+    #[test]
+    fn test_distro_template_resolve() {
+        let hook = DistroHook::Template(
+            "http://localhost/node/{{os}}/{{arch}}/{{version}}/{{ext}}/{{filename}}".to_string(),
+        );
+        let version = Version::parse("1.0.0").unwrap();
+
+        // tar.gz format has extra handling, to support a multi-part extension
+        let expected = format!(
+            "http://localhost/node/{}/{}/{}/tar.gz/node-v1.0.0.tar.gz",
+            NODE_DISTRO_OS, NODE_DISTRO_ARCH, version
+        );
+        assert_eq!(
+            hook.resolve(&version, "node-v1.0.0.tar.gz")
+                .expect("Could not resolve URL"),
+            expected
+        );
+
+        // zip is a standard extension
+        let expected = format!(
+            "http://localhost/node/{}/{}/{}/zip/node-v1.0.0.zip",
+            NODE_DISTRO_OS, NODE_DISTRO_ARCH, version
+        );
+        assert_eq!(
+            hook.resolve(&version, "node-v1.0.0.zip")
+                .expect("Could not resolve URL"),
+            expected
+        );
+    }
+
+    #[test]
+    fn test_metadata_prefix_resolve() {
+        let prefix = "http://localhost/node/index/";
+        let filename = "index.json";
+        let hook = MetadataHook::Prefix(prefix.to_string());
+
+        assert_eq!(
+            hook.resolve(filename).expect("Could not resolve URL"),
+            format!("{}{}", prefix, filename)
+        );
+    }
+
+    #[test]
+    fn test_metadata_template_resolve() {
+        let hook = MetadataHook::Template(
+            "http://localhost/node/{{os}}/{{arch}}/{{filename}}".to_string(),
+        );
+        let expected = format!(
+            "http://localhost/node/{}/{}/index.json",
+            NODE_DISTRO_OS, NODE_DISTRO_ARCH
+        );
+
+        assert_eq!(
+            hook.resolve("index.json").expect("Could not resolve URL"),
+            expected
+        );
+    }
+
+    #[test]
+    fn test_calculate_extension() {
+        // Handles .tar.* files
+        assert_eq!(calculate_extension("file.tar.gz"), Some("tar.gz"));
+        assert_eq!(calculate_extension("file.tar.xz"), Some("tar.xz"));
+        assert_eq!(calculate_extension("file.tar.xyz"), Some("tar.xyz"));
+
+        // Handles dotfiles
+        assert_eq!(calculate_extension(".filerc"), None);
+
+        // Handles standard extensions
+        assert_eq!(calculate_extension("tar.gz"), Some("gz"));
+        assert_eq!(calculate_extension("file.zip"), Some("zip"));
+
+        // Handles files with no extension at all
+        assert_eq!(calculate_extension("bare_file"), None);
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/inventory.rs.html b/main/src/volta_core/inventory.rs.html new file mode 100644 index 000000000..d24e92f8c --- /dev/null +++ b/main/src/volta_core/inventory.rs.html @@ -0,0 +1,211 @@ +inventory.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+
//! Provides types for working with Volta's _inventory_, the local repository
+//! of available tool versions.
+
+use std::collections::BTreeSet;
+use std::ffi::OsStr;
+use std::path::Path;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::read_dir_eager;
+use crate::layout::volta_home;
+use crate::tool::PackageConfig;
+use crate::version::parse_version;
+use log::debug;
+use node_semver::Version;
+use walkdir::WalkDir;
+
+/// Checks if a given Node version image is available on the local machine
+pub fn node_available(version: &Version) -> Fallible<bool> {
+    volta_home().map(|home| {
+        home.node_image_root_dir()
+            .join(version.to_string())
+            .exists()
+    })
+}
+
+/// Collects a set of all Node versions fetched on the local machine
+pub fn node_versions() -> Fallible<BTreeSet<Version>> {
+    volta_home().and_then(|home| read_versions(home.node_image_root_dir()))
+}
+
+/// Checks if a given npm version image is available on the local machine
+pub fn npm_available(version: &Version) -> Fallible<bool> {
+    volta_home().map(|home| home.npm_image_dir(&version.to_string()).exists())
+}
+
+/// Collects a set of all npm versions fetched on the local machine
+pub fn npm_versions() -> Fallible<BTreeSet<Version>> {
+    volta_home().and_then(|home| read_versions(home.npm_image_root_dir()))
+}
+
+/// Checks if a given pnpm version image is available on the local machine
+pub fn pnpm_available(version: &Version) -> Fallible<bool> {
+    volta_home().map(|home| home.pnpm_image_dir(&version.to_string()).exists())
+}
+
+/// Collects a set of all pnpm versions fetched on the local machine
+pub fn pnpm_versions() -> Fallible<BTreeSet<Version>> {
+    volta_home().and_then(|home| read_versions(home.pnpm_image_root_dir()))
+}
+
+/// Checks if a given Yarn version image is available on the local machine
+pub fn yarn_available(version: &Version) -> Fallible<bool> {
+    volta_home().map(|home| home.yarn_image_dir(&version.to_string()).exists())
+}
+
+/// Collects a set of all Yarn versions fetched on the local machine
+pub fn yarn_versions() -> Fallible<BTreeSet<Version>> {
+    volta_home().and_then(|home| read_versions(home.yarn_image_root_dir()))
+}
+
+/// Collects a set of all Package Configs on the local machine
+pub fn package_configs() -> Fallible<BTreeSet<PackageConfig>> {
+    let package_dir = volta_home()?.default_package_dir();
+
+    WalkDir::new(package_dir)
+        .max_depth(2)
+        .into_iter()
+        // Ignore any items which didn't resolve as `DirEntry` correctly.
+        // There is no point trying to do anything with those, and no error
+        // we can report to the user in any case. Log the failure in the
+        // debug output, though
+        .filter_map(|entry| match entry {
+            Ok(dir_entry) => {
+                // Ignore directory entries and any files that don't have a .json extension.
+                // This will prevent us from trying to parse OS-generated files as package
+                // configs (e.g. `.DS_Store` on macOS)
+                let extension = dir_entry.path().extension().and_then(OsStr::to_str);
+                match (dir_entry.file_type().is_file(), extension) {
+                    (true, Some(ext)) if ext.eq_ignore_ascii_case("json") => {
+                        Some(dir_entry.into_path())
+                    }
+                    _ => None,
+                }
+            }
+            Err(e) => {
+                debug!("{}", e);
+                None
+            }
+        })
+        .map(PackageConfig::from_file)
+        .collect()
+}
+
+/// Reads the contents of a directory and returns the set of all versions found
+/// in the directory's listing by parsing the directory names as semantic versions
+fn read_versions(dir: &Path) -> Fallible<BTreeSet<Version>> {
+    let contents = read_dir_eager(dir).with_context(|| ErrorKind::ReadDirError {
+        dir: dir.to_owned(),
+    })?;
+
+    Ok(contents
+        .filter(|(_, metadata)| metadata.is_dir())
+        .filter_map(|(entry, _)| parse_version(entry.file_name().to_string_lossy()).ok())
+        .collect())
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/layout/mod.rs.html b/main/src/volta_core/layout/mod.rs.html new file mode 100644 index 000000000..029b0a34d --- /dev/null +++ b/main/src/volta_core/layout/mod.rs.html @@ -0,0 +1,119 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+
use std::env;
+use std::path::PathBuf;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use cfg_if::cfg_if;
+use dunce::canonicalize;
+use once_cell::sync::OnceCell;
+use volta_layout::v4::{VoltaHome, VoltaInstall};
+
+cfg_if! {
+    if #[cfg(unix)] {
+        mod unix;
+        pub use unix::*;
+    } else if #[cfg(windows)] {
+        mod windows;
+        pub use windows::*;
+    }
+}
+
+static VOLTA_HOME: OnceCell<VoltaHome> = OnceCell::new();
+static VOLTA_INSTALL: OnceCell<VoltaInstall> = OnceCell::new();
+
+pub fn volta_home<'a>() -> Fallible<&'a VoltaHome> {
+    VOLTA_HOME.get_or_try_init(|| {
+        let home_dir = match env::var_os("VOLTA_HOME") {
+            Some(home) => PathBuf::from(home),
+            None => default_home_dir()?,
+        };
+
+        Ok(VoltaHome::new(home_dir))
+    })
+}
+
+pub fn volta_install<'a>() -> Fallible<&'a VoltaInstall> {
+    VOLTA_INSTALL.get_or_try_init(|| {
+        let install_dir = match env::var_os("VOLTA_INSTALL_DIR") {
+            Some(install) => PathBuf::from(install),
+            None => default_install_dir()?,
+        };
+
+        Ok(VoltaInstall::new(install_dir))
+    })
+}
+
+/// Determine the binary install directory from the currently running executable
+///
+/// The volta-shim and volta binaries will be installed in the same location, so we can use the
+/// currently running executable to find the binary install directory. Note that we need to
+/// canonicalize the path we get from current_exe to make sure we resolve symlinks and find the
+/// actual binary files
+fn default_install_dir() -> Fallible<PathBuf> {
+    env::current_exe()
+        .and_then(canonicalize)
+        .map(|mut path| {
+            path.pop(); // Remove the executable name from the path
+            path
+        })
+        .with_context(|| ErrorKind::NoInstallDir)
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/layout/unix.rs.html b/main/src/volta_core/layout/unix.rs.html new file mode 100644 index 000000000..ed4baa95f --- /dev/null +++ b/main/src/volta_core/layout/unix.rs.html @@ -0,0 +1,31 @@ +unix.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
use std::path::PathBuf;
+
+use super::volta_home;
+use crate::error::{ErrorKind, Fallible};
+
+pub(super) fn default_home_dir() -> Fallible<PathBuf> {
+    let mut home = dirs::home_dir().ok_or(ErrorKind::NoHomeEnvironmentVar)?;
+    home.push(".volta");
+    Ok(home)
+}
+
+pub fn env_paths() -> Fallible<Vec<PathBuf>> {
+    let home = volta_home()?;
+    Ok(vec![home.shim_dir().to_owned()])
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/lib.rs.html b/main/src/volta_core/lib.rs.html new file mode 100644 index 000000000..35315317d --- /dev/null +++ b/main/src/volta_core/lib.rs.html @@ -0,0 +1,49 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+
//! The main implementation crate for the core of Volta.
+
+mod command;
+pub mod error;
+pub mod event;
+pub mod fs;
+mod hook;
+pub mod inventory;
+pub mod layout;
+pub mod log;
+pub mod monitor;
+pub mod platform;
+pub mod project;
+pub mod run;
+pub mod session;
+pub mod shim;
+pub mod signal;
+pub mod style;
+pub mod sync;
+pub mod tool;
+pub mod toolchain;
+pub mod version;
+
+const VOLTA_FEATURE_PNPM: &str = "VOLTA_FEATURE_PNPM";
+
\ No newline at end of file diff --git a/main/src/volta_core/log.rs.html b/main/src/volta_core/log.rs.html new file mode 100644 index 000000000..e4f4bbc2b --- /dev/null +++ b/main/src/volta_core/log.rs.html @@ -0,0 +1,353 @@ +log.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+
//! This module provides a custom Logger implementation for use with the `log` crate
+use console::style;
+use log::{trace, Level, LevelFilter, Log, Metadata, Record, SetLoggerError};
+use std::env;
+use std::fmt::Display;
+use std::io::IsTerminal;
+use textwrap::{fill, Options, WordSplitter};
+
+use crate::style::text_width;
+
+const ERROR_PREFIX: &str = "error:";
+const WARNING_PREFIX: &str = "warning:";
+const SHIM_ERROR_PREFIX: &str = "Volta error:";
+const SHIM_WARNING_PREFIX: &str = "Volta warning:";
+const MIGRATION_ERROR_PREFIX: &str = "Volta update error:";
+const MIGRATION_WARNING_PREFIX: &str = "Volta update warning:";
+const VOLTA_LOGLEVEL: &str = "VOLTA_LOGLEVEL";
+const ALLOWED_PREFIXES: [&str; 5] = [
+    "volta",
+    "archive",
+    "fs-utils",
+    "progress-read",
+    "validate-npm-package-name",
+];
+const WRAP_INDENT: &str = "    ";
+
+/// Represents the context from which the logger was created
+pub enum LogContext {
+    /// Log messages from the `volta` executable
+    Volta,
+
+    /// Log messages from one of the shims
+    Shim,
+
+    /// Log messages from the migration
+    Migration,
+}
+
+/// Represents the level of verbosity that was requested by the user
+#[derive(Debug, Copy, Clone)]
+pub enum LogVerbosity {
+    Quiet,
+    Default,
+    Verbose,
+    VeryVerbose,
+}
+
+pub struct Logger {
+    context: LogContext,
+    level: LevelFilter,
+}
+
+impl Log for Logger {
+    fn enabled(&self, metadata: &Metadata) -> bool {
+        metadata.level() <= self.level
+    }
+
+    fn log(&self, record: &Record) {
+        let level_allowed = self.enabled(record.metadata());
+
+        let is_valid_target = ALLOWED_PREFIXES
+            .iter()
+            .any(|prefix| record.target().starts_with(prefix));
+
+        if level_allowed && is_valid_target {
+            match record.level() {
+                Level::Error => self.log_error(record.args()),
+                Level::Warn => self.log_warning(record.args()),
+                // all info-level messages go to stdout
+                Level::Info => println!("{}", record.args()),
+                // all debug- and trace-level messages go to stderr
+                Level::Debug => eprintln!("[verbose] {}", record.args()),
+                Level::Trace => eprintln!("[trace] {}", record.args()),
+            }
+        }
+    }
+
+    fn flush(&self) {}
+}
+
+impl Logger {
+    /// Initialize the global logger with a Logger instance
+    /// Will use the requested level of Verbosity
+    /// If set to Default, will use the environment to determine the level of verbosity
+    pub fn init(context: LogContext, verbosity: LogVerbosity) -> Result<(), SetLoggerError> {
+        let logger = Logger::new(context, verbosity);
+        log::set_max_level(logger.level);
+        log::set_boxed_logger(Box::new(logger))?;
+        Ok(())
+    }
+
+    fn new(context: LogContext, verbosity: LogVerbosity) -> Self {
+        let level = match verbosity {
+            LogVerbosity::Quiet => LevelFilter::Error,
+            LogVerbosity::Default => level_from_env(),
+            LogVerbosity::Verbose => LevelFilter::Debug,
+            LogVerbosity::VeryVerbose => LevelFilter::Trace,
+        };
+
+        Logger { context, level }
+    }
+
+    fn log_error<D>(&self, message: &D)
+    where
+        D: Display,
+    {
+        let prefix = match &self.context {
+            LogContext::Volta => ERROR_PREFIX,
+            LogContext::Shim => SHIM_ERROR_PREFIX,
+            LogContext::Migration => MIGRATION_ERROR_PREFIX,
+        };
+
+        eprintln!("{} {}", style(prefix).red().bold(), message);
+    }
+
+    fn log_warning<D>(&self, message: &D)
+    where
+        D: Display,
+    {
+        let prefix = match &self.context {
+            LogContext::Volta => WARNING_PREFIX,
+            LogContext::Shim => SHIM_WARNING_PREFIX,
+            LogContext::Migration => MIGRATION_WARNING_PREFIX,
+        };
+
+        eprintln!(
+            "{} {}",
+            style(prefix).yellow().bold(),
+            wrap_content(prefix, message)
+        );
+    }
+}
+
+/// Wraps the supplied content to the terminal width, if we are in a terminal.
+/// If not, returns the content as a String
+///
+/// Note: Uses the supplied prefix to calculate the terminal width, but then removes
+/// it so that it can be styled (style characters are counted against the wrapped width)
+fn wrap_content<D>(prefix: &str, content: &D) -> String
+where
+    D: Display,
+{
+    match text_width() {
+        Some(width) => {
+            let options = Options::new(width)
+                .word_splitter(WordSplitter::NoHyphenation)
+                .subsequent_indent(WRAP_INDENT)
+                .break_words(false);
+
+            fill(&format!("{} {}", prefix, content), options).replace(prefix, "")
+        }
+        None => format!(" {}", content),
+    }
+}
+
+/// Determines the correct logging level based on the environment
+/// If VOLTA_LOGLEVEL is set to a valid level, we use that
+/// If not, we check the current stdout to determine whether it is a TTY or not
+///     If it is a TTY, we use Info
+///     If it is NOT a TTY, we use Error as we don't want to show warnings when running as a script
+fn level_from_env() -> LevelFilter {
+    env::var(VOLTA_LOGLEVEL)
+        .ok()
+        .and_then(|level| level.to_uppercase().parse().ok())
+        .unwrap_or_else(|| {
+            if std::io::stdout().is_terminal() {
+                trace!("using fallback log level (info)");
+                LevelFilter::Info
+            } else {
+                LevelFilter::Error
+            }
+        })
+}
+
+#[cfg(test)]
+mod tests {}
+
\ No newline at end of file diff --git a/main/src/volta_core/monitor.rs.html b/main/src/volta_core/monitor.rs.html new file mode 100644 index 000000000..72bc43a4c --- /dev/null +++ b/main/src/volta_core/monitor.rs.html @@ -0,0 +1,171 @@ +monitor.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+
use std::env;
+use std::io::Write;
+use std::path::PathBuf;
+use std::process::{Child, Stdio};
+
+use log::debug;
+use tempfile::NamedTempFile;
+
+use crate::command::create_command;
+use crate::event::Event;
+
+/// Send event to the spawned command process
+// if hook command is not configured, this is not called
+pub fn send_events(command: &str, events: &[Event]) {
+    match serde_json::to_string_pretty(&events) {
+        Ok(events_json) => {
+            let tempfile_path = env::var_os("VOLTA_WRITE_EVENTS_FILE")
+                .and_then(|_| write_events_file(events_json.clone()));
+            if let Some(ref mut child_process) = spawn_process(command, tempfile_path) {
+                if let Some(ref mut p_stdin) = child_process.stdin.as_mut() {
+                    if let Err(error) = writeln!(p_stdin, "{}", events_json) {
+                        debug!("Could not write events to executable stdin: {:?}", error);
+                    }
+                }
+            }
+        }
+        Err(error) => {
+            debug!("Could not serialize events data to JSON: {:?}", error);
+        }
+    }
+}
+
+// Write the events JSON to a file in the temporary directory
+fn write_events_file(events_json: String) -> Option<PathBuf> {
+    match NamedTempFile::new() {
+        Ok(mut events_file) => {
+            match events_file.write_all(events_json.as_bytes()) {
+                Ok(()) => {
+                    let path = events_file.into_temp_path();
+                    // if it's not persisted, the temp file will be automatically deleted
+                    // (and the executable won't be able to read it)
+                    match path.keep() {
+                        Ok(tempfile_path) => Some(tempfile_path),
+                        Err(error) => {
+                            debug!("Failed to persist temp file for events data: {:?}", error);
+                            None
+                        }
+                    }
+                }
+                Err(error) => {
+                    debug!("Failed to write events to the temp file: {:?}", error);
+                    None
+                }
+            }
+        }
+        Err(error) => {
+            debug!("Failed to create a temp file for events data: {:?}", error);
+            None
+        }
+    }
+}
+
+// Spawn a child process to receive the events data, setting the path to the events file as an env var
+fn spawn_process(command: &str, tempfile_path: Option<PathBuf>) -> Option<Child> {
+    command.split(' ').take(1).next().and_then(|executable| {
+        let mut child = create_command(executable);
+        child.args(command.split(' ').skip(1));
+        child.stdin(Stdio::piped());
+        if let Some(events_file) = tempfile_path {
+            child.env("EVENTS_FILE", events_file);
+        }
+
+        #[cfg(not(debug_assertions))]
+        // Hide stdout and stderr of spawned process in release mode
+        child.stdout(Stdio::null()).stderr(Stdio::null());
+
+        match child.spawn() {
+            Err(err) => {
+                debug!("Unable to run executable command: '{}'\n{}", command, err);
+                None
+            }
+            Ok(c) => Some(c),
+        }
+    })
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/platform/image.rs.html b/main/src/volta_core/platform/image.rs.html new file mode 100644 index 000000000..120a97d29 --- /dev/null +++ b/main/src/volta_core/platform/image.rs.html @@ -0,0 +1,143 @@ +image.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+
use std::ffi::OsString;
+use std::path::PathBuf;
+
+use super::{build_path_error, Sourced};
+use crate::error::{Context, Fallible};
+use crate::layout::volta_home;
+use crate::tool::load_default_npm_version;
+use node_semver::Version;
+
+/// A platform image.
+pub struct Image {
+    /// The pinned version of Node.
+    pub node: Sourced<Version>,
+    /// The custom version of npm, if any. `None` represents using the npm that is bundled with Node
+    pub npm: Option<Sourced<Version>>,
+    /// The pinned version of pnpm, if any.
+    pub pnpm: Option<Sourced<Version>>,
+    /// The pinned version of Yarn, if any.
+    pub yarn: Option<Sourced<Version>>,
+}
+
+impl Image {
+    fn bins(&self) -> Fallible<Vec<PathBuf>> {
+        let home = volta_home()?;
+        let mut bins = Vec::with_capacity(3);
+
+        if let Some(npm) = &self.npm {
+            let npm_str = npm.value.to_string();
+            bins.push(home.npm_image_bin_dir(&npm_str));
+        }
+
+        if let Some(pnpm) = &self.pnpm {
+            let pnpm_str = pnpm.value.to_string();
+            bins.push(home.pnpm_image_bin_dir(&pnpm_str));
+        }
+
+        if let Some(yarn) = &self.yarn {
+            let yarn_str = yarn.value.to_string();
+            bins.push(home.yarn_image_bin_dir(&yarn_str));
+        }
+
+        // Add Node path to the bins last, so that any custom version of npm will be earlier in the PATH
+        let node_str = self.node.value.to_string();
+        bins.push(home.node_image_bin_dir(&node_str));
+        Ok(bins)
+    }
+
+    /// Produces a modified version of the current `PATH` environment variable that
+    /// will find toolchain executables (Node, npm, pnpm, Yarn) in the installation directories
+    /// for the given versions instead of in the Volta shim directory.
+    pub fn path(&self) -> Fallible<OsString> {
+        let old_path = envoy::path().unwrap_or_else(|| envoy::Var::from(""));
+
+        old_path
+            .split()
+            .prefix(self.bins()?)
+            .join()
+            .with_context(build_path_error)
+    }
+
+    /// Determines the sourced version of npm that will be available, resolving the version bundled with Node, if needed
+    pub fn resolve_npm(&self) -> Fallible<Sourced<Version>> {
+        match &self.npm {
+            Some(npm) => Ok(npm.clone()),
+            None => load_default_npm_version(&self.node.value).map(|npm| Sourced {
+                value: npm,
+                source: self.node.source,
+            }),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/platform/mod.rs.html b/main/src/volta_core/platform/mod.rs.html new file mode 100644 index 000000000..fa9f723ef --- /dev/null +++ b/main/src/volta_core/platform/mod.rs.html @@ -0,0 +1,617 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+
use std::env;
+use std::fmt;
+
+use crate::error::{ErrorKind, Fallible};
+use crate::session::Session;
+use crate::tool::{Node, Npm, Pnpm, Yarn};
+use crate::VOLTA_FEATURE_PNPM;
+use node_semver::Version;
+
+mod image;
+mod system;
+// Note: The tests get their own module because we need them to run as a single unit to prevent
+// clobbering environment variable changes
+#[cfg(test)]
+mod tests;
+
+pub use image::Image;
+pub use system::System;
+
+/// The source with which a version is associated
+#[derive(Clone, Copy)]
+#[cfg_attr(test, derive(Eq, PartialEq, Debug))]
+pub enum Source {
+    /// Represents a version from the user default platform
+    Default,
+
+    /// Represents a version from a project manifest
+    Project,
+
+    /// Represents a version from a pinned Binary platform
+    Binary,
+
+    /// Represents a version from the command line (via `volta run`)
+    CommandLine,
+}
+
+impl fmt::Display for Source {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            Source::Default => write!(f, "default"),
+            Source::Project => write!(f, "project"),
+            Source::Binary => write!(f, "binary"),
+            Source::CommandLine => write!(f, "command-line"),
+        }
+    }
+}
+
+pub struct Sourced<T> {
+    pub value: T,
+    pub source: Source,
+}
+
+impl<T> Sourced<T> {
+    pub fn with_default(value: T) -> Self {
+        Sourced {
+            value,
+            source: Source::Default,
+        }
+    }
+
+    pub fn with_project(value: T) -> Self {
+        Sourced {
+            value,
+            source: Source::Project,
+        }
+    }
+
+    pub fn with_binary(value: T) -> Self {
+        Sourced {
+            value,
+            source: Source::Binary,
+        }
+    }
+
+    pub fn with_command_line(value: T) -> Self {
+        Sourced {
+            value,
+            source: Source::CommandLine,
+        }
+    }
+}
+
+impl<T> Sourced<T> {
+    pub fn as_ref(&self) -> Sourced<&T> {
+        Sourced {
+            value: &self.value,
+            source: self.source,
+        }
+    }
+}
+
+impl<T> Sourced<&T>
+where
+    T: Clone,
+{
+    pub fn cloned(self) -> Sourced<T> {
+        Sourced {
+            value: self.value.clone(),
+            source: self.source,
+        }
+    }
+}
+
+impl<T> Clone for Sourced<T>
+where
+    T: Clone,
+{
+    fn clone(&self) -> Sourced<T> {
+        Sourced {
+            value: self.value.clone(),
+            source: self.source,
+        }
+    }
+}
+
+/// Represents 3 possible states: Having a value, not having a value, and inheriting a value
+#[cfg_attr(test, derive(Eq, PartialEq, Debug))]
+#[derive(Clone, Default)]
+pub enum InheritOption<T> {
+    Some(T),
+    None,
+    #[default]
+    Inherit,
+}
+
+impl<T> InheritOption<T> {
+    /// Applies a function to the contained value (if any)
+    pub fn map<U, F>(self, f: F) -> InheritOption<U>
+    where
+        F: FnOnce(T) -> U,
+    {
+        match self {
+            InheritOption::Some(value) => InheritOption::Some(f(value)),
+            InheritOption::None => InheritOption::None,
+            InheritOption::Inherit => InheritOption::Inherit,
+        }
+    }
+
+    /// Converts the `InheritOption` into a regular `Option` by inheriting from the provided value if needed
+    pub fn inherit(self, other: Option<T>) -> Option<T> {
+        match self {
+            InheritOption::Some(value) => Some(value),
+            InheritOption::None => None,
+            InheritOption::Inherit => other,
+        }
+    }
+}
+
+impl<T> From<InheritOption<T>> for Option<T> {
+    fn from(base: InheritOption<T>) -> Option<T> {
+        base.inherit(None)
+    }
+}
+
+#[derive(Clone, PartialOrd, Ord, PartialEq, Eq)]
+#[cfg_attr(test, derive(Debug))]
+/// Represents the specification of a single Platform, regardless of the source
+pub struct PlatformSpec {
+    pub node: Version,
+    pub npm: Option<Version>,
+    pub pnpm: Option<Version>,
+    pub yarn: Option<Version>,
+}
+
+impl PlatformSpec {
+    /// Convert this PlatformSpec into a Platform with all sources set to `Default`
+    pub fn as_default(&self) -> Platform {
+        Platform {
+            node: Sourced::with_default(self.node.clone()),
+            npm: self.npm.clone().map(Sourced::with_default),
+            pnpm: self.pnpm.clone().map(Sourced::with_default),
+            yarn: self.yarn.clone().map(Sourced::with_default),
+        }
+    }
+
+    /// Convert this PlatformSpec into a Platform with all sources set to `Project`
+    pub fn as_project(&self) -> Platform {
+        Platform {
+            node: Sourced::with_project(self.node.clone()),
+            npm: self.npm.clone().map(Sourced::with_project),
+            pnpm: self.pnpm.clone().map(Sourced::with_project),
+            yarn: self.yarn.clone().map(Sourced::with_project),
+        }
+    }
+
+    /// Convert this PlatformSpec into a Platform with all sources set to `Binary`
+    pub fn as_binary(&self) -> Platform {
+        Platform {
+            node: Sourced::with_binary(self.node.clone()),
+            npm: self.npm.clone().map(Sourced::with_binary),
+            pnpm: self.pnpm.clone().map(Sourced::with_binary),
+            yarn: self.yarn.clone().map(Sourced::with_binary),
+        }
+    }
+}
+
+/// Represents a (maybe) platform with values from the command line
+#[derive(Clone)]
+pub struct CliPlatform {
+    pub node: Option<Version>,
+    pub npm: InheritOption<Version>,
+    pub pnpm: InheritOption<Version>,
+    pub yarn: InheritOption<Version>,
+}
+
+impl CliPlatform {
+    /// Merges the `CliPlatform` with a `Platform`, inheriting from the base where needed
+    pub fn merge(self, base: Platform) -> Platform {
+        Platform {
+            node: self.node.map_or(base.node, Sourced::with_command_line),
+            npm: self.npm.map(Sourced::with_command_line).inherit(base.npm),
+            pnpm: self.pnpm.map(Sourced::with_command_line).inherit(base.pnpm),
+            yarn: self.yarn.map(Sourced::with_command_line).inherit(base.yarn),
+        }
+    }
+}
+
+impl From<CliPlatform> for Option<Platform> {
+    /// Converts the `CliPlatform` into a possible Platform without a base from which to inherit
+    fn from(base: CliPlatform) -> Option<Platform> {
+        match base.node {
+            None => None,
+            Some(node) => Some(Platform {
+                node: Sourced::with_command_line(node),
+                npm: base.npm.map(Sourced::with_command_line).into(),
+                pnpm: base.pnpm.map(Sourced::with_command_line).into(),
+                yarn: base.yarn.map(Sourced::with_command_line).into(),
+            }),
+        }
+    }
+}
+
+/// Represents a real Platform, with Versions pulled from one or more `PlatformSpec`s
+#[derive(Clone)]
+pub struct Platform {
+    pub node: Sourced<Version>,
+    pub npm: Option<Sourced<Version>>,
+    pub pnpm: Option<Sourced<Version>>,
+    pub yarn: Option<Sourced<Version>>,
+}
+
+impl Platform {
+    /// Returns the user's currently active platform, if any
+    ///
+    /// Active platform is determined by first looking at the Project Platform
+    ///
+    /// - If there is a project platform then we use it
+    ///   - If there is no pnpm/Yarn version in the project platform, we pull
+    ///     pnpm/Yarn from the default platform if available, and merge the two
+    ///     platforms into a final one
+    /// - If there is no Project platform, then we use the user Default Platform
+    pub fn current(session: &mut Session) -> Fallible<Option<Self>> {
+        if let Some(mut platform) = session.project_platform()?.map(PlatformSpec::as_project) {
+            if platform.pnpm.is_none() {
+                platform.pnpm = session
+                    .default_platform()?
+                    .and_then(|default_platform| default_platform.pnpm.clone())
+                    .map(Sourced::with_default);
+            }
+
+            if platform.yarn.is_none() {
+                platform.yarn = session
+                    .default_platform()?
+                    .and_then(|default_platform| default_platform.yarn.clone())
+                    .map(Sourced::with_default);
+            }
+
+            Ok(Some(platform))
+        } else {
+            Ok(session.default_platform()?.map(PlatformSpec::as_default))
+        }
+    }
+
+    /// Check out a `Platform` into a fully-realized `Image`
+    ///
+    /// This will ensure that all necessary tools are fetched and available for execution
+    pub fn checkout(self, session: &mut Session) -> Fallible<Image> {
+        Node::new(self.node.value.clone()).ensure_fetched(session)?;
+
+        if let Some(Sourced { value: version, .. }) = &self.npm {
+            Npm::new(version.clone()).ensure_fetched(session)?;
+        }
+
+        // Only force download of the pnpm version if the pnpm feature flag is set. If it isn't,
+        // then we won't be using the `Pnpm` tool to execute (we will be relying on the global
+        // package logic), so fetching the Pnpm version would only be redundant work.
+        if env::var_os(VOLTA_FEATURE_PNPM).is_some() {
+            if let Some(Sourced { value: version, .. }) = &self.pnpm {
+                Pnpm::new(version.clone()).ensure_fetched(session)?;
+            }
+        }
+
+        if let Some(Sourced { value: version, .. }) = &self.yarn {
+            Yarn::new(version.clone()).ensure_fetched(session)?;
+        }
+
+        Ok(Image {
+            node: self.node,
+            npm: self.npm,
+            pnpm: self.pnpm,
+            yarn: self.yarn,
+        })
+    }
+}
+
+fn build_path_error() -> ErrorKind {
+    ErrorKind::BuildPathError
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/platform/system.rs.html b/main/src/volta_core/platform/system.rs.html new file mode 100644 index 000000000..e638efdb4 --- /dev/null +++ b/main/src/volta_core/platform/system.rs.html @@ -0,0 +1,51 @@ +system.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+
use std::ffi::OsString;
+
+use super::build_path_error;
+use crate::error::{Context, Fallible};
+use crate::layout::env_paths;
+
+/// A lightweight namespace type representing the system environment, i.e. the environment
+/// with Volta removed.
+pub struct System;
+
+impl System {
+    /// Produces a modified version of the current `PATH` environment variable that
+    /// removes the Volta shims and binaries, to use for running system node and
+    /// executables.
+    pub fn path() -> Fallible<OsString> {
+        let old_path = envoy::path().unwrap_or_else(|| envoy::Var::from(""));
+        let mut new_path = old_path.split();
+
+        for remove_path in env_paths()? {
+            new_path = new_path.remove(remove_path);
+        }
+
+        new_path.join().with_context(build_path_error)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/project/mod.rs.html b/main/src/volta_core/project/mod.rs.html new file mode 100644 index 000000000..8228fb89a --- /dev/null +++ b/main/src/volta_core/project/mod.rs.html @@ -0,0 +1,615 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+
//! Provides the `Project` type, which represents a Node project tree in
+//! the filesystem.
+
+use std::env;
+use std::ffi::OsStr;
+use std::iter::once;
+use std::path::{Path, PathBuf};
+
+use node_semver::Version;
+use once_cell::unsync::OnceCell;
+
+use crate::error::{Context, ErrorKind, Fallible, VoltaError};
+use crate::layout::volta_home;
+use crate::platform::PlatformSpec;
+use crate::tool::BinConfig;
+use chain_map::ChainMap;
+use indexmap::IndexSet;
+
+mod serial;
+#[cfg(test)]
+mod tests;
+
+use serial::{update_manifest, Manifest, ManifestKey};
+
+/// A lazily loaded Project
+pub struct LazyProject {
+    project: OnceCell<Option<Project>>,
+}
+
+impl LazyProject {
+    pub fn init() -> Self {
+        LazyProject {
+            project: OnceCell::new(),
+        }
+    }
+
+    pub fn get(&self) -> Fallible<Option<&Project>> {
+        let project = self.project.get_or_try_init(Project::for_current_dir)?;
+        Ok(project.as_ref())
+    }
+
+    pub fn get_mut(&mut self) -> Fallible<Option<&mut Project>> {
+        let _ = self.project.get_or_try_init(Project::for_current_dir)?;
+        Ok(self.project.get_mut().unwrap().as_mut())
+    }
+}
+
+/// A Node project workspace in the filesystem
+#[cfg_attr(test, derive(Debug))]
+pub struct Project {
+    manifest_file: PathBuf,
+    workspace_manifests: IndexSet<PathBuf>,
+    dependencies: ChainMap<String, String>,
+    platform: Option<PlatformSpec>,
+}
+
+impl Project {
+    /// Creates an optional Project instance from the current directory
+    fn for_current_dir() -> Fallible<Option<Self>> {
+        let current_dir = env::current_dir().with_context(|| ErrorKind::CurrentDirError)?;
+        Self::for_dir(current_dir)
+    }
+
+    /// Creates an optional Project instance from the specified directory
+    ///
+    /// Will search ancestors to find a `package.json` and use that as the root of the project
+    fn for_dir(base_dir: PathBuf) -> Fallible<Option<Self>> {
+        match find_closest_root(base_dir) {
+            Some(mut project) => {
+                project.push("package.json");
+                Self::from_file(project).map(Some)
+            }
+            None => Ok(None),
+        }
+    }
+
+    /// Creates a Project instance from the given package manifest file (`package.json`)
+    fn from_file(manifest_file: PathBuf) -> Fallible<Self> {
+        let manifest = Manifest::from_file(&manifest_file)?;
+        let mut dependencies: ChainMap<String, String> = manifest.dependency_maps.collect();
+        let mut workspace_manifests = IndexSet::new();
+        let mut platform = manifest.platform;
+        let mut extends = manifest.extends;
+
+        // Iterate the `volta.extends` chain, parsing each file in turn
+        while let Some(path) = extends {
+            // Detect cycles to prevent infinite looping
+            if path == manifest_file || workspace_manifests.contains(&path) {
+                let mut paths = vec![manifest_file];
+                paths.extend(workspace_manifests);
+
+                return Err(ErrorKind::ExtensionCycleError {
+                    paths,
+                    duplicate: path,
+                }
+                .into());
+            }
+
+            let manifest = Manifest::from_file(&path)?;
+            workspace_manifests.insert(path);
+            dependencies.extend(manifest.dependency_maps);
+
+            platform = match (platform, manifest.platform) {
+                (Some(base), Some(ext)) => Some(base.merge(ext)),
+                (Some(plat), None) | (None, Some(plat)) => Some(plat),
+                (None, None) => None,
+            };
+
+            extends = manifest.extends;
+        }
+
+        let platform = platform.map(TryInto::try_into).transpose()?;
+
+        Ok(Project {
+            manifest_file,
+            workspace_manifests,
+            dependencies,
+            platform,
+        })
+    }
+
+    /// Returns a reference to the manifest file for the current project
+    pub fn manifest_file(&self) -> &Path {
+        &self.manifest_file
+    }
+
+    /// Returns an iterator of paths to all of the workspace roots
+    pub fn workspace_roots(&self) -> impl Iterator<Item = &Path> {
+        // Invariant: self.manifest_file and self.extensions will only contain paths to files that we successfully loaded
+        once(&self.manifest_file)
+            .chain(self.workspace_manifests.iter())
+            .map(|file| file.parent().expect("File paths always have a parent"))
+    }
+
+    /// Returns a reference to the Project's `PlatformSpec`, if available
+    pub fn platform(&self) -> Option<&PlatformSpec> {
+        self.platform.as_ref()
+    }
+
+    /// Returns true if the project dependency map contains the specified dependency
+    pub fn has_direct_dependency(&self, dependency: &str) -> bool {
+        self.dependencies.contains_key(dependency)
+    }
+
+    /// Returns true if the input binary name is a direct dependency of the input project
+    pub fn has_direct_bin(&self, bin_name: &OsStr) -> Fallible<bool> {
+        if let Some(name) = bin_name.to_str() {
+            let config_path = volta_home()?.default_tool_bin_config(name);
+
+            return match BinConfig::from_file_if_exists(config_path)? {
+                None => Ok(false),
+                Some(config) => Ok(self.has_direct_dependency(&config.package)),
+            };
+        }
+        Ok(false)
+    }
+
+    /// Searches the project roots to find the path to a project-local binary file
+    pub fn find_bin<P: AsRef<Path>>(&self, bin_name: P) -> Option<PathBuf> {
+        self.workspace_roots().find_map(|root| {
+            let mut bin_path = root.join("node_modules");
+            bin_path.push(".bin");
+            bin_path.push(&bin_name);
+
+            if bin_path.is_file() {
+                Some(bin_path)
+            } else {
+                None
+            }
+        })
+    }
+
+    /// Yarn projects that are using PnP or pnpm linker need to use yarn run.
+    // (project uses Yarn berry if 'yarnrc.yml' exists, uses PnP if '.pnp.js' or '.pnp.cjs' exist)
+    pub fn needs_yarn_run(&self) -> bool {
+        self.platform()
+            .is_some_and(|platform| platform.yarn.is_some())
+            && self.workspace_roots().any(|x| {
+                x.join(".yarnrc.yml").exists()
+                    || x.join(".pnp.cjs").exists()
+                    || x.join(".pnp.js").exists()
+            })
+    }
+
+    /// Pins the Node version in this project's manifest file
+    pub fn pin_node(&mut self, version: Version) -> Fallible<()> {
+        update_manifest(&self.manifest_file, ManifestKey::Node, Some(&version))?;
+
+        if let Some(platform) = self.platform.as_mut() {
+            platform.node = version;
+        } else {
+            self.platform = Some(PlatformSpec {
+                node: version,
+                npm: None,
+                pnpm: None,
+                yarn: None,
+            });
+        }
+
+        Ok(())
+    }
+
+    /// Pins the npm version in this project's manifest file
+    pub fn pin_npm(&mut self, version: Option<Version>) -> Fallible<()> {
+        if let Some(platform) = self.platform.as_mut() {
+            update_manifest(&self.manifest_file, ManifestKey::Npm, version.as_ref())?;
+
+            platform.npm = version;
+
+            Ok(())
+        } else {
+            Err(ErrorKind::NoPinnedNodeVersion { tool: "npm".into() }.into())
+        }
+    }
+
+    /// Pins the pnpm version in this project's manifest file
+    pub fn pin_pnpm(&mut self, version: Option<Version>) -> Fallible<()> {
+        if let Some(platform) = self.platform.as_mut() {
+            update_manifest(&self.manifest_file, ManifestKey::Pnpm, version.as_ref())?;
+
+            platform.pnpm = version;
+
+            Ok(())
+        } else {
+            Err(ErrorKind::NoPinnedNodeVersion {
+                tool: "pnpm".into(),
+            }
+            .into())
+        }
+    }
+
+    /// Pins the Yarn version in this project's manifest file
+    pub fn pin_yarn(&mut self, version: Option<Version>) -> Fallible<()> {
+        if let Some(platform) = self.platform.as_mut() {
+            update_manifest(&self.manifest_file, ManifestKey::Yarn, version.as_ref())?;
+
+            platform.yarn = version;
+
+            Ok(())
+        } else {
+            Err(ErrorKind::NoPinnedNodeVersion {
+                tool: "Yarn".into(),
+            }
+            .into())
+        }
+    }
+}
+
+fn is_node_root(dir: &Path) -> bool {
+    dir.join("package.json").exists()
+}
+
+fn is_node_modules(dir: &Path) -> bool {
+    dir.file_name().is_some_and(|tail| tail == "node_modules")
+}
+
+fn is_dependency(dir: &Path) -> bool {
+    dir.parent().is_some_and(is_node_modules)
+}
+
+fn is_project_root(dir: &Path) -> bool {
+    is_node_root(dir) && !is_dependency(dir)
+}
+
+/// Starts at `base_dir` and walks up the directory tree until a package.json file is found
+pub(crate) fn find_closest_root(mut dir: PathBuf) -> Option<PathBuf> {
+    while !is_project_root(&dir) {
+        if !dir.pop() {
+            return None;
+        }
+    }
+
+    Some(dir)
+}
+
+struct PartialPlatform {
+    node: Option<Version>,
+    npm: Option<Version>,
+    pnpm: Option<Version>,
+    yarn: Option<Version>,
+}
+
+impl PartialPlatform {
+    fn merge(self, other: PartialPlatform) -> PartialPlatform {
+        PartialPlatform {
+            node: self.node.or(other.node),
+            npm: self.npm.or(other.npm),
+            pnpm: self.pnpm.or(other.pnpm),
+            yarn: self.yarn.or(other.yarn),
+        }
+    }
+}
+
+impl TryFrom<PartialPlatform> for PlatformSpec {
+    type Error = VoltaError;
+
+    fn try_from(partial: PartialPlatform) -> Fallible<PlatformSpec> {
+        let node = partial.node.ok_or(ErrorKind::NoProjectNodeInManifest)?;
+
+        Ok(PlatformSpec {
+            node,
+            npm: partial.npm,
+            pnpm: partial.pnpm,
+            yarn: partial.yarn,
+        })
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/project/serial.rs.html b/main/src/volta_core/project/serial.rs.html new file mode 100644 index 000000000..ab67a3b52 --- /dev/null +++ b/main/src/volta_core/project/serial.rs.html @@ -0,0 +1,389 @@ +serial.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+
use std::collections::HashMap;
+use std::fmt;
+use std::fs::{read_to_string, File};
+use std::io::Write;
+use std::path::{Path, PathBuf};
+
+use super::PartialPlatform;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::version::parse_version;
+use dunce::canonicalize;
+use node_semver::Version;
+use serde::{Deserialize, Serialize};
+use serde_json::{Map, Value};
+
+pub type DependencyMapIterator = std::iter::Chain<
+    std::option::IntoIter<HashMap<String, String>>,
+    std::option::IntoIter<HashMap<String, String>>,
+>;
+
+pub(super) struct Manifest {
+    pub dependency_maps: DependencyMapIterator,
+    pub platform: Option<PartialPlatform>,
+    pub extends: Option<PathBuf>,
+}
+
+impl Manifest {
+    pub fn from_file(file: &Path) -> Fallible<Self> {
+        let raw = RawManifest::from_file(file)?;
+
+        let dependency_maps = raw.dependencies.into_iter().chain(raw.dev_dependencies);
+
+        let (platform, extends) = match raw.volta {
+            Some(toolchain) => {
+                let (partial, extends) = toolchain.parse_split()?;
+
+                let next = extends
+                    .map(|path| {
+                        // Invariant: Since we successfully parsed it, we know we have a path to a file
+                        let unresolved = file
+                            .parent()
+                            .expect("File paths always have a parent")
+                            .join(&path);
+                        canonicalize(unresolved)
+                            .with_context(|| ErrorKind::ExtensionPathError { path })
+                    })
+                    .transpose()?;
+                (Some(partial), next)
+            }
+            None => (None, None),
+        };
+
+        Ok(Manifest {
+            dependency_maps,
+            platform,
+            extends,
+        })
+    }
+}
+
+pub(super) enum ManifestKey {
+    Node,
+    Npm,
+    Pnpm,
+    Yarn,
+}
+
+impl fmt::Display for ManifestKey {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(match self {
+            ManifestKey::Node => "node",
+            ManifestKey::Npm => "npm",
+            ManifestKey::Pnpm => "pnpm",
+            ManifestKey::Yarn => "yarn",
+        })
+    }
+}
+
+/// Updates the `volta` hash in the specified manifest with the given key and value
+///
+/// Will create the `volta` hash if it isn't already present
+///
+/// If the value is `None`, will remove the key from the hash
+pub(super) fn update_manifest(
+    file: &Path,
+    key: ManifestKey,
+    value: Option<&Version>,
+) -> Fallible<()> {
+    let contents = read_to_string(file).with_context(|| ErrorKind::PackageReadError {
+        file: file.to_owned(),
+    })?;
+
+    let mut manifest: serde_json::Value =
+        serde_json::from_str(&contents).with_context(|| ErrorKind::PackageParseError {
+            file: file.to_owned(),
+        })?;
+
+    let root = manifest
+        .as_object_mut()
+        .ok_or_else(|| ErrorKind::PackageParseError {
+            file: file.to_owned(),
+        })?;
+
+    let key = key.to_string();
+
+    match (value, root.get_mut("volta").and_then(|v| v.as_object_mut())) {
+        (Some(v), Some(hash)) => {
+            hash.insert(key, Value::String(v.to_string()));
+        }
+        (None, Some(hash)) => {
+            hash.remove(&key);
+        }
+        (Some(v), None) => {
+            let mut map = Map::new();
+            map.insert(key, Value::String(v.to_string()));
+            root.insert("volta".into(), Value::Object(map));
+        }
+        (None, None) => {}
+    }
+
+    let indent = detect_indent::detect_indent(&contents);
+    let mut output = File::create(file).with_context(|| ErrorKind::PackageWriteError {
+        file: file.to_owned(),
+    })?;
+    let formatter = serde_json::ser::PrettyFormatter::with_indent(indent.indent().as_bytes());
+    let mut ser = serde_json::Serializer::with_formatter(&output, formatter);
+    manifest
+        .serialize(&mut ser)
+        .with_context(|| ErrorKind::PackageWriteError {
+            file: file.to_owned(),
+        })?;
+
+    if contents.ends_with('\n') {
+        writeln!(output).with_context(|| ErrorKind::PackageWriteError {
+            file: file.to_owned(),
+        })?;
+    }
+
+    Ok(())
+}
+
+#[derive(Deserialize)]
+struct RawManifest {
+    dependencies: Option<HashMap<String, String>>,
+
+    #[serde(rename = "devDependencies")]
+    dev_dependencies: Option<HashMap<String, String>>,
+
+    volta: Option<ToolchainSpec>,
+}
+
+impl RawManifest {
+    fn from_file(package: &Path) -> Fallible<Self> {
+        let file = File::open(package).with_context(|| ErrorKind::PackageReadError {
+            file: package.to_owned(),
+        })?;
+
+        serde_json::de::from_reader(file).with_context(|| ErrorKind::PackageParseError {
+            file: package.to_owned(),
+        })
+    }
+}
+
+#[derive(Default, Deserialize, Serialize)]
+struct ToolchainSpec {
+    #[serde(skip_serializing_if = "Option::is_none")]
+    node: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    npm: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pnpm: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    yarn: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    extends: Option<PathBuf>,
+}
+
+impl ToolchainSpec {
+    /// Moves the tool versions into a `PartialPlatform` and returns that along with the `extends` value
+    fn parse_split(self) -> Fallible<(PartialPlatform, Option<PathBuf>)> {
+        let node = self.node.map(parse_version).transpose()?;
+        let npm = self.npm.map(parse_version).transpose()?;
+        let pnpm = self.pnpm.map(parse_version).transpose()?;
+        let yarn = self.yarn.map(parse_version).transpose()?;
+
+        let platform = PartialPlatform {
+            node,
+            npm,
+            pnpm,
+            yarn,
+        };
+
+        Ok((platform, self.extends))
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/binary.rs.html b/main/src/volta_core/run/binary.rs.html new file mode 100644 index 000000000..9d3a21f4e --- /dev/null +++ b/main/src/volta_core/run/binary.rs.html @@ -0,0 +1,401 @@ +binary.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+
use std::env;
+use std::ffi::{OsStr, OsString};
+use std::path::PathBuf;
+
+use super::executor::{Executor, ToolCommand, ToolKind};
+use super::{debug_active_image, debug_no_platform};
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::layout::volta_home;
+use crate::platform::{Platform, Sourced, System};
+use crate::session::Session;
+use crate::tool::package::BinConfig;
+use log::debug;
+
+/// Determine the correct command to run for a 3rd-party binary
+///
+/// Will detect if we should delegate to the project-local version or use the default version
+pub(super) fn command(exe: &OsStr, args: &[OsString], session: &mut Session) -> Fallible<Executor> {
+    let bin = exe.to_string_lossy().to_string();
+    // First try to use the project toolchain
+    if let Some(project) = session.project()? {
+        // Check if the executable is a direct dependency
+        if project.has_direct_bin(exe)? {
+            match project.find_bin(exe) {
+                Some(path_to_bin) => {
+                    debug!("Found {} in project at '{}'", bin, path_to_bin.display());
+
+                    let platform = Platform::current(session)?;
+                    return Ok(ToolCommand::new(
+                        path_to_bin,
+                        args,
+                        platform,
+                        ToolKind::ProjectLocalBinary(bin),
+                    )
+                    .into());
+                }
+                None => {
+                    if project.needs_yarn_run() {
+                        debug!(
+                            "Project needs to use yarn to run command, calling {} with 'yarn'",
+                            bin
+                        );
+                        let platform = Platform::current(session)?;
+                        let mut exe_and_args = vec![exe.to_os_string()];
+                        exe_and_args.extend_from_slice(args);
+                        return Ok(ToolCommand::new(
+                            "yarn",
+                            exe_and_args,
+                            platform,
+                            ToolKind::Yarn,
+                        )
+                        .into());
+                    } else {
+                        return Err(ErrorKind::ProjectLocalBinaryNotFound {
+                            command: exe.to_string_lossy().to_string(),
+                        }
+                        .into());
+                    }
+                }
+            }
+        }
+    }
+
+    // Try to use the default toolchain
+    if let Some(default_tool) = DefaultBinary::from_name(exe, session)? {
+        debug!(
+            "Found default {} in '{}'",
+            bin,
+            default_tool.bin_path.display()
+        );
+
+        let mut command = ToolCommand::new(
+            default_tool.bin_path,
+            args,
+            Some(default_tool.platform),
+            ToolKind::DefaultBinary(bin),
+        );
+        command.env("NODE_PATH", shared_module_path()?);
+
+        return Ok(command.into());
+    }
+
+    // At this point, the binary is not known to Volta, so we have no platform to use to execute it
+    // This should be rare, as anything we have a shim for should have a config file to load
+    Ok(ToolCommand::new(exe, args, None, ToolKind::DefaultBinary(bin)).into())
+}
+
+/// Determine the execution context (PATH and failure error message) for a project-local binary
+pub(super) fn local_execution_context(
+    tool: String,
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            let image = plat.checkout(session)?;
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((
+                path,
+                ErrorKind::ProjectLocalBinaryExecError { command: tool },
+            ))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+
+            Ok((path, ErrorKind::NoPlatform))
+        }
+    }
+}
+
+/// Determine the execution context (PATH and failure error message) for a default binary
+pub(super) fn default_execution_context(
+    tool: String,
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            let image = plat.checkout(session)?;
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((path, ErrorKind::BinaryExecError))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+
+            Ok((path, ErrorKind::BinaryNotFound { name: tool }))
+        }
+    }
+}
+
+/// Information about the location and execution context of default binaries
+///
+/// Fetched from the config files in the Volta directory, represents the binary that is executed
+/// when the user is outside of a project that has the given bin as a dependency.
+pub struct DefaultBinary {
+    pub bin_path: PathBuf,
+    pub platform: Platform,
+}
+
+impl DefaultBinary {
+    pub fn from_config(bin_config: BinConfig, session: &mut Session) -> Fallible<Self> {
+        let package_dir = volta_home()?.package_image_dir(&bin_config.package);
+        let mut bin_path = bin_config.manager.binary_dir(package_dir);
+        bin_path.push(&bin_config.name);
+
+        // If the user does not have yarn set in the platform for this binary, use the default
+        // This is necessary because some tools (e.g. ember-cli with the `--yarn` option) invoke `yarn`
+        let yarn = match bin_config.platform.yarn {
+            Some(yarn) => Some(yarn),
+            None => session
+                .default_platform()?
+                .and_then(|plat| plat.yarn.clone()),
+        };
+        let platform = Platform {
+            node: Sourced::with_binary(bin_config.platform.node),
+            npm: bin_config.platform.npm.map(Sourced::with_binary),
+            pnpm: bin_config.platform.pnpm.map(Sourced::with_binary),
+            yarn: yarn.map(Sourced::with_binary),
+        };
+
+        Ok(DefaultBinary { bin_path, platform })
+    }
+
+    /// Load information about a default binary by name, if available
+    ///
+    /// A `None` response here means that the tool information couldn't be found. Either the tool
+    /// name is not a valid UTF-8 string, or the tool config doesn't exist.
+    pub fn from_name(tool_name: &OsStr, session: &mut Session) -> Fallible<Option<Self>> {
+        let bin_config_file = match tool_name.to_str() {
+            Some(name) => volta_home()?.default_tool_bin_config(name),
+            None => return Ok(None),
+        };
+
+        match BinConfig::from_file_if_exists(bin_config_file)? {
+            Some(config) => DefaultBinary::from_config(config, session).map(Some),
+            None => Ok(None),
+        }
+    }
+}
+
+/// Determine the value for NODE_PATH, with the shared lib directory prepended
+///
+/// This will ensure that global bins can `require` other global libs
+fn shared_module_path() -> Fallible<OsString> {
+    let node_path = match env::var("NODE_PATH") {
+        Ok(path) => envoy::Var::from(path),
+        Err(_) => envoy::Var::from(""),
+    };
+
+    node_path
+        .split()
+        .prefix_entry(volta_home()?.shared_lib_root())
+        .join()
+        .with_context(|| ErrorKind::BuildPathError)
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/executor.rs.html b/main/src/volta_core/run/executor.rs.html new file mode 100644 index 000000000..28bc7b4b5 --- /dev/null +++ b/main/src/volta_core/run/executor.rs.html @@ -0,0 +1,1127 @@ +executor.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+
use std::collections::HashMap;
+use std::ffi::OsStr;
+#[cfg(unix)]
+use std::os::unix::process::ExitStatusExt;
+#[cfg(windows)]
+use std::os::windows::process::ExitStatusExt;
+use std::process::{Command, ExitStatus};
+
+use super::RECURSION_ENV_VAR;
+use crate::command::create_command;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::layout::volta_home;
+use crate::platform::{CliPlatform, Platform, System};
+use crate::session::Session;
+use crate::signal::pass_control_to_shim;
+use crate::style::{note_prefix, tool_version};
+use crate::sync::VoltaLock;
+use crate::tool::package::{DirectInstall, InPlaceUpgrade, PackageConfig, PackageManager};
+use crate::tool::Spec;
+use log::{info, warn};
+
+pub enum Executor {
+    Tool(Box<ToolCommand>),
+    PackageInstall(Box<PackageInstallCommand>),
+    PackageLink(Box<PackageLinkCommand>),
+    PackageUpgrade(Box<PackageUpgradeCommand>),
+    InternalInstall(Box<InternalInstallCommand>),
+    Uninstall(Box<UninstallCommand>),
+    Multiple(Vec<Executor>),
+}
+
+impl Executor {
+    pub fn envs<K, V, S>(&mut self, envs: &HashMap<K, V, S>)
+    where
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
+    {
+        match self {
+            Executor::Tool(cmd) => cmd.envs(envs),
+            Executor::PackageInstall(cmd) => cmd.envs(envs),
+            Executor::PackageLink(cmd) => cmd.envs(envs),
+            Executor::PackageUpgrade(cmd) => cmd.envs(envs),
+            // Internal installs use Volta's logic and don't rely on the environment variables
+            Executor::InternalInstall(_) => {}
+            // Uninstalls use Volta's logic and don't rely on environment variables
+            Executor::Uninstall(_) => {}
+            Executor::Multiple(executors) => {
+                for exe in executors {
+                    exe.envs(envs);
+                }
+            }
+        }
+    }
+
+    pub fn cli_platform(&mut self, cli: CliPlatform) {
+        match self {
+            Executor::Tool(cmd) => cmd.cli_platform(cli),
+            Executor::PackageInstall(cmd) => cmd.cli_platform(cli),
+            Executor::PackageLink(cmd) => cmd.cli_platform(cli),
+            Executor::PackageUpgrade(cmd) => cmd.cli_platform(cli),
+            // Internal installs use Volta's logic and don't rely on the Node platform
+            Executor::InternalInstall(_) => {}
+            // Uninstall use Volta's logic and don't rely on the Node platform
+            Executor::Uninstall(_) => {}
+            Executor::Multiple(executors) => {
+                for exe in executors {
+                    exe.cli_platform(cli.clone());
+                }
+            }
+        }
+    }
+
+    pub fn execute(self, session: &mut Session) -> Fallible<ExitStatus> {
+        match self {
+            Executor::Tool(cmd) => cmd.execute(session),
+            Executor::PackageInstall(cmd) => cmd.execute(session),
+            Executor::PackageLink(cmd) => cmd.execute(session),
+            Executor::PackageUpgrade(cmd) => cmd.execute(session),
+            Executor::InternalInstall(cmd) => cmd.execute(session),
+            Executor::Uninstall(cmd) => cmd.execute(),
+            Executor::Multiple(executors) => {
+                info!(
+                    "{} Volta is processing each package separately",
+                    note_prefix()
+                );
+                for exe in executors {
+                    let status = exe.execute(session)?;
+                    // If any of the sub-commands fail, then we should stop installing and return
+                    // that failure.
+                    if !status.success() {
+                        return Ok(status);
+                    }
+                }
+                // If we get here, then all of the sub-commands succeeded, so we should report success
+                Ok(ExitStatus::from_raw(0))
+            }
+        }
+    }
+}
+
+impl From<Vec<Executor>> for Executor {
+    fn from(mut executors: Vec<Executor>) -> Self {
+        if executors.len() == 1 {
+            executors.pop().unwrap()
+        } else {
+            Executor::Multiple(executors)
+        }
+    }
+}
+
+/// Process builder for launching a Volta-managed tool
+///
+/// Tracks the Platform as well as what kind of tool is being executed, to allow individual tools
+/// to customize the behavior before execution.
+pub struct ToolCommand {
+    command: Command,
+    platform: Option<Platform>,
+    kind: ToolKind,
+}
+
+/// The kind of tool being executed, used to determine the correct execution context
+pub enum ToolKind {
+    Node,
+    Npm,
+    Npx,
+    Pnpm,
+    Yarn,
+    ProjectLocalBinary(String),
+    DefaultBinary(String),
+    Bypass(String),
+}
+
+impl ToolCommand {
+    pub fn new<E, A, S>(exe: E, args: A, platform: Option<Platform>, kind: ToolKind) -> Self
+    where
+        E: AsRef<OsStr>,
+        A: IntoIterator<Item = S>,
+        S: AsRef<OsStr>,
+    {
+        let mut command = create_command(exe);
+        command.args(args);
+
+        Self {
+            command,
+            platform,
+            kind,
+        }
+    }
+
+    /// Adds or updates environment variables that the command will use
+    pub fn envs<E, K, V>(&mut self, envs: E)
+    where
+        E: IntoIterator<Item = (K, V)>,
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
+    {
+        self.command.envs(envs);
+    }
+
+    /// Adds or updates a single environment variable that the command will use
+    pub fn env<K, V>(&mut self, key: K, value: V)
+    where
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
+    {
+        self.command.env(key, value);
+    }
+
+    /// Updates the Platform for the command to include values from the command-line
+    pub fn cli_platform(&mut self, cli: CliPlatform) {
+        self.platform = match self.platform.take() {
+            Some(base) => Some(cli.merge(base)),
+            None => cli.into(),
+        };
+    }
+
+    /// Runs the command, returning the `ExitStatus` if it successfully launches
+    pub fn execute(mut self, session: &mut Session) -> Fallible<ExitStatus> {
+        let (path, on_failure) = match self.kind {
+            ToolKind::Node => super::node::execution_context(self.platform, session)?,
+            ToolKind::Npm => super::npm::execution_context(self.platform, session)?,
+            ToolKind::Npx => super::npx::execution_context(self.platform, session)?,
+            ToolKind::Pnpm => super::pnpm::execution_context(self.platform, session)?,
+            ToolKind::Yarn => super::yarn::execution_context(self.platform, session)?,
+            ToolKind::DefaultBinary(bin) => {
+                super::binary::default_execution_context(bin, self.platform, session)?
+            }
+            ToolKind::ProjectLocalBinary(bin) => {
+                super::binary::local_execution_context(bin, self.platform, session)?
+            }
+            ToolKind::Bypass(command) => (System::path()?, ErrorKind::BypassError { command }),
+        };
+
+        self.command.env(RECURSION_ENV_VAR, "1");
+        self.command.env("PATH", path);
+
+        pass_control_to_shim();
+        self.command.status().with_context(|| on_failure)
+    }
+}
+
+impl From<ToolCommand> for Executor {
+    fn from(cmd: ToolCommand) -> Self {
+        Executor::Tool(Box::new(cmd))
+    }
+}
+
+/// Process builder for launching a package install command (e.g. `npm install --global`)
+///
+/// This will use a `DirectInstall` instance to modify the command before running to point it to
+/// the Volta directory. It will also complete the install, writing config files and shims
+pub struct PackageInstallCommand {
+    /// The command that will ultimately be executed
+    command: Command,
+    /// The installer that modifies the command as necessary and provides the completion method
+    installer: DirectInstall,
+    /// The platform to use when running the command.
+    platform: Platform,
+}
+
+impl PackageInstallCommand {
+    pub fn new<A, S>(args: A, platform: Platform, manager: PackageManager) -> Fallible<Self>
+    where
+        A: IntoIterator<Item = S>,
+        S: AsRef<OsStr>,
+    {
+        let installer = DirectInstall::new(manager)?;
+
+        let mut command = match manager {
+            PackageManager::Npm => create_command("npm"),
+            PackageManager::Pnpm => create_command("pnpm"),
+            PackageManager::Yarn => create_command("yarn"),
+        };
+        command.args(args);
+
+        Ok(PackageInstallCommand {
+            command,
+            installer,
+            platform,
+        })
+    }
+
+    pub fn for_npm_link<A, S>(args: A, platform: Platform, name: String) -> Fallible<Self>
+    where
+        A: IntoIterator<Item = S>,
+        S: AsRef<OsStr>,
+    {
+        let installer = DirectInstall::with_name(PackageManager::Npm, name)?;
+
+        let mut command = create_command("npm");
+        command.args(args);
+
+        Ok(PackageInstallCommand {
+            command,
+            installer,
+            platform,
+        })
+    }
+
+    /// Adds or updates environment variables that the command will use
+    pub fn envs<E, K, V>(&mut self, envs: E)
+    where
+        E: IntoIterator<Item = (K, V)>,
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
+    {
+        self.command.envs(envs);
+    }
+
+    /// Updates the Platform for the command to include values from the command-line
+    pub fn cli_platform(&mut self, cli: CliPlatform) {
+        self.platform = cli.merge(self.platform.clone());
+    }
+
+    /// Runs the install command, applying the necessary modifications to install into the Volta
+    /// data directory
+    pub fn execute(mut self, session: &mut Session) -> Fallible<ExitStatus> {
+        let _lock = VoltaLock::acquire();
+        let image = self.platform.checkout(session)?;
+        let path = image.path()?;
+
+        self.command.env(RECURSION_ENV_VAR, "1");
+        self.command.env("PATH", path);
+        self.installer.setup_command(&mut self.command);
+
+        let status = self
+            .command
+            .status()
+            .with_context(|| ErrorKind::BinaryExecError)?;
+
+        if status.success() {
+            self.installer.complete_install(&image)?;
+        }
+
+        Ok(status)
+    }
+}
+
+impl From<PackageInstallCommand> for Executor {
+    fn from(cmd: PackageInstallCommand) -> Self {
+        Executor::PackageInstall(Box::new(cmd))
+    }
+}
+
+/// Process builder for launching a `npm link <package>` command
+///
+/// This will set the appropriate environment variables to ensure that the linked package can be
+/// found.
+pub struct PackageLinkCommand {
+    /// The command that will ultimately be executed
+    command: Command,
+    /// The tool the user wants to link
+    tool: String,
+    /// The platform to use when running the command
+    platform: Platform,
+}
+
+impl PackageLinkCommand {
+    pub fn new<A, S>(args: A, platform: Platform, tool: String) -> Self
+    where
+        A: IntoIterator<Item = S>,
+        S: AsRef<OsStr>,
+    {
+        let mut command = create_command("npm");
+        command.args(args);
+
+        PackageLinkCommand {
+            command,
+            tool,
+            platform,
+        }
+    }
+
+    /// Adds or updates environment variables that the command will use
+    pub fn envs<E, K, V>(&mut self, envs: E)
+    where
+        E: IntoIterator<Item = (K, V)>,
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
+    {
+        self.command.envs(envs);
+    }
+
+    /// Updates the Platform for the command to include values from the command-line
+    pub fn cli_platform(&mut self, cli: CliPlatform) {
+        self.platform = cli.merge(self.platform.clone());
+    }
+
+    /// Runs the link command, applying the necessary modifications to pull from the Volta data
+    /// directory.
+    ///
+    /// This will also check for some common failure cases and alert the user
+    pub fn execute(mut self, session: &mut Session) -> Fallible<ExitStatus> {
+        self.check_linked_package(session)?;
+
+        let image = self.platform.checkout(session)?;
+        let path = image.path()?;
+
+        self.command.env(RECURSION_ENV_VAR, "1");
+        self.command.env("PATH", path);
+        let package_root = volta_home()?.package_image_dir(&self.tool);
+        PackageManager::Npm.setup_global_command(&mut self.command, package_root);
+
+        self.command
+            .status()
+            .with_context(|| ErrorKind::BinaryExecError)
+    }
+
+    /// Check for possible failure cases with the linked package:
+    ///     - The package is not found as a global
+    ///     - The package exists, but was linked using a different package manager
+    ///     - The package is using a different version of Node than the current project (warning)
+    fn check_linked_package(&self, session: &mut Session) -> Fallible<()> {
+        let config =
+            PackageConfig::from_file(volta_home()?.default_package_config_file(&self.tool))
+                .with_context(|| ErrorKind::NpmLinkMissingPackage {
+                    package: self.tool.clone(),
+                })?;
+
+        if config.manager != PackageManager::Npm {
+            return Err(ErrorKind::NpmLinkWrongManager {
+                package: self.tool.clone(),
+            }
+            .into());
+        }
+
+        if let Some(platform) = session.project_platform()? {
+            if platform.node.major != config.platform.node.major {
+                warn!(
+                    "the current project is using {}, but package '{}' was linked using {}. These might not interact correctly.",
+                    tool_version("node", &platform.node),
+                    self.tool,
+                    tool_version("node", &config.platform.node)
+                );
+            }
+        }
+
+        Ok(())
+    }
+}
+
+impl From<PackageLinkCommand> for Executor {
+    fn from(cmd: PackageLinkCommand) -> Self {
+        Executor::PackageLink(Box::new(cmd))
+    }
+}
+
+/// Process builder for launching a global package upgrade command (e.g. `npm update -g`)
+///
+/// This will use an `InPlaceUpgrade` instance to modify the command and point at the appropriate
+/// image directory. It will also complete the install, writing any updated configs and shims
+pub struct PackageUpgradeCommand {
+    /// The command that will ultimately be executed
+    command: Command,
+    /// Helper utility to modify the command and provide the completion method
+    upgrader: InPlaceUpgrade,
+    /// The platform to run the command under
+    platform: Platform,
+}
+
+impl PackageUpgradeCommand {
+    pub fn new<A, S>(
+        args: A,
+        package: String,
+        platform: Platform,
+        manager: PackageManager,
+    ) -> Fallible<Self>
+    where
+        A: IntoIterator<Item = S>,
+        S: AsRef<OsStr>,
+    {
+        let upgrader = InPlaceUpgrade::new(package, manager)?;
+
+        let mut command = match manager {
+            PackageManager::Npm => create_command("npm"),
+            PackageManager::Pnpm => create_command("pnpm"),
+            PackageManager::Yarn => create_command("yarn"),
+        };
+        command.args(args);
+
+        Ok(PackageUpgradeCommand {
+            command,
+            upgrader,
+            platform,
+        })
+    }
+
+    /// Adds or updates environment variables that the command will use
+    pub fn envs<E, K, V>(&mut self, envs: E)
+    where
+        E: IntoIterator<Item = (K, V)>,
+        K: AsRef<OsStr>,
+        V: AsRef<OsStr>,
+    {
+        self.command.envs(envs);
+    }
+
+    /// Updates the Platform for the command to include values from the command-line
+    pub fn cli_platform(&mut self, cli: CliPlatform) {
+        self.platform = cli.merge(self.platform.clone());
+    }
+
+    /// Runs the upgrade command, applying the necessary modifications to point at the Volta image
+    /// directory
+    ///
+    /// Will also check for common failure cases, such as non-existant package or wrong package
+    /// manager
+    pub fn execute(mut self, session: &mut Session) -> Fallible<ExitStatus> {
+        self.upgrader.check_upgraded_package()?;
+
+        let _lock = VoltaLock::acquire();
+        let image = self.platform.checkout(session)?;
+        let path = image.path()?;
+
+        self.command.env(RECURSION_ENV_VAR, "1");
+        self.command.env("PATH", path);
+        self.upgrader.setup_command(&mut self.command);
+
+        let status = self
+            .command
+            .status()
+            .with_context(|| ErrorKind::BinaryExecError)?;
+
+        if status.success() {
+            self.upgrader.complete_upgrade(&image)?;
+        }
+
+        Ok(status)
+    }
+}
+
+impl From<PackageUpgradeCommand> for Executor {
+    fn from(cmd: PackageUpgradeCommand) -> Self {
+        Executor::PackageUpgrade(Box::new(cmd))
+    }
+}
+
+/// Executor for running an internal install (installing Node, npm, pnpm or Yarn using the `volta
+/// install` logic)
+///
+/// Note: This is not intended to be used for Package installs. Those should go through the
+/// `PackageInstallCommand` above, to more seamlessly integrate with the package manager
+pub struct InternalInstallCommand {
+    tool: Spec,
+}
+
+impl InternalInstallCommand {
+    pub fn new(tool: Spec) -> Self {
+        InternalInstallCommand { tool }
+    }
+
+    /// Runs the install, using Volta's internal install logic for the appropriate tool
+    fn execute(self, session: &mut Session) -> Fallible<ExitStatus> {
+        info!(
+            "{} using Volta to install {}",
+            note_prefix(),
+            self.tool.name()
+        );
+
+        self.tool.resolve(session)?.install(session)?;
+
+        Ok(ExitStatus::from_raw(0))
+    }
+}
+
+impl From<InternalInstallCommand> for Executor {
+    fn from(cmd: InternalInstallCommand) -> Self {
+        Executor::InternalInstall(Box::new(cmd))
+    }
+}
+
+/// Executor for running a tool uninstall command.
+///
+/// This will use the `volta uninstall` logic to correctly ensure that the package is fully
+/// uninstalled
+pub struct UninstallCommand {
+    tool: Spec,
+}
+
+impl UninstallCommand {
+    pub fn new(tool: Spec) -> Self {
+        UninstallCommand { tool }
+    }
+
+    /// Runs the uninstall with Volta's internal uninstall logic
+    fn execute(self) -> Fallible<ExitStatus> {
+        info!(
+            "{} using Volta to uninstall {}",
+            note_prefix(),
+            self.tool.name()
+        );
+
+        self.tool.uninstall()?;
+
+        Ok(ExitStatus::from_raw(0))
+    }
+}
+
+impl From<UninstallCommand> for Executor {
+    fn from(cmd: UninstallCommand) -> Self {
+        Executor::Uninstall(Box::new(cmd))
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/mod.rs.html b/main/src/volta_core/run/mod.rs.html new file mode 100644 index 000000000..ff0723923 --- /dev/null +++ b/main/src/volta_core/run/mod.rs.html @@ -0,0 +1,331 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+
use std::collections::HashMap;
+use std::env::{self, ArgsOs};
+use std::ffi::{OsStr, OsString};
+use std::path::Path;
+use std::process::ExitStatus;
+
+use crate::error::{ErrorKind, Fallible};
+use crate::platform::{CliPlatform, Image, Sourced};
+use crate::session::Session;
+use crate::VOLTA_FEATURE_PNPM;
+use log::debug;
+use node_semver::Version;
+
+pub mod binary;
+mod executor;
+mod node;
+mod npm;
+mod npx;
+mod parser;
+mod pnpm;
+mod yarn;
+
+/// Environment variable set internally when a shim has been executed and the context evaluated
+///
+/// This is set when executing a shim command. If this is already, then the built-in shims (Node,
+/// npm, npx, pnpm and Yarn) will assume that the context has already been evaluated & the PATH has
+/// already been modified, so they will use the pass-through behavior.
+///
+/// Shims should only be called recursively when the environment is misconfigured, so this will
+/// prevent infinite recursion as the pass-through logic removes the shim directory from the PATH.
+///
+/// Note: This is explicitly _removed_ when calling a command through `volta run`, as that will
+/// never happen due to the Volta environment.
+const RECURSION_ENV_VAR: &str = "_VOLTA_TOOL_RECURSION";
+const VOLTA_BYPASS: &str = "VOLTA_BYPASS";
+
+/// Execute a shim command, based on the command-line arguments to the current process
+pub fn execute_shim(session: &mut Session) -> Fallible<ExitStatus> {
+    let mut native_args = env::args_os();
+    let exe = get_tool_name(&mut native_args)?;
+    let args: Vec<_> = native_args.collect();
+
+    get_executor(&exe, &args, session)?.execute(session)
+}
+
+/// Execute a tool with the provided arguments
+pub fn execute_tool<K, V, S>(
+    exe: &OsStr,
+    args: &[OsString],
+    envs: &HashMap<K, V, S>,
+    cli: CliPlatform,
+    session: &mut Session,
+) -> Fallible<ExitStatus>
+where
+    K: AsRef<OsStr>,
+    V: AsRef<OsStr>,
+{
+    // Remove the recursion environment variable so that the context is correctly re-evaluated
+    // when calling `volta run` (even when called from a Node script)
+    env::remove_var(RECURSION_ENV_VAR);
+
+    let mut runner = get_executor(exe, args, session)?;
+    runner.cli_platform(cli);
+    runner.envs(envs);
+
+    runner.execute(session)
+}
+
+/// Get the appropriate Tool command, based on the requested executable and arguments
+fn get_executor(
+    exe: &OsStr,
+    args: &[OsString],
+    session: &mut Session,
+) -> Fallible<executor::Executor> {
+    if env::var_os(VOLTA_BYPASS).is_some() {
+        Ok(executor::ToolCommand::new(
+            exe,
+            args,
+            None,
+            executor::ToolKind::Bypass(exe.to_string_lossy().to_string()),
+        )
+        .into())
+    } else {
+        match exe.to_str() {
+            Some("volta-shim") => Err(ErrorKind::RunShimDirectly.into()),
+            Some("node") => node::command(args, session),
+            Some("npm") => npm::command(args, session),
+            Some("npx") => npx::command(args, session),
+            Some("pnpm") => {
+                // If the pnpm feature flag variable is set, delegate to the pnpm handler
+                // If not, use the binary handler as a fallback (prior to pnpm support, installing
+                // pnpm would be handled the same as any other global binary)
+                if env::var_os(VOLTA_FEATURE_PNPM).is_some() {
+                    pnpm::command(args, session)
+                } else {
+                    binary::command(exe, args, session)
+                }
+            }
+            Some("yarn") | Some("yarnpkg") => yarn::command(args, session),
+            _ => binary::command(exe, args, session),
+        }
+    }
+}
+
+/// Determine the name of the command to run by inspecting the first argument to the active process
+fn get_tool_name(args: &mut ArgsOs) -> Fallible<OsString> {
+    args.next()
+        .and_then(|arg0| Path::new(&arg0).file_name().map(tool_name_from_file_name))
+        .ok_or_else(|| ErrorKind::CouldNotDetermineTool.into())
+}
+
+#[cfg(unix)]
+fn tool_name_from_file_name(file_name: &OsStr) -> OsString {
+    file_name.to_os_string()
+}
+
+#[cfg(windows)]
+fn tool_name_from_file_name(file_name: &OsStr) -> OsString {
+    // On Windows PowerShell, the file name includes the .exe suffix,
+    // and the Windows file system is case-insensitive
+    // We need to remove that to get the raw tool name
+    match file_name.to_str() {
+        Some(file) => OsString::from(file.to_ascii_lowercase().trim_end_matches(".exe")),
+        None => OsString::from(file_name),
+    }
+}
+
+/// Write a debug message that there is no platform available
+#[inline]
+fn debug_no_platform() {
+    debug!("Could not find Volta-managed platform, delegating to system");
+}
+
+/// Write a debug message with the full image that will be used to execute a command
+#[inline]
+fn debug_active_image(image: &Image) {
+    debug!(
+        "Active Image:
+    Node: {}
+    npm: {}
+    pnpm: {}
+    Yarn: {}",
+        format_tool_version(&image.node),
+        image
+            .resolve_npm()
+            .ok()
+            .as_ref()
+            .map(format_tool_version)
+            .unwrap_or_else(|| "Bundled with Node".into()),
+        image
+            .pnpm
+            .as_ref()
+            .map(format_tool_version)
+            .unwrap_or_else(|| "None".into()),
+        image
+            .yarn
+            .as_ref()
+            .map(format_tool_version)
+            .unwrap_or_else(|| "None".into()),
+    )
+}
+
+fn format_tool_version(version: &Sourced<Version>) -> String {
+    format!("{} from {} configuration", version.value, version.source)
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/node.rs.html b/main/src/volta_core/run/node.rs.html new file mode 100644 index 000000000..5562f3ca5 --- /dev/null +++ b/main/src/volta_core/run/node.rs.html @@ -0,0 +1,83 @@ +node.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+
use std::env;
+use std::ffi::OsString;
+
+use super::executor::{Executor, ToolCommand, ToolKind};
+use super::{debug_active_image, debug_no_platform, RECURSION_ENV_VAR};
+use crate::error::{ErrorKind, Fallible};
+use crate::platform::{Platform, System};
+use crate::session::{ActivityKind, Session};
+
+/// Build a `ToolCommand` for Node
+pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible<Executor> {
+    session.add_event_start(ActivityKind::Node);
+    // Don't re-evaluate the platform if this is a recursive call
+    let platform = match env::var_os(RECURSION_ENV_VAR) {
+        Some(_) => None,
+        None => Platform::current(session)?,
+    };
+
+    Ok(ToolCommand::new("node", args, platform, ToolKind::Node).into())
+}
+
+/// Determine the execution context (PATH and failure error message) for Node
+pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            let image = plat.checkout(session)?;
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((path, ErrorKind::BinaryExecError))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+            Ok((path, ErrorKind::NoPlatform))
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/npm.rs.html b/main/src/volta_core/run/npm.rs.html new file mode 100644 index 000000000..5c9994067 --- /dev/null +++ b/main/src/volta_core/run/npm.rs.html @@ -0,0 +1,187 @@ +npm.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+
use std::env;
+use std::ffi::OsString;
+use std::fs::File;
+
+use super::executor::{Executor, ToolCommand, ToolKind, UninstallCommand};
+use super::parser::{CommandArg, InterceptedCommand};
+use super::{debug_active_image, debug_no_platform, RECURSION_ENV_VAR};
+use crate::error::{ErrorKind, Fallible};
+use crate::platform::{Platform, System};
+use crate::session::{ActivityKind, Session};
+use crate::tool::{PackageManifest, Spec};
+use crate::version::VersionSpec;
+
+/// Build an `Executor` for npm
+///
+/// If the command is a global install or uninstall and we have a default platform available, then
+/// we will use custom logic to ensure that the package is correctly installed / uninstalled in the
+/// Volta directory.
+///
+/// If the command is _not_ a global install / uninstall or we don't have a default platform, then
+/// we will allow npm to execute the command as usual.
+pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible<Executor> {
+    session.add_event_start(ActivityKind::Npm);
+    // Don't re-evaluate the context or global install interception if this is a recursive call
+    let platform = match env::var_os(RECURSION_ENV_VAR) {
+        Some(_) => None,
+        None => {
+            match CommandArg::for_npm(args) {
+                CommandArg::Global(cmd) => {
+                    // For globals, only intercept if the default platform exists
+                    if let Some(default_platform) = session.default_platform()? {
+                        return cmd.executor(default_platform);
+                    }
+                }
+                CommandArg::Intercepted(InterceptedCommand::Link(link)) => {
+                    // For link commands, only intercept if a platform exists
+                    if let Some(platform) = Platform::current(session)? {
+                        return link.executor(platform, current_project_name(session));
+                    }
+                }
+                CommandArg::Intercepted(InterceptedCommand::Unlink) => {
+                    // For unlink, attempt to find the current project name. If successful, treat
+                    // this as a global uninstall of the current project.
+                    if let Some(name) = current_project_name(session) {
+                        // Same as for link, only intercept if a platform exists
+                        if Platform::current(session)?.is_some() {
+                            return Ok(UninstallCommand::new(Spec::Package(
+                                name,
+                                VersionSpec::None,
+                            ))
+                            .into());
+                        }
+                    }
+                }
+                _ => {}
+            }
+
+            Platform::current(session)?
+        }
+    };
+
+    Ok(ToolCommand::new("npm", args, platform, ToolKind::Npm).into())
+}
+
+/// Determine the execution context (PATH and failure error message) for npm
+pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            let image = plat.checkout(session)?;
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((path, ErrorKind::BinaryExecError))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+            Ok((path, ErrorKind::NoPlatform))
+        }
+    }
+}
+
+/// Determine the name of the current project, if possible
+fn current_project_name(session: &mut Session) -> Option<String> {
+    let project = session.project().ok()??;
+    let manifest_file = File::open(project.manifest_file()).ok()?;
+    let manifest: PackageManifest = serde_json::de::from_reader(manifest_file).ok()?;
+
+    Some(manifest.name)
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/npx.rs.html b/main/src/volta_core/run/npx.rs.html new file mode 100644 index 000000000..cccdffea7 --- /dev/null +++ b/main/src/volta_core/run/npx.rs.html @@ -0,0 +1,125 @@ +npx.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+
use std::env;
+use std::ffi::OsString;
+
+use super::executor::{Executor, ToolCommand, ToolKind};
+use super::{debug_active_image, debug_no_platform, RECURSION_ENV_VAR};
+use crate::error::{ErrorKind, Fallible};
+use crate::platform::{Platform, System};
+use crate::session::{ActivityKind, Session};
+use node_semver::Version;
+use once_cell::sync::Lazy;
+
+static REQUIRED_NPM_VERSION: Lazy<Version> = Lazy::new(|| Version {
+    major: 5,
+    minor: 2,
+    patch: 0,
+    build: vec![],
+    pre_release: vec![],
+});
+
+/// Build a `ToolCommand` for npx
+pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible<Executor> {
+    session.add_event_start(ActivityKind::Npx);
+    // Don't re-evaluate the context if this is a recursive call
+    let platform = match env::var_os(RECURSION_ENV_VAR) {
+        Some(_) => None,
+        None => Platform::current(session)?,
+    };
+
+    Ok(ToolCommand::new("npx", args, platform, ToolKind::Npx).into())
+}
+
+/// Determine the execution context (PATH and failure error message) for npx
+pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            let image = plat.checkout(session)?;
+
+            // If the npm version is lower than the minimum required, we can show a helpful error
+            // message instead of a 'command not found' error.
+            let active_npm = image.resolve_npm()?;
+            if active_npm.value < *REQUIRED_NPM_VERSION {
+                return Err(ErrorKind::NpxNotAvailable {
+                    version: active_npm.value.to_string(),
+                }
+                .into());
+            }
+
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((path, ErrorKind::BinaryExecError))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+            Ok((path, ErrorKind::NoPlatform))
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/parser.rs.html b/main/src/volta_core/run/parser.rs.html new file mode 100644 index 000000000..d2285ee7b --- /dev/null +++ b/main/src/volta_core/run/parser.rs.html @@ -0,0 +1,1913 @@ +parser.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+693
+694
+695
+696
+697
+698
+699
+700
+701
+702
+703
+704
+705
+706
+707
+708
+709
+710
+711
+712
+713
+714
+715
+716
+717
+718
+719
+720
+721
+722
+723
+724
+725
+726
+727
+728
+729
+730
+731
+732
+733
+734
+735
+736
+737
+738
+739
+740
+741
+742
+743
+744
+745
+746
+747
+748
+749
+750
+751
+752
+753
+754
+755
+756
+757
+758
+759
+760
+761
+762
+763
+764
+765
+766
+767
+768
+769
+770
+771
+772
+773
+774
+775
+776
+777
+778
+779
+780
+781
+782
+783
+784
+785
+786
+787
+788
+789
+790
+791
+792
+793
+794
+795
+796
+797
+798
+799
+800
+801
+802
+803
+804
+805
+806
+807
+808
+809
+810
+811
+812
+813
+814
+815
+816
+817
+818
+819
+820
+821
+822
+823
+824
+825
+826
+827
+828
+829
+830
+831
+832
+833
+834
+835
+836
+837
+838
+839
+840
+841
+842
+843
+844
+845
+846
+847
+848
+849
+850
+851
+852
+853
+854
+855
+856
+857
+858
+859
+860
+861
+862
+863
+864
+865
+866
+867
+868
+869
+870
+871
+872
+873
+874
+875
+876
+877
+878
+879
+880
+881
+882
+883
+884
+885
+886
+887
+888
+889
+890
+891
+892
+893
+894
+895
+896
+897
+898
+899
+900
+901
+902
+903
+904
+905
+906
+907
+908
+909
+910
+911
+912
+913
+914
+915
+916
+917
+918
+919
+920
+921
+922
+923
+924
+925
+926
+927
+928
+929
+930
+931
+932
+933
+934
+935
+936
+937
+938
+939
+940
+941
+942
+943
+944
+945
+946
+947
+948
+949
+950
+951
+952
+953
+954
+955
+956
+
use std::env;
+use std::ffi::OsStr;
+use std::iter::once;
+
+use super::executor::{
+    Executor, InternalInstallCommand, PackageInstallCommand, PackageLinkCommand,
+    PackageUpgradeCommand, UninstallCommand,
+};
+use crate::error::{ErrorKind, Fallible};
+use crate::inventory::package_configs;
+use crate::platform::{Platform, PlatformSpec};
+use crate::tool::package::PackageManager;
+use crate::tool::Spec;
+use log::debug;
+
+const UNSAFE_GLOBAL: &str = "VOLTA_UNSAFE_GLOBAL";
+/// Aliases that npm supports for the 'install' command
+const NPM_INSTALL_ALIASES: [&str; 12] = [
+    "i", "in", "ins", "inst", "insta", "instal", "install", "isnt", "isnta", "isntal", "isntall",
+    "add",
+];
+/// Aliases that npm supports for the 'uninstall' command
+const NPM_UNINSTALL_ALIASES: [&str; 5] = ["un", "uninstall", "remove", "rm", "r"];
+/// Aliases that npm supports for the 'link' command
+const NPM_LINK_ALIASES: [&str; 2] = ["link", "ln"];
+/// Aliases that npm supports for the `update` command
+const NPM_UPDATE_ALIASES: [&str; 4] = ["update", "udpate", "upgrade", "up"];
+/// Aliases that pnpm supports for the 'remove' command,
+/// see: https://pnpm.io/cli/remove
+const PNPM_UNINSTALL_ALIASES: [&str; 4] = ["remove", "uninstall", "rm", "un"];
+/// Aliases that pnpm supports for the 'update' command,
+/// see: https://pnpm.io/cli/update
+const PNPM_UPDATE_ALIASES: [&str; 3] = ["update", "upgrade", "up"];
+/// Aliases that pnpm supports for the 'link' command
+/// see: https://pnpm.io/cli/link
+const PNPM_LINK_ALIASES: [&str; 2] = ["link", "ln"];
+
+pub enum CommandArg<'a> {
+    Global(GlobalCommand<'a>),
+    Intercepted(InterceptedCommand<'a>),
+    Standard,
+}
+
+impl<'a> CommandArg<'a> {
+    /// Parse the given set of arguments to see if they correspond to an intercepted npm command
+    pub fn for_npm<S>(args: &'a [S]) -> Self
+    where
+        S: AsRef<OsStr>,
+    {
+        // If VOLTA_UNSAFE_GLOBAL is set, then we always skip any interception parsing
+        if env::var_os(UNSAFE_GLOBAL).is_some() {
+            return CommandArg::Standard;
+        }
+
+        let mut positionals = args.iter().filter(is_positional).map(AsRef::as_ref);
+
+        // The first positional argument will always be the command, however npm supports multiple
+        // aliases for commands (see https://github.com/npm/cli/blob/latest/lib/utils/cmd-list.js)
+        // Additionally, if we have a global install or uninstall, all of the remaining positional
+        // arguments will be the tools to install or uninstall. If there are _no_ other arguments,
+        // then we treat the command not a global and allow npm to handle any error messages.
+        match positionals.next() {
+            Some(cmd) if NPM_INSTALL_ALIASES.iter().any(|a| a == &cmd) => {
+                if has_global_without_prefix(args) {
+                    let tools: Vec<_> = positionals.collect();
+
+                    if tools.is_empty() {
+                        CommandArg::Standard
+                    } else {
+                        // The common args for an install should be the command combined with any flags
+                        let mut common_args = vec![cmd];
+                        common_args.extend(args.iter().filter(is_flag).map(AsRef::as_ref));
+
+                        CommandArg::Global(GlobalCommand::Install(InstallArgs {
+                            manager: PackageManager::Npm,
+                            common_args,
+                            tools,
+                        }))
+                    }
+                } else {
+                    CommandArg::Standard
+                }
+            }
+            Some(cmd) if NPM_UNINSTALL_ALIASES.iter().any(|a| a == &cmd) => {
+                if has_global_without_prefix(args) {
+                    let tools: Vec<_> = positionals.collect();
+
+                    if tools.is_empty() {
+                        CommandArg::Standard
+                    } else {
+                        CommandArg::Global(GlobalCommand::Uninstall(UninstallArgs { tools }))
+                    }
+                } else {
+                    CommandArg::Standard
+                }
+            }
+            Some(cmd) if cmd == "unlink" => {
+                let tools: Vec<_> = positionals.collect();
+
+                if tools.is_empty() {
+                    // `npm unlink` without any arguments is used to unlink the current project
+                    CommandArg::Intercepted(InterceptedCommand::Unlink)
+                } else if has_global_without_prefix(args) {
+                    // With arguments, `npm unlink` is an alias of `npm remove`
+                    CommandArg::Global(GlobalCommand::Uninstall(UninstallArgs { tools }))
+                } else {
+                    CommandArg::Standard
+                }
+            }
+            Some(cmd) if NPM_LINK_ALIASES.iter().any(|a| a == &cmd) => {
+                // Much like install, the common args for a link are the command combined with any flags
+                let mut common_args = vec![cmd];
+                common_args.extend(args.iter().filter(is_flag).map(AsRef::as_ref));
+                let tools: Vec<_> = positionals.collect();
+
+                CommandArg::Intercepted(InterceptedCommand::Link(LinkArgs { common_args, tools }))
+            }
+            Some(cmd) if NPM_UPDATE_ALIASES.iter().any(|a| a == &cmd) => {
+                if has_global_without_prefix(args) {
+                    // Once again, the common args are the command combined with any flags
+                    let mut common_args = vec![cmd];
+                    common_args.extend(args.iter().filter(is_flag).map(AsRef::as_ref));
+                    let tools: Vec<_> = positionals.collect();
+
+                    CommandArg::Global(GlobalCommand::Upgrade(UpgradeArgs {
+                        common_args,
+                        tools,
+                        manager: PackageManager::Npm,
+                    }))
+                } else {
+                    CommandArg::Standard
+                }
+            }
+            _ => CommandArg::Standard,
+        }
+    }
+
+    /// Parse the given set of arguments to see if they correspond to an intercepted pnpm command
+    #[allow(dead_code)]
+    pub fn for_pnpm<S>(args: &'a [S]) -> CommandArg<'a>
+    where
+        S: AsRef<OsStr>,
+    {
+        // If VOLTA_UNSAFE_GLOBAL is set, then we always skip any global parsing
+        if env::var_os(UNSAFE_GLOBAL).is_some() {
+            return CommandArg::Standard;
+        }
+
+        let (flags, positionals): (Vec<&OsStr>, Vec<&OsStr>) =
+            args.iter().map(AsRef::<OsStr>::as_ref).partition(is_flag);
+
+        // The first positional argument will always be the subcommand for pnpm
+        match positionals.split_first() {
+            None => CommandArg::Standard,
+            Some((&subcommand, tools)) => {
+                let is_global = flags.iter().any(|&f| f == "--global" || f == "-g");
+                // Do not intercept if a custom global dir is explicitly specified
+                // See: https://pnpm.io/npmrc#global-dir
+                let prefixed = flags.iter().any(|&f| f == "--global-dir");
+
+                // pnpm subcommands that support the `global` flag:
+                // `add`, `update`, `remove`, `link`, `list`, `outdated`,
+                // `why`, `env`, `root`, `bin`.
+                match is_global && !prefixed {
+                    false => CommandArg::Standard,
+                    true => match subcommand.to_str() {
+                        // `add`
+                        Some("add") => {
+                            let manager = PackageManager::Pnpm;
+                            let mut common_args = vec![subcommand];
+                            common_args.extend(flags);
+
+                            CommandArg::Global(GlobalCommand::Install(InstallArgs {
+                                manager,
+                                common_args,
+                                tools: tools.to_vec(),
+                            }))
+                        }
+                        // `update`
+                        Some(cmd) if PNPM_UPDATE_ALIASES.iter().any(|&a| a == cmd) => {
+                            let manager = PackageManager::Pnpm;
+                            let mut common_args = vec![subcommand];
+                            common_args.extend(flags);
+                            CommandArg::Global(GlobalCommand::Upgrade(UpgradeArgs {
+                                manager,
+                                common_args,
+                                tools: tools.to_vec(),
+                            }))
+                        }
+                        // `remove`
+                        Some(cmd) if PNPM_UNINSTALL_ALIASES.iter().any(|&a| a == cmd) => {
+                            CommandArg::Global(GlobalCommand::Uninstall(UninstallArgs {
+                                tools: tools.to_vec(),
+                            }))
+                        }
+                        // `link`
+                        Some(cmd) if PNPM_LINK_ALIASES.iter().any(|&a| a == cmd) => {
+                            let mut common_args = vec![subcommand];
+                            common_args.extend(flags);
+                            CommandArg::Intercepted(InterceptedCommand::Link(LinkArgs {
+                                common_args,
+                                tools: tools.to_vec(),
+                            }))
+                        }
+                        _ => CommandArg::Standard,
+                    },
+                }
+            }
+        }
+    }
+
+    /// Parse the given set of arguments to see if they correspond to an intercepted Yarn command
+    pub fn for_yarn<S>(args: &'a [S]) -> Self
+    where
+        S: AsRef<OsStr>,
+    {
+        // If VOLTA_UNSAFE_GLOBAL is set, then we always skip any global parsing
+        if env::var_os(UNSAFE_GLOBAL).is_some() {
+            return CommandArg::Standard;
+        }
+
+        let mut positionals = args.iter().filter(is_positional).map(AsRef::as_ref);
+
+        // Yarn globals must always start with `global <command>`
+        // If we have a global add, remove, or upgrade, then all of the remaining positional
+        // arguments will be the tools to modify. As with npm, if there are no arguments then we
+        // can treat it as if it's not a global command and allow Yarn to show any errors.
+        match (positionals.next(), positionals.next()) {
+            (Some(global), Some(add)) if global == "global" && add == "add" => {
+                let tools: Vec<_> = positionals.collect();
+
+                if tools.is_empty() {
+                    CommandArg::Standard
+                } else {
+                    // The common args for an install should be `global add` and any flags
+                    let mut common_args = vec![global, add];
+                    common_args.extend(args.iter().filter(is_flag).map(AsRef::as_ref));
+
+                    CommandArg::Global(GlobalCommand::Install(InstallArgs {
+                        manager: PackageManager::Yarn,
+                        common_args,
+                        tools,
+                    }))
+                }
+            }
+            (Some(global), Some(remove)) if global == "global" && remove == "remove" => {
+                let tools: Vec<_> = positionals.collect();
+
+                if tools.is_empty() {
+                    CommandArg::Standard
+                } else {
+                    CommandArg::Global(GlobalCommand::Uninstall(UninstallArgs { tools }))
+                }
+            }
+            (Some(global), Some(upgrade)) if global == "global" && upgrade == "upgrade" => {
+                // The common args for an upgrade should be `global upgrade` and any flags
+                let mut common_args = vec![global, upgrade];
+                common_args.extend(args.iter().filter(is_flag).map(AsRef::as_ref));
+
+                CommandArg::Global(GlobalCommand::Upgrade(UpgradeArgs {
+                    common_args,
+                    tools: positionals.collect(),
+                    manager: PackageManager::Yarn,
+                }))
+            }
+            _ => CommandArg::Standard,
+        }
+    }
+}
+
+pub enum GlobalCommand<'a> {
+    Install(InstallArgs<'a>),
+    Uninstall(UninstallArgs<'a>),
+    Upgrade(UpgradeArgs<'a>),
+}
+
+impl GlobalCommand<'_> {
+    pub fn executor(self, platform: &PlatformSpec) -> Fallible<Executor> {
+        match self {
+            GlobalCommand::Install(cmd) => cmd.executor(platform),
+            GlobalCommand::Uninstall(cmd) => cmd.executor(),
+            GlobalCommand::Upgrade(cmd) => cmd.executor(platform),
+        }
+    }
+}
+
+/// The arguments passed to a global install command
+pub struct InstallArgs<'a> {
+    /// The package manager being used
+    manager: PackageManager,
+    /// Common arguments that apply to each tool (e.g. flags)
+    common_args: Vec<&'a OsStr>,
+    /// The individual tool arguments
+    tools: Vec<&'a OsStr>,
+}
+
+impl InstallArgs<'_> {
+    /// Convert these global install arguments into an executor for the command
+    ///
+    /// If there are multiple packages specified to install, then they will be broken out into
+    /// individual commands and run separately. That allows us to keep Volta's sandboxing for each
+    /// package while still supporting the ability to install multiple packages at once.
+    pub fn executor(self, platform_spec: &PlatformSpec) -> Fallible<Executor> {
+        let mut executors = Vec::with_capacity(self.tools.len());
+
+        for tool in self.tools {
+            // External tool installs may be in a form that doesn't match a `Spec` (such as a git
+            // URL or path to a tarball). If parsing into a `Spec` fails, we assume that it's a
+            // 3rd-party Tool and attempt to install anyway.
+            match Spec::try_from_str(&tool.to_string_lossy()) {
+                Ok(Spec::Package(_, _)) | Err(_) => {
+                    let platform = platform_spec.as_default();
+                    // The args for an individual install command are the common args combined
+                    // with the name of the tool.
+                    let args = self.common_args.iter().chain(once(&tool));
+                    let command = PackageInstallCommand::new(args, platform, self.manager)?;
+                    executors.push(command.into());
+                }
+                Ok(internal) => executors.push(InternalInstallCommand::new(internal).into()),
+            }
+        }
+
+        Ok(executors.into())
+    }
+}
+
+/// The list of tools passed to an uninstall command
+pub struct UninstallArgs<'a> {
+    tools: Vec<&'a OsStr>,
+}
+
+impl UninstallArgs<'_> {
+    /// Convert the tools into an executor for the uninstall command
+    ///
+    /// Since the packages are sandboxed, each needs to be uninstalled separately
+    pub fn executor(self) -> Fallible<Executor> {
+        let mut executors = Vec::with_capacity(self.tools.len());
+
+        for tool_name in self.tools {
+            let tool = Spec::try_from_str(&tool_name.to_string_lossy())?;
+            executors.push(UninstallCommand::new(tool).into());
+        }
+
+        Ok(executors.into())
+    }
+}
+
+/// The list of tools passed to an upgrade command
+pub struct UpgradeArgs<'a> {
+    /// The package manager being used
+    manager: PackageManager,
+    /// Common arguments that apply to each tool (e.g. flags)
+    common_args: Vec<&'a OsStr>,
+    /// The individual tool arguments
+    tools: Vec<&'a OsStr>,
+}
+
+impl UpgradeArgs<'_> {
+    /// Convert these global upgrade arguments into an executor for the command
+    ///
+    /// If there are multiple packages specified to upgrade, then they will be broken out into
+    /// individual commands and run separately. If no packages are specified, then we will upgrade
+    /// _all_ installed packages that were installed with the same package manager.
+    pub fn executor(self, platform_spec: &PlatformSpec) -> Fallible<Executor> {
+        if self.tools.is_empty() {
+            return self.executor_all_packages(platform_spec);
+        }
+
+        let mut executors = Vec::with_capacity(self.tools.len());
+
+        for tool in self.tools {
+            match Spec::try_from_str(&tool.to_string_lossy()) {
+                Ok(Spec::Package(package, _)) => {
+                    let platform = platform_spec.as_default();
+                    let args = self.common_args.iter().chain(once(&tool));
+                    executors.push(
+                        PackageUpgradeCommand::new(args, package, platform, self.manager)?.into(),
+                    );
+                }
+                Ok(internal) => {
+                    executors.push(UninstallCommand::new(internal).into());
+                }
+                Err(_) => {
+                    return Err(ErrorKind::UpgradePackageNotFound {
+                        package: tool.to_string_lossy().to_string(),
+                        manager: self.manager,
+                    }
+                    .into())
+                }
+            }
+        }
+
+        Ok(executors.into())
+    }
+
+    /// Build an executor to upgrade _all_ global packages that were installed with the same
+    /// package manager as we are currently running.
+    fn executor_all_packages(self, platform_spec: &PlatformSpec) -> Fallible<Executor> {
+        package_configs()?
+            .into_iter()
+            .filter(|config| config.manager == self.manager)
+            .map(|config| {
+                let platform = platform_spec.as_default();
+                let package_name = config.name.as_ref();
+                let args = self.common_args.iter().chain(once(&package_name));
+
+                let executor =
+                    PackageUpgradeCommand::new(args, config.name.clone(), platform, self.manager)?
+                        .into();
+                Ok(executor)
+            })
+            .collect::<Fallible<Vec<_>>>()
+            .map(Into::into)
+    }
+}
+
+/// An intercepted local command
+pub enum InterceptedCommand<'a> {
+    Link(LinkArgs<'a>),
+    Unlink,
+}
+
+/// The arguments passed to an `npm link` command
+pub struct LinkArgs<'a> {
+    /// The common arguments that apply to each tool
+    common_args: Vec<&'a OsStr>,
+    /// The list of tools to link (if any)
+    tools: Vec<&'a OsStr>,
+}
+
+impl LinkArgs<'_> {
+    pub fn executor(self, platform: Platform, project_name: Option<String>) -> Fallible<Executor> {
+        if self.tools.is_empty() {
+            // If no tools are specified, then this is a bare link command, linking the current
+            // project as a global package. We treat this like a global install except we look up
+            // the name from the current directory first.
+            match project_name {
+                Some(name) => PackageInstallCommand::for_npm_link(self.common_args, platform, name),
+                None => PackageInstallCommand::new(self.common_args, platform, PackageManager::Npm),
+            }
+            .map(Into::into)
+        } else {
+            // If there are tools specified, then this represents a command to link a global
+            // package into the current project. We handle each tool separately to support Volta's
+            // package sandboxing.
+            let common_args = self.common_args;
+
+            Ok(self
+                .tools
+                .into_iter()
+                .map(|tool| {
+                    let args = common_args.iter().chain(once(&tool));
+                    PackageLinkCommand::new(
+                        args,
+                        platform.clone(),
+                        tool.to_string_lossy().to_string(),
+                    )
+                    .into()
+                })
+                .collect::<Vec<_>>()
+                .into())
+        }
+    }
+}
+
+/// Check if the provided argument list includes a global flag and _doesn't_ have a prefix setting
+///
+/// For our interception, we only want to intercept global commands. Additionally, if the user
+/// passes a prefix setting, that will override the logic we use to redirect the install, so our
+/// process won't work and will cause an error. We should avoid intercepting in those cases since
+/// a command with an explicit prefix is something beyond the "standard" global install anyway.
+fn has_global_without_prefix<A>(args: &[A]) -> bool
+where
+    A: AsRef<OsStr>,
+{
+    let (has_global, has_prefix) = args.iter().fold((false, false), |(global, prefix), arg| {
+        match arg.as_ref().to_str() {
+            Some("-g") | Some("--global") => (true, prefix),
+            Some(pre) if pre.starts_with("--prefix") => (global, true),
+            _ => (global, prefix),
+        }
+    });
+
+    if has_global && has_prefix {
+        debug!("Skipping global interception due to prefix argument");
+    }
+
+    has_global && !has_prefix
+}
+
+fn is_flag<A>(arg: &A) -> bool
+where
+    A: AsRef<OsStr>,
+{
+    match arg.as_ref().to_str() {
+        Some(a) => a.starts_with('-'),
+        None => false,
+    }
+}
+
+fn is_positional<A>(arg: &A) -> bool
+where
+    A: AsRef<OsStr>,
+{
+    !is_flag(arg)
+}
+
+#[cfg(test)]
+mod tests {
+    use std::ffi::{OsStr, OsString};
+
+    fn arg_list<A, S>(args: A) -> Vec<OsString>
+    where
+        A: IntoIterator<Item = S>,
+        S: AsRef<OsStr>,
+    {
+        args.into_iter().map(|a| a.as_ref().to_owned()).collect()
+    }
+
+    mod npm {
+        use super::super::*;
+        use super::arg_list;
+
+        #[test]
+        fn handles_global_install() {
+            match CommandArg::for_npm(&arg_list(["install", "--global", "typescript@3"])) {
+                CommandArg::Global(GlobalCommand::Install(install)) => {
+                    assert_eq!(install.manager, PackageManager::Npm);
+                    assert_eq!(install.common_args, vec!["install", "--global"]);
+                    assert_eq!(install.tools, vec!["typescript@3"]);
+                }
+                _ => panic!("Doesn't parse global install as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_local_install() {
+            match CommandArg::for_npm(&arg_list(["install", "--save-dev", "typescript"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Parses local install as global"),
+            };
+        }
+
+        #[test]
+        fn handles_global_uninstall() {
+            match CommandArg::for_npm(&arg_list(["uninstall", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(uninstall)) => {
+                    assert_eq!(uninstall.tools, vec!["typescript"]);
+                }
+                _ => panic!("Doesn't parse global uninstall as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_local_uninstall() {
+            match CommandArg::for_npm(&arg_list(["uninstall", "--save-dev", "typescript"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Parses local uninstall as global"),
+            };
+        }
+
+        #[test]
+        fn handles_multiple_install() {
+            match CommandArg::for_npm(&arg_list([
+                "install",
+                "--global",
+                "typescript@3",
+                "cowsay@1",
+                "ember-cli@2",
+            ])) {
+                CommandArg::Global(GlobalCommand::Install(install)) => {
+                    assert_eq!(install.manager, PackageManager::Npm);
+                    assert_eq!(install.common_args, vec!["install", "--global"]);
+                    assert_eq!(
+                        install.tools,
+                        vec!["typescript@3", "cowsay@1", "ember-cli@2"]
+                    );
+                }
+                _ => panic!("Doesn't parse global install as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_multiple_uninstall() {
+            match CommandArg::for_npm(&arg_list([
+                "uninstall",
+                "--global",
+                "typescript",
+                "cowsay",
+                "ember-cli",
+            ])) {
+                CommandArg::Global(GlobalCommand::Uninstall(uninstall)) => {
+                    assert_eq!(uninstall.tools, vec!["typescript", "cowsay", "ember-cli"]);
+                }
+                _ => panic!("Doesn't parse global uninstall as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_bare_link() {
+            match CommandArg::for_npm(&arg_list(["link"])) {
+                CommandArg::Intercepted(InterceptedCommand::Link(_)) => (),
+                _ => panic!("Doesn't parse bare link command ('npm link' with no packages"),
+            };
+        }
+
+        #[test]
+        fn handles_multiple_link() {
+            match CommandArg::for_npm(&arg_list(["link", "typescript", "react"])) {
+                CommandArg::Intercepted(InterceptedCommand::Link(link)) => {
+                    assert_eq!(link.tools, vec!["typescript", "react"]);
+                }
+                _ => panic!("Doesn't parse link command with packages"),
+            };
+        }
+
+        #[test]
+        fn handles_bare_unlink() {
+            match CommandArg::for_npm(&arg_list(["unlink"])) {
+                CommandArg::Intercepted(InterceptedCommand::Unlink) => (),
+                _ => panic!("Doesn't parse bare unlink command ('npm unlink' with no packages"),
+            };
+        }
+
+        #[test]
+        fn handles_local_unlink() {
+            match CommandArg::for_npm(&arg_list(["unlink", "@angular/cli"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Doesn't pass through local 'unlink' command"),
+            }
+        }
+
+        #[test]
+        fn handles_global_aliases() {
+            match CommandArg::for_npm(&arg_list(["install", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse long form (--global)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["install", "-g", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (-g)"),
+            };
+        }
+
+        #[test]
+        fn handles_install_aliases() {
+            match CommandArg::for_npm(&arg_list(["i", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (i)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["in", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (in)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["ins", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (ins)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["inst", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (inst)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["insta", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (insta)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["instal", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form (instal)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["install", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse exact command (install)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["isnt", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form misspelling (isnt)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["isnta", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form misspelling (isnta)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["isntal", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse short form misspelling (isntal)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["isntall", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse misspelling (isntall)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["add", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(_)) => (),
+                _ => panic!("Doesn't parse 'add' alias"),
+            };
+        }
+
+        #[test]
+        fn handles_uninstall_aliases() {
+            match CommandArg::for_npm(&arg_list(["uninstall", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(_)) => (),
+                _ => panic!("Doesn't parse long form (uninstall)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["unlink", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(_)) => (),
+                _ => panic!("Doesn't parse 'unlink'"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["remove", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(_)) => (),
+                _ => panic!("Doesn't parse 'remove'"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["un", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(_)) => (),
+                _ => panic!("Doesn't parse short form (un)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["rm", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(_)) => (),
+                _ => panic!("Doesn't parse short form (rm)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["r", "--global", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(_)) => (),
+                _ => panic!("Doesn't parse short form (r)"),
+            };
+        }
+
+        #[test]
+        fn handles_link_aliases() {
+            match CommandArg::for_npm(&arg_list(["link"])) {
+                CommandArg::Intercepted(InterceptedCommand::Link(_)) => (),
+                _ => panic!("Doesn't parse long form (link)"),
+            };
+
+            match CommandArg::for_npm(&arg_list(["ln"])) {
+                CommandArg::Intercepted(InterceptedCommand::Link(_)) => (),
+                _ => panic!("Doesn't parse short form (ln)"),
+            };
+        }
+
+        #[test]
+        fn processes_flags() {
+            match CommandArg::for_npm(&arg_list([
+                "--global",
+                "install",
+                "typescript",
+                "--no-audit",
+                "cowsay",
+                "--no-update-notifier",
+            ])) {
+                CommandArg::Global(GlobalCommand::Install(install)) => {
+                    // The command gets moved to the front of common_args
+                    assert_eq!(
+                        install.common_args,
+                        vec!["install", "--global", "--no-audit", "--no-update-notifier"]
+                    );
+                    assert_eq!(install.tools, vec!["typescript", "cowsay"]);
+                }
+                _ => panic!("Doesn't parse install with extra flags as a global"),
+            };
+
+            match CommandArg::for_npm(&arg_list([
+                "uninstall",
+                "--silent",
+                "typescript",
+                "-g",
+                "cowsay",
+            ])) {
+                CommandArg::Global(GlobalCommand::Uninstall(uninstall)) => {
+                    assert_eq!(uninstall.tools, vec!["typescript", "cowsay"]);
+                }
+                _ => panic!("Doesn't parse uninstall with extra flags as a global"),
+            }
+        }
+
+        #[test]
+        fn skips_commands_with_prefix() {
+            match CommandArg::for_npm(&arg_list(["install", "-g", "--prefix", "~/", "ember"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["install", "-g", "--prefix=~/", "ember"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["uninstall", "-g", "--prefix", "~/", "ember"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["uninstall", "-g", "--prefix=~/", "ember"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["unlink", "-g", "--prefix", "~/", "ember"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["unlink", "-g", "--prefix=~/", "ember"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["update", "-g", "--prefix", "~/"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+
+            match CommandArg::for_npm(&arg_list(["update", "-g", "--prefix=~/"])) {
+                CommandArg::Standard => {}
+                _ => panic!("Parsed command with prefix as a global"),
+            }
+        }
+    }
+
+    mod yarn {
+        use super::super::*;
+        use super::*;
+
+        #[test]
+        fn handles_global_add() {
+            match CommandArg::for_yarn(&arg_list(["global", "add", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Install(install)) => {
+                    assert_eq!(install.manager, PackageManager::Yarn);
+                    assert_eq!(install.common_args, vec!["global", "add"]);
+                    assert_eq!(install.tools, vec!["typescript"]);
+                }
+                _ => panic!("Doesn't parse global add as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_local_add() {
+            match CommandArg::for_yarn(&arg_list(["add", "typescript"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Parses local add as a global"),
+            };
+
+            match CommandArg::for_yarn(&arg_list(["add", "global"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Incorrectly handles bad order"),
+            };
+        }
+
+        #[test]
+        fn handles_global_remove() {
+            match CommandArg::for_yarn(&arg_list(["global", "remove", "typescript"])) {
+                CommandArg::Global(GlobalCommand::Uninstall(uninstall)) => {
+                    assert_eq!(uninstall.tools, vec!["typescript"]);
+                }
+                _ => panic!("Doesn't parse global remove as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_local_remove() {
+            match CommandArg::for_yarn(&arg_list(["remove", "typescript"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Parses local remove as a global"),
+            };
+
+            match CommandArg::for_yarn(&arg_list(["remove", "global"])) {
+                CommandArg::Standard => (),
+                _ => panic!("Incorrectly handles bad order"),
+            };
+        }
+
+        #[test]
+        fn handles_multiple_add() {
+            match CommandArg::for_yarn(&arg_list([
+                "global",
+                "add",
+                "typescript",
+                "cowsay",
+                "ember-cli",
+            ])) {
+                CommandArg::Global(GlobalCommand::Install(install)) => {
+                    assert_eq!(install.manager, PackageManager::Yarn);
+                    assert_eq!(install.common_args, vec!["global", "add"]);
+                    assert_eq!(install.tools, vec!["typescript", "cowsay", "ember-cli"]);
+                }
+                _ => panic!("Doesn't parse global add as a global"),
+            };
+        }
+
+        #[test]
+        fn handles_multiple_remove() {
+            match CommandArg::for_yarn(&arg_list([
+                "global",
+                "remove",
+                "typescript",
+                "cowsay",
+                "ember-cli",
+            ])) {
+                CommandArg::Global(GlobalCommand::Uninstall(uninstall)) => {
+                    assert_eq!(uninstall.tools, vec!["typescript", "cowsay", "ember-cli"]);
+                }
+                _ => panic!("Doesn't parse global remove as a global"),
+            };
+        }
+
+        #[test]
+        fn processes_flags() {
+            match CommandArg::for_yarn(&arg_list([
+                "global",
+                "--silent",
+                "add",
+                "ember-cli",
+                "--prefix=~/",
+                "typescript",
+            ])) {
+                CommandArg::Global(GlobalCommand::Install(install)) => {
+                    // The commands get moved to the front of common_args
+                    assert_eq!(
+                        install.common_args,
+                        vec!["global", "add", "--silent", "--prefix=~/"]
+                    );
+                    assert_eq!(install.tools, vec!["ember-cli", "typescript"]);
+                }
+                _ => panic!("Doesn't parse global add as a global"),
+            };
+
+            match CommandArg::for_yarn(&arg_list([
+                "global",
+                "--silent",
+                "remove",
+                "ember-cli",
+                "--prefix=~/",
+                "typescript",
+            ])) {
+                CommandArg::Global(GlobalCommand::Uninstall(uninstall)) => {
+                    assert_eq!(uninstall.tools, vec!["ember-cli", "typescript"]);
+                }
+                _ => panic!("Doesn't parse global add as a global"),
+            };
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/pnpm.rs.html b/main/src/volta_core/run/pnpm.rs.html new file mode 100644 index 000000000..027313ff5 --- /dev/null +++ b/main/src/volta_core/run/pnpm.rs.html @@ -0,0 +1,133 @@ +pnpm.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+
use std::env;
+use std::ffi::OsString;
+
+use super::executor::{Executor, ToolCommand, ToolKind};
+use super::{debug_active_image, debug_no_platform, RECURSION_ENV_VAR};
+use crate::error::{ErrorKind, Fallible};
+use crate::platform::{Platform, Source, System};
+use crate::session::{ActivityKind, Session};
+
+pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible<Executor> {
+    session.add_event_start(ActivityKind::Pnpm);
+    // Don't re-evaluate the context or global install interception if this is a recursive call
+    let platform = match env::var_os(RECURSION_ENV_VAR) {
+        Some(_) => None,
+        None => {
+            // FIXME: Figure out how to intercept pnpm global commands properly.
+            // This guard prevents all global commands from running, it should
+            // be removed when we fully implement global command interception.
+            let is_global = args.iter().any(|f| f == "--global" || f == "-g");
+            if is_global {
+                return Err(ErrorKind::Unimplemented {
+                    feature: "pnpm global commands".into(),
+                }
+                .into());
+            }
+
+            Platform::current(session)?
+        }
+    };
+
+    Ok(ToolCommand::new("pnpm", args, platform, ToolKind::Pnpm).into())
+}
+
+/// Determine the execution context (PATH and failure error message) for pnpm
+pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            validate_platform_pnpm(&plat)?;
+
+            let image = plat.checkout(session)?;
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((path, ErrorKind::BinaryExecError))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+            Ok((path, ErrorKind::NoPlatform))
+        }
+    }
+}
+
+fn validate_platform_pnpm(platform: &Platform) -> Fallible<()> {
+    match &platform.pnpm {
+        Some(_) => Ok(()),
+        None => match platform.node.source {
+            Source::Project => Err(ErrorKind::NoProjectPnpm.into()),
+            Source::Default | Source::Binary => Err(ErrorKind::NoDefaultPnpm.into()),
+            Source::CommandLine => Err(ErrorKind::NoCommandLinePnpm.into()),
+        },
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/run/yarn.rs.html b/main/src/volta_core/run/yarn.rs.html new file mode 100644 index 000000000..84ebe5fac --- /dev/null +++ b/main/src/volta_core/run/yarn.rs.html @@ -0,0 +1,143 @@ +yarn.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+
use std::env;
+use std::ffi::OsString;
+
+use super::executor::{Executor, ToolCommand, ToolKind};
+use super::parser::CommandArg;
+use super::{debug_active_image, debug_no_platform, RECURSION_ENV_VAR};
+use crate::error::{ErrorKind, Fallible};
+use crate::platform::{Platform, Source, System};
+use crate::session::{ActivityKind, Session};
+
+/// Build an `Executor` for Yarn
+///
+/// If the command is a global add or remove and we have a default platform available, then we will
+/// use custom logic to ensure that the package is correctly installed / uninstalled in the Volta
+/// directory.
+///
+/// If the command is _not_ a global add / remove or we don't have a default platform, then
+/// we will allow Yarn to execute the command as usual.
+pub(super) fn command(args: &[OsString], session: &mut Session) -> Fallible<Executor> {
+    session.add_event_start(ActivityKind::Yarn);
+    // Don't re-evaluate the context or global install interception if this is a recursive call
+    let platform = match env::var_os(RECURSION_ENV_VAR) {
+        Some(_) => None,
+        None => {
+            if let CommandArg::Global(cmd) = CommandArg::for_yarn(args) {
+                // For globals, only intercept if the default platform exists
+                if let Some(default_platform) = session.default_platform()? {
+                    return cmd.executor(default_platform);
+                }
+            }
+
+            Platform::current(session)?
+        }
+    };
+
+    Ok(ToolCommand::new("yarn", args, platform, ToolKind::Yarn).into())
+}
+
+/// Determine the execution context (PATH and failure error message) for Yarn
+pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session,
+) -> Fallible<(OsString, ErrorKind)> {
+    match platform {
+        Some(plat) => {
+            validate_platform_yarn(&plat)?;
+
+            let image = plat.checkout(session)?;
+            let path = image.path()?;
+            debug_active_image(&image);
+
+            Ok((path, ErrorKind::BinaryExecError))
+        }
+        None => {
+            let path = System::path()?;
+            debug_no_platform();
+            Ok((path, ErrorKind::NoPlatform))
+        }
+    }
+}
+
+fn validate_platform_yarn(platform: &Platform) -> Fallible<()> {
+    match &platform.yarn {
+        Some(_) => Ok(()),
+        None => match platform.node.source {
+            Source::Project => Err(ErrorKind::NoProjectYarn.into()),
+            Source::Default | Source::Binary => Err(ErrorKind::NoDefaultYarn.into()),
+            Source::CommandLine => Err(ErrorKind::NoCommandLineYarn.into()),
+        },
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/session.rs.html b/main/src/volta_core/session.rs.html new file mode 100644 index 000000000..96c005080 --- /dev/null +++ b/main/src/volta_core/session.rs.html @@ -0,0 +1,433 @@ +session.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+
//! Provides the `Session` type, which represents the user's state during an
+//! execution of a Volta tool, including their current directory, Volta
+//! hook configuration, and the state of the local inventory.
+
+use std::fmt::{self, Display, Formatter};
+use std::process::exit;
+
+use crate::error::{ExitCode, Fallible, VoltaError};
+use crate::event::EventLog;
+use crate::hook::{HookConfig, LazyHookConfig};
+use crate::platform::PlatformSpec;
+use crate::project::{LazyProject, Project};
+use crate::toolchain::{LazyToolchain, Toolchain};
+use log::debug;
+
+#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy)]
+pub enum ActivityKind {
+    Fetch,
+    Install,
+    Uninstall,
+    List,
+    Current,
+    Default,
+    Pin,
+    Node,
+    Npm,
+    Npx,
+    Pnpm,
+    Yarn,
+    Volta,
+    Tool,
+    Help,
+    Version,
+    Binary,
+    Shim,
+    Completions,
+    Which,
+    Setup,
+    Run,
+    Args,
+}
+
+impl Display for ActivityKind {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
+        let s = match self {
+            ActivityKind::Fetch => "fetch",
+            ActivityKind::Install => "install",
+            ActivityKind::Uninstall => "uninstall",
+            ActivityKind::List => "list",
+            ActivityKind::Current => "current",
+            ActivityKind::Default => "default",
+            ActivityKind::Pin => "pin",
+            ActivityKind::Node => "node",
+            ActivityKind::Npm => "npm",
+            ActivityKind::Npx => "npx",
+            ActivityKind::Pnpm => "pnpm",
+            ActivityKind::Yarn => "yarn",
+            ActivityKind::Volta => "volta",
+            ActivityKind::Tool => "tool",
+            ActivityKind::Help => "help",
+            ActivityKind::Version => "version",
+            ActivityKind::Binary => "binary",
+            ActivityKind::Setup => "setup",
+            ActivityKind::Shim => "shim",
+            ActivityKind::Completions => "completions",
+            ActivityKind::Which => "which",
+            ActivityKind::Run => "run",
+            ActivityKind::Args => "args",
+        };
+        f.write_str(s)
+    }
+}
+
+/// Represents the user's state during an execution of a Volta tool. The session
+/// encapsulates a number of aspects of the environment in which the tool was
+/// invoked, including:
+///
+/// - the current directory
+/// - the Node project tree that contains the current directory (if any)
+/// - the Volta hook configuration
+/// - the inventory of locally-fetched Volta tools
+pub struct Session {
+    hooks: LazyHookConfig,
+    toolchain: LazyToolchain,
+    project: LazyProject,
+    event_log: EventLog,
+}
+
+impl Session {
+    /// Constructs a new `Session`.
+    pub fn init() -> Session {
+        Session {
+            hooks: LazyHookConfig::init(),
+            toolchain: LazyToolchain::init(),
+            project: LazyProject::init(),
+            event_log: EventLog::init(),
+        }
+    }
+
+    /// Produces a reference to the current Node project, if any.
+    pub fn project(&self) -> Fallible<Option<&Project>> {
+        self.project.get()
+    }
+
+    /// Produces a mutable reference to the current Node project, if any.
+    pub fn project_mut(&mut self) -> Fallible<Option<&mut Project>> {
+        self.project.get_mut()
+    }
+
+    /// Returns the user's default platform, if any
+    pub fn default_platform(&self) -> Fallible<Option<&PlatformSpec>> {
+        self.toolchain.get().map(Toolchain::platform)
+    }
+
+    /// Returns the current project's pinned platform image, if any.
+    pub fn project_platform(&self) -> Fallible<Option<&PlatformSpec>> {
+        if let Some(project) = self.project()? {
+            return Ok(project.platform());
+        }
+        Ok(None)
+    }
+
+    /// Produces a reference to the current toolchain (default platform specification)
+    pub fn toolchain(&self) -> Fallible<&Toolchain> {
+        self.toolchain.get()
+    }
+
+    /// Produces a mutable reference to the current toolchain
+    pub fn toolchain_mut(&mut self) -> Fallible<&mut Toolchain> {
+        self.toolchain.get_mut()
+    }
+
+    /// Produces a reference to the hook configuration
+    pub fn hooks(&self) -> Fallible<&HookConfig> {
+        self.hooks.get(self.project()?)
+    }
+
+    pub fn add_event_start(&mut self, activity_kind: ActivityKind) {
+        self.event_log.add_event_start(activity_kind)
+    }
+    pub fn add_event_end(&mut self, activity_kind: ActivityKind, exit_code: ExitCode) {
+        self.event_log.add_event_end(activity_kind, exit_code)
+    }
+    pub fn add_event_tool_end(&mut self, activity_kind: ActivityKind, exit_code: i32) {
+        self.event_log.add_event_tool_end(activity_kind, exit_code)
+    }
+    pub fn add_event_error(&mut self, activity_kind: ActivityKind, error: &VoltaError) {
+        self.event_log.add_event_error(activity_kind, error)
+    }
+
+    fn publish_to_event_log(self) {
+        let Self {
+            project,
+            hooks,
+            mut event_log,
+            ..
+        } = self;
+        let plugin_res = project
+            .get()
+            .and_then(|p| hooks.get(p))
+            .map(|hooks| hooks.events().and_then(|e| e.publish.as_ref()));
+        match plugin_res {
+            Ok(plugin) => {
+                event_log.add_event_args();
+                event_log.publish(plugin);
+            }
+            Err(e) => {
+                debug!("Unable to publish event log.\n{}", e);
+            }
+        }
+    }
+
+    pub fn exit(self, code: ExitCode) -> ! {
+        self.publish_to_event_log();
+        code.exit();
+    }
+
+    pub fn exit_tool(self, code: i32) -> ! {
+        self.publish_to_event_log();
+        exit(code);
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use crate::session::Session;
+    use std::env;
+    use std::path::PathBuf;
+
+    fn fixture_path(fixture_dir: &str) -> PathBuf {
+        let mut cargo_manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+        cargo_manifest_dir.push("fixtures");
+        cargo_manifest_dir.push(fixture_dir);
+        cargo_manifest_dir
+    }
+
+    #[test]
+    fn test_in_pinned_project() {
+        let project_pinned = fixture_path("basic");
+        env::set_current_dir(project_pinned).expect("Could not set current directory");
+        let pinned_session = Session::init();
+        let pinned_platform = pinned_session
+            .project_platform()
+            .expect("Couldn't create Project");
+        assert!(pinned_platform.is_some());
+
+        let project_unpinned = fixture_path("no_toolchain");
+        env::set_current_dir(project_unpinned).expect("Could not set current directory");
+        let unpinned_session = Session::init();
+        let unpinned_platform = unpinned_session
+            .project_platform()
+            .expect("Couldn't create Project");
+        assert!(unpinned_platform.is_none());
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/shim.rs.html b/main/src/volta_core/shim.rs.html new file mode 100644 index 000000000..89a1c0228 --- /dev/null +++ b/main/src/volta_core/shim.rs.html @@ -0,0 +1,395 @@ +shim.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+
//! Provides utilities for modifying shims for 3rd-party executables
+
+use std::collections::HashSet;
+use std::fs;
+use std::io;
+use std::path::Path;
+
+use crate::error::{Context, ErrorKind, Fallible, VoltaError};
+use crate::fs::read_dir_eager;
+use crate::layout::volta_home;
+use crate::sync::VoltaLock;
+use log::debug;
+
+pub use platform::create;
+
+pub fn regenerate_shims_for_dir(dir: &Path) -> Fallible<()> {
+    // Acquire a lock on the Volta directory, if possible, to prevent concurrent changes
+    let _lock = VoltaLock::acquire();
+    debug!("Rebuilding shims for directory: {}", dir.display());
+    for shim_name in get_shim_list_deduped(dir)?.iter() {
+        delete(shim_name)?;
+        create(shim_name)?;
+    }
+
+    Ok(())
+}
+
+fn get_shim_list_deduped(dir: &Path) -> Fallible<HashSet<String>> {
+    let contents = read_dir_eager(dir).with_context(|| ErrorKind::ReadDirError {
+        dir: dir.to_owned(),
+    })?;
+
+    #[cfg(unix)]
+    {
+        let mut shims: HashSet<String> =
+            contents.filter_map(platform::entry_to_shim_name).collect();
+        shims.insert("node".into());
+        shims.insert("npm".into());
+        shims.insert("npx".into());
+        shims.insert("pnpm".into());
+        shims.insert("yarn".into());
+        shims.insert("yarnpkg".into());
+        Ok(shims)
+    }
+
+    #[cfg(windows)]
+    {
+        // On Windows, the default shims are installed in Program Files, so we don't need to generate them here
+        Ok(contents.filter_map(platform::entry_to_shim_name).collect())
+    }
+}
+
+#[derive(PartialEq, Eq)]
+pub enum ShimResult {
+    Created,
+    AlreadyExists,
+    Deleted,
+    DoesntExist,
+}
+
+pub fn delete(shim_name: &str) -> Fallible<ShimResult> {
+    let shim = volta_home()?.shim_file(shim_name);
+
+    #[cfg(windows)]
+    platform::delete_git_bash_script(shim_name)?;
+
+    match fs::remove_file(shim) {
+        Ok(_) => Ok(ShimResult::Deleted),
+        Err(err) => {
+            if err.kind() == io::ErrorKind::NotFound {
+                Ok(ShimResult::DoesntExist)
+            } else {
+                Err(VoltaError::from_source(
+                    err,
+                    ErrorKind::ShimRemoveError {
+                        name: shim_name.to_string(),
+                    },
+                ))
+            }
+        }
+    }
+}
+
+#[cfg(unix)]
+mod platform {
+    //! Unix-specific shim utilities
+    //!
+    //! On macOS and Linux, creating a shim involves creating a symlink to the `volta-shim`
+    //! executable. Additionally, filtering the shims from directory entries means looking
+    //! for symlinks and ignoring the actual binaries
+    use std::ffi::OsStr;
+    use std::fs::{DirEntry, Metadata};
+    use std::io;
+
+    use super::ShimResult;
+    use crate::error::{ErrorKind, Fallible, VoltaError};
+    use crate::fs::symlink_file;
+    use crate::layout::{volta_home, volta_install};
+
+    pub fn create(shim_name: &str) -> Fallible<ShimResult> {
+        let executable = volta_install()?.shim_executable();
+        let shim = volta_home()?.shim_file(shim_name);
+
+        match symlink_file(executable, shim) {
+            Ok(_) => Ok(ShimResult::Created),
+            Err(err) => {
+                if err.kind() == io::ErrorKind::AlreadyExists {
+                    Ok(ShimResult::AlreadyExists)
+                } else {
+                    Err(VoltaError::from_source(
+                        err,
+                        ErrorKind::ShimCreateError {
+                            name: shim_name.to_string(),
+                        },
+                    ))
+                }
+            }
+        }
+    }
+
+    pub fn entry_to_shim_name((entry, metadata): (DirEntry, Metadata)) -> Option<String> {
+        if metadata.file_type().is_symlink() {
+            entry
+                .path()
+                .file_stem()
+                .and_then(OsStr::to_str)
+                .map(ToOwned::to_owned)
+        } else {
+            None
+        }
+    }
+}
+
+#[cfg(windows)]
+mod platform {
+    //! Windows-specific shim utilities
+    //!
+    //! On Windows, creating a shim involves creating a small .cmd script, rather than a symlink.
+    //! This allows us to create shims without requiring administrator privileges or developer
+    //! mode. Also, to support Git Bash, we create a similar script with bash syntax that doesn't
+    //! have a file extension. This allows Powershell and Cmd to ignore it, while Bash detects it
+    //! as an executable script.
+    //!
+    //! Finally, filtering directory entries to find the shim files involves looking for the .cmd
+    //! files.
+    use std::ffi::OsStr;
+    use std::fs::{write, DirEntry, Metadata};
+
+    use super::ShimResult;
+    use crate::error::{Context, ErrorKind, Fallible};
+    use crate::fs::remove_file_if_exists;
+    use crate::layout::volta_home;
+
+    const SHIM_SCRIPT_CONTENTS: &str = r#"@echo off
+volta run %~n0 %*
+"#;
+
+    const GIT_BASH_SCRIPT_CONTENTS: &str = r#"#!/bin/bash
+volta run "$(basename $0)" "$@""#;
+
+    pub fn create(shim_name: &str) -> Fallible<ShimResult> {
+        let shim = volta_home()?.shim_file(shim_name);
+
+        write(shim, SHIM_SCRIPT_CONTENTS).with_context(|| ErrorKind::ShimCreateError {
+            name: shim_name.to_owned(),
+        })?;
+
+        let git_bash_script = volta_home()?.shim_git_bash_script_file(shim_name);
+
+        write(git_bash_script, GIT_BASH_SCRIPT_CONTENTS).with_context(|| {
+            ErrorKind::ShimCreateError {
+                name: shim_name.to_owned(),
+            }
+        })?;
+
+        Ok(ShimResult::Created)
+    }
+
+    pub fn entry_to_shim_name((entry, _): (DirEntry, Metadata)) -> Option<String> {
+        let path = entry.path();
+
+        if path.extension().is_some_and(|ext| ext == "cmd") {
+            path.file_stem()
+                .and_then(OsStr::to_str)
+                .map(ToOwned::to_owned)
+        } else {
+            None
+        }
+    }
+
+    pub fn delete_git_bash_script(shim_name: &str) -> Fallible<()> {
+        let script_path = volta_home()?.shim_git_bash_script_file(shim_name);
+        remove_file_if_exists(script_path).with_context(|| ErrorKind::ShimRemoveError {
+            name: shim_name.to_string(),
+        })
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/signal.rs.html b/main/src/volta_core/signal.rs.html new file mode 100644 index 000000000..4a435e570 --- /dev/null +++ b/main/src/volta_core/signal.rs.html @@ -0,0 +1,47 @@ +signal.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+
use std::process::exit;
+use std::sync::atomic::{AtomicBool, Ordering};
+
+use log::debug;
+
+static SHIM_HAS_CONTROL: AtomicBool = AtomicBool::new(false);
+const INTERRUPTED_EXIT_CODE: i32 = 130;
+
+pub fn pass_control_to_shim() {
+    SHIM_HAS_CONTROL.store(true, Ordering::SeqCst);
+}
+
+pub fn setup_signal_handler() {
+    let result = ctrlc::set_handler(|| {
+        if !SHIM_HAS_CONTROL.load(Ordering::SeqCst) {
+            exit(INTERRUPTED_EXIT_CODE);
+        }
+    });
+
+    if result.is_err() {
+        debug!("Unable to set Ctrl+C handler, SIGINT will not be handled correctly");
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/style.rs.html b/main/src/volta_core/style.rs.html new file mode 100644 index 000000000..0c917f1f6 --- /dev/null +++ b/main/src/volta_core/style.rs.html @@ -0,0 +1,259 @@ +style.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+
//! The view layer of Volta, with utilities for styling command-line output.
+use std::borrow::Cow;
+use std::error::Error;
+use std::time::Duration;
+
+use archive::Origin;
+use cfg_if::cfg_if;
+use console::{style, StyledObject};
+use indicatif::{ProgressBar, ProgressStyle};
+use terminal_size::{terminal_size, Width};
+
+pub const MAX_WIDTH: usize = 100;
+const MAX_PROGRESS_WIDTH: usize = 40;
+
+/// Generate the styled prefix for a success message
+pub fn success_prefix() -> StyledObject<&'static str> {
+    style("success:").green().bold()
+}
+
+/// Generate the styled prefix for a note
+pub fn note_prefix() -> StyledObject<&'static str> {
+    style("   note:").magenta().bold()
+}
+
+/// Format the underlying cause of an error
+pub(crate) fn format_error_cause(inner: &dyn Error) -> String {
+    format!(
+        "{}{} {}",
+        style("Error cause").underlined().bold(),
+        style(":").bold(),
+        inner
+    )
+}
+
+/// Determines the string to display based on the Origin of the operation.
+fn action_str(origin: Origin) -> &'static str {
+    match origin {
+        Origin::Local => "Unpacking",
+        Origin::Remote => "Fetching",
+    }
+}
+
+pub fn tool_version<N, V>(name: N, version: V) -> String
+where
+    N: std::fmt::Display + Sized,
+    V: std::fmt::Display + Sized,
+{
+    format!("{:}@{:}", name, version)
+}
+
+/// Get the width of the terminal, limited to a maximum of MAX_WIDTH
+pub fn text_width() -> Option<usize> {
+    terminal_size().map(|(Width(w), _)| (w as usize).min(MAX_WIDTH))
+}
+
+/// Constructs a command-line progress bar based on the specified Origin enum
+/// (e.g., `Origin::Remote`), details string (e.g., `"v1.23.4"`), and logical
+/// length (i.e., the number of logical progress steps in the process being
+/// visualized by the progress bar).
+pub fn progress_bar(origin: Origin, details: &str, len: u64) -> ProgressBar {
+    let action = action_str(origin);
+    let action_width = action.len() + 2; // plus 2 spaces to look nice
+    let msg_width = action_width + 1 + details.len();
+
+    //   Fetching node@9.11.2  [=============>                          ]  34%
+    // |--------| |---------|   |--------------------------------------|  |-|
+    //    action    details                      bar                 percentage
+    let bar_width = match text_width() {
+        Some(width) => MAX_PROGRESS_WIDTH.min(width - 2 - msg_width - 2 - 2 - 1 - 3 - 1),
+        None => MAX_PROGRESS_WIDTH,
+    };
+
+    let progress = ProgressBar::new(len);
+
+    progress.set_message(format!(
+        "{: >width$} {}",
+        style(action).green().bold(),
+        details,
+        width = action_width,
+    ));
+    progress.set_style(
+        ProgressStyle::default_bar()
+            .template(&format!(
+                "{{msg}}  [{{bar:{}.cyan/blue}}] {{percent:>3}}%",
+                bar_width
+            ))
+            .expect("template is valid")
+            .progress_chars("=> "),
+    );
+
+    progress
+}
+
+cfg_if! {
+    if #[cfg(windows)] {
+        /// Constructs a command-line progress spinner with the specified "message"
+        /// string. The spinner is ticked by default every 100ms.
+        pub fn progress_spinner<S>(message: S) -> ProgressBar
+        where
+            S: Into<Cow<'static, str>>,
+        {
+            let spinner = ProgressBar::new_spinner();
+            // Windows CMD prompt doesn't support Unicode characters, so use a simplified spinner
+            let style = ProgressStyle::default_spinner().tick_chars(r#"-\|/-"#);
+
+            spinner.set_message(message);
+            spinner.set_style(style);
+            spinner.enable_steady_tick(Duration::from_millis(100));
+
+            spinner
+        }
+    } else {
+        /// Constructs a command-line progress spinner with the specified "message"
+        /// string. The spinner is ticked by default every 50ms.
+        pub fn progress_spinner<S>(message: S) -> ProgressBar
+        where
+            S: Into<Cow<'static, str>>,
+        {
+            // ⠋ Fetching public registry: https://nodejs.org/dist/index.json
+            let spinner = ProgressBar::new_spinner();
+
+            spinner.set_message(message);
+            spinner.set_style(ProgressStyle::default_spinner());
+            spinner.enable_steady_tick(Duration::from_millis(50));
+
+            spinner
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/sync.rs.html b/main/src/volta_core/sync.rs.html new file mode 100644 index 000000000..7867c6744 --- /dev/null +++ b/main/src/volta_core/sync.rs.html @@ -0,0 +1,255 @@ +sync.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+
//! Inter-process locking on the Volta directory
+//!
+//! To avoid issues where multiple separate invocations of Volta modify the
+//! data directory simultaneously, we provide a locking mechanism that only
+//! allows a single process to modify the directory at a time.
+//!
+//! However, within a single process, we may attempt to lock the directory in
+//! different code paths. For example, when installing a package we require a
+//! lock, however we also may need to install Node, which requires a lock as
+//! well. To avoid deadlocks in those situations, we track the state of the
+//! lock globally:
+//!
+//! - If a lock is requested and no locks are active, then we acquire a file
+//!   lock on the `volta.lock` file and initialize the state with a count of 1
+//! - If a lock already exists, then we increment the count of active locks
+//! - When a lock is no longer needed, we decrement the count of active locks
+//! - When the last lock is released, we release the file lock and clear the
+//!   global lock state.
+//!
+//! This allows multiple code paths to request a lock and not worry about
+//! potential deadlocks, while still preventing multiple processes from making
+//! concurrent changes.
+
+use std::fs::{File, OpenOptions};
+use std::marker::PhantomData;
+use std::ops::Drop;
+use std::sync::Mutex;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::layout::volta_home;
+use crate::style::progress_spinner;
+use fs2::FileExt;
+use log::debug;
+use once_cell::sync::Lazy;
+
+static LOCK_STATE: Lazy<Mutex<Option<LockState>>> = Lazy::new(|| Mutex::new(None));
+
+/// The current state of locks for this process.
+///
+/// Note: To ensure thread safety _within_ this process, we enclose the
+/// state in a Mutex. This Mutex and it's associated locks are separate
+/// from the overall process lock and are only used to ensure the count
+/// is accurately maintained within a given process.
+struct LockState {
+    file: File,
+    count: usize,
+}
+
+const LOCK_FILE: &str = "volta.lock";
+
+/// An RAII implementation of a process lock on the Volta directory. A given Volta process can have
+/// multiple active locks, but only one process can have any locks at a time.
+///
+/// Once all of the `VoltaLock` objects go out of scope, the lock will be released to other
+/// processes.
+pub struct VoltaLock {
+    // Private field ensures that this cannot be created except for with the `acquire()` method
+    _private: PhantomData<()>,
+}
+
+impl VoltaLock {
+    pub fn acquire() -> Fallible<Self> {
+        let mut state = LOCK_STATE
+            .lock()
+            .with_context(|| ErrorKind::LockAcquireError)?;
+
+        // Check if there is an active lock for this process. If so, increment
+        // the count of active locks. If not, create a file lock and initialize
+        // the state with a count of 1
+        match &mut *state {
+            Some(inner) => {
+                inner.count += 1;
+            }
+            None => {
+                let path = volta_home()?.root().join(LOCK_FILE);
+                debug!("Acquiring lock on Volta directory: {}", path.display());
+
+                let file = OpenOptions::new()
+                    .write(true)
+                    .create(true)
+                    .open(path)
+                    .with_context(|| ErrorKind::LockAcquireError)?;
+                // First we try to lock the file without blocking. If that fails, then we show a spinner
+                // and block until the lock completes.
+                if file.try_lock_exclusive().is_err() {
+                    let spinner = progress_spinner("Waiting for file lock on Volta directory");
+                    // Note: Blocks until the file can be locked
+                    let lock_result = file
+                        .lock_exclusive()
+                        .with_context(|| ErrorKind::LockAcquireError);
+                    spinner.finish_and_clear();
+                    lock_result?;
+                }
+
+                *state = Some(LockState { file, count: 1 });
+            }
+        }
+
+        Ok(Self {
+            _private: PhantomData,
+        })
+    }
+}
+
+impl Drop for VoltaLock {
+    fn drop(&mut self) {
+        // On drop, decrement the count of active locks. If the count is 1,
+        // then this is the last active lock, so instead unlock the file and
+        // clear out the lock state.
+        if let Ok(mut state) = LOCK_STATE.lock() {
+            match &mut *state {
+                Some(inner) => {
+                    if inner.count == 1 {
+                        debug!("Unlocking Volta Directory");
+                        let _ = inner.file.unlock();
+                        *state = None;
+                    } else {
+                        inner.count -= 1;
+                    }
+                }
+                None => {
+                    debug!("Unexpected unlock of Volta directory when it wasn't locked");
+                }
+            }
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/mod.rs.html b/main/src/volta_core/tool/mod.rs.html new file mode 100644 index 000000000..fcce351cf --- /dev/null +++ b/main/src/volta_core/tool/mod.rs.html @@ -0,0 +1,589 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+
use std::env;
+use std::fmt::{self, Display};
+use std::path::PathBuf;
+
+use crate::error::{ErrorKind, Fallible};
+use crate::layout::volta_home;
+use crate::session::Session;
+use crate::style::{note_prefix, success_prefix, tool_version};
+use crate::sync::VoltaLock;
+use crate::version::VersionSpec;
+use crate::VOLTA_FEATURE_PNPM;
+use cfg_if::cfg_if;
+use log::{debug, info};
+
+pub mod node;
+pub mod npm;
+pub mod package;
+pub mod pnpm;
+mod registry;
+mod serial;
+pub mod yarn;
+
+pub use node::{
+    load_default_npm_version, Node, NODE_DISTRO_ARCH, NODE_DISTRO_EXTENSION, NODE_DISTRO_OS,
+};
+pub use npm::{BundledNpm, Npm};
+pub use package::{BinConfig, Package, PackageConfig, PackageManifest};
+pub use pnpm::Pnpm;
+pub use registry::PackageDetails;
+pub use yarn::Yarn;
+
+fn debug_already_fetched<T: Display>(tool: T) {
+    debug!("{} has already been fetched, skipping download", tool);
+}
+
+fn info_installed<T: Display>(tool: T) {
+    info!("{} installed and set {tool} as default", success_prefix());
+}
+
+fn info_fetched<T: Display>(tool: T) {
+    info!("{} fetched {tool}", success_prefix());
+}
+
+fn info_pinned<T: Display>(tool: T) {
+    info!("{} pinned {tool} in package.json", success_prefix());
+}
+
+fn info_project_version<P, D>(project_version: P, default_version: D)
+where
+    P: Display,
+    D: Display,
+{
+    info!(
+        r#"{} you are using {project_version} in the current project; to
+         instead use {default_version}, run `volta pin {default_version}`"#,
+        note_prefix()
+    );
+}
+
+/// Trait representing all of the actions that can be taken with a tool
+pub trait Tool: Display {
+    /// Fetch a Tool into the local inventory
+    fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>;
+    /// Install a tool, making it the default so it is available everywhere on the user's machine
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>;
+    /// Pin a tool in the local project so that it is usable within the project
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>;
+}
+
+/// Specification for a tool and its associated version.
+#[derive(Debug)]
+#[cfg_attr(test, derive(PartialEq, Eq))]
+pub enum Spec {
+    Node(VersionSpec),
+    Npm(VersionSpec),
+    Pnpm(VersionSpec),
+    Yarn(VersionSpec),
+    Package(String, VersionSpec),
+}
+
+impl Spec {
+    /// Resolve a tool spec into a fully realized Tool that can be fetched
+    pub fn resolve(self, session: &mut Session) -> Fallible<Box<dyn Tool>> {
+        match self {
+            Spec::Node(version) => {
+                let version = node::resolve(version, session)?;
+                Ok(Box::new(Node::new(version)))
+            }
+            Spec::Npm(version) => match npm::resolve(version, session)? {
+                Some(version) => Ok(Box::new(Npm::new(version))),
+                None => Ok(Box::new(BundledNpm)),
+            },
+            Spec::Pnpm(version) => {
+                // If the pnpm feature flag is set, use the special-cased package manager logic
+                // to handle resolving (and ultimately fetching / installing) pnpm. If not, then
+                // fall back to the global package behavior, which was the case prior to pnpm
+                // support being added
+                if env::var_os(VOLTA_FEATURE_PNPM).is_some() {
+                    let version = pnpm::resolve(version, session)?;
+                    Ok(Box::new(Pnpm::new(version)))
+                } else {
+                    let package = Package::new("pnpm".to_owned(), version)?;
+                    Ok(Box::new(package))
+                }
+            }
+            Spec::Yarn(version) => {
+                let version = yarn::resolve(version, session)?;
+                Ok(Box::new(Yarn::new(version)))
+            }
+            // When using global package install, we allow the package manager to perform the version resolution
+            Spec::Package(name, version) => {
+                let package = Package::new(name, version)?;
+                Ok(Box::new(package))
+            }
+        }
+    }
+
+    /// Uninstall a tool, removing it from the local inventory
+    ///
+    /// This is implemented on Spec, instead of Resolved, because there is currently no need to
+    /// resolve the specific version before uninstalling a tool.
+    pub fn uninstall(self) -> Fallible<()> {
+        match self {
+            Spec::Node(_) => Err(ErrorKind::Unimplemented {
+                feature: "Uninstalling node".into(),
+            }
+            .into()),
+            Spec::Npm(_) => Err(ErrorKind::Unimplemented {
+                feature: "Uninstalling npm".into(),
+            }
+            .into()),
+            Spec::Pnpm(_) => {
+                if env::var_os(VOLTA_FEATURE_PNPM).is_some() {
+                    Err(ErrorKind::Unimplemented {
+                        feature: "Uninstalling pnpm".into(),
+                    }
+                    .into())
+                } else {
+                    package::uninstall("pnpm")
+                }
+            }
+            Spec::Yarn(_) => Err(ErrorKind::Unimplemented {
+                feature: "Uninstalling yarn".into(),
+            }
+            .into()),
+            Spec::Package(name, _) => package::uninstall(&name),
+        }
+    }
+
+    /// The name of the tool, without the version, used for messaging
+    pub fn name(&self) -> &str {
+        match self {
+            Spec::Node(_) => "Node",
+            Spec::Npm(_) => "npm",
+            Spec::Pnpm(_) => "pnpm",
+            Spec::Yarn(_) => "Yarn",
+            Spec::Package(name, _) => name,
+        }
+    }
+}
+
+impl Display for Spec {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let s = match self {
+            Spec::Node(ref version) => tool_version("node", version),
+            Spec::Npm(ref version) => tool_version("npm", version),
+            Spec::Pnpm(ref version) => tool_version("pnpm", version),
+            Spec::Yarn(ref version) => tool_version("yarn", version),
+            Spec::Package(ref name, ref version) => tool_version(name, version),
+        };
+        f.write_str(&s)
+    }
+}
+
+/// Represents the result of checking if a tool is available locally or not
+///
+/// If a fetch is required, will include an exclusive lock on the Volta directory where possible
+enum FetchStatus {
+    AlreadyFetched,
+    FetchNeeded(Option<VoltaLock>),
+}
+
+/// Uses the supplied `already_fetched` predicate to determine if a tool is available or not.
+///
+/// This uses double-checking logic, to correctly handle concurrent fetch requests:
+///
+/// - If `already_fetched` indicates that a fetch is needed, we acquire an exclusive lock on the Volta directory
+/// - Then, we check _again_, to confirm that no other process completed the fetch while we waited for the lock
+///
+/// Note: If acquiring the lock fails, we proceed anyway, since the fetch is still necessary.
+fn check_fetched<F>(already_fetched: F) -> Fallible<FetchStatus>
+where
+    F: Fn() -> Fallible<bool>,
+{
+    if !already_fetched()? {
+        let lock = match VoltaLock::acquire() {
+            Ok(l) => Some(l),
+            Err(_) => {
+                debug!("Unable to acquire lock on Volta directory!");
+                None
+            }
+        };
+
+        if !already_fetched()? {
+            Ok(FetchStatus::FetchNeeded(lock))
+        } else {
+            Ok(FetchStatus::AlreadyFetched)
+        }
+    } else {
+        Ok(FetchStatus::AlreadyFetched)
+    }
+}
+
+fn download_tool_error(tool: Spec, from_url: impl AsRef<str>) -> impl FnOnce() -> ErrorKind {
+    let from_url = from_url.as_ref().to_string();
+    || ErrorKind::DownloadToolNetworkError { tool, from_url }
+}
+
+fn registry_fetch_error(
+    tool: impl AsRef<str>,
+    from_url: impl AsRef<str>,
+) -> impl FnOnce() -> ErrorKind {
+    let tool = tool.as_ref().to_string();
+    let from_url = from_url.as_ref().to_string();
+    || ErrorKind::RegistryFetchError { tool, from_url }
+}
+
+cfg_if!(
+    if #[cfg(windows)] {
+        const PATH_VAR_NAME: &str = "Path";
+    } else {
+        const PATH_VAR_NAME: &str = "PATH";
+    }
+);
+
+/// Check if a newly-installed shim is first on the PATH. If it isn't, we want to inform the user
+/// that they'll want to move it to the start of PATH to make sure things work as expected.
+pub fn check_shim_reachable(shim_name: &str) {
+    let Some(expected_dir) = find_expected_shim_dir(shim_name) else {
+        return;
+    };
+
+    let Ok(resolved) = which::which(shim_name) else {
+        info!(
+            "{} cannot find command {}. Please ensure that {} is available on your {}.",
+            note_prefix(),
+            shim_name,
+            expected_dir.display(),
+            PATH_VAR_NAME,
+        );
+        return;
+    };
+
+    if !resolved.starts_with(&expected_dir) {
+        info!(
+            "{} {} is shadowed by another binary of the same name at {}. To ensure your commands work as expected, please move {} to the start of your {}.",
+            note_prefix(),
+            shim_name,
+            resolved.display(),
+            expected_dir.display(),
+            PATH_VAR_NAME
+        );
+    }
+}
+
+/// Locate the base directory for the relevant shim in the Volta directories.
+///
+/// On Unix, all of the shims, including the default ones, are installed in `VoltaHome::shim_dir`
+#[cfg(unix)]
+fn find_expected_shim_dir(_shim_name: &str) -> Option<PathBuf> {
+    volta_home().ok().map(|home| home.shim_dir().to_owned())
+}
+
+/// Locate the base directory for the relevant shim in the Volta directories.
+///
+/// On Windows, the default shims (node, npm, yarn, etc.) are installed in `Program Files`
+/// alongside the Volta binaries. To determine where we should be checking, we first look for the
+/// relevant shim inside of `VoltaHome::shim_dir`. If it's there, we use that directory. If it
+/// isn't, we assume it must be a default shim and return `VoltaInstall::root`, which is where
+/// Volta itself is installed.
+#[cfg(windows)]
+fn find_expected_shim_dir(shim_name: &str) -> Option<PathBuf> {
+    use crate::layout::volta_install;
+
+    let home = volta_home().ok()?;
+
+    if home.shim_file(shim_name).exists() {
+        Some(home.shim_dir().to_owned())
+    } else {
+        volta_install()
+            .ok()
+            .map(|install| install.root().to_owned())
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/node/fetch.rs.html b/main/src/volta_core/tool/node/fetch.rs.html new file mode 100644 index 000000000..8fdd8f290 --- /dev/null +++ b/main/src/volta_core/tool/node/fetch.rs.html @@ -0,0 +1,439 @@ +fetch.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+
//! Provides fetcher for Node distributions
+
+use std::fs::{read_to_string, write, File};
+use std::path::{Path, PathBuf};
+
+use super::NodeVersion;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{create_staging_dir, create_staging_file, rename};
+use crate::hook::ToolHooks;
+use crate::layout::volta_home;
+use crate::style::{progress_bar, tool_version};
+use crate::tool::{self, download_tool_error, Node};
+use crate::version::{parse_version, VersionSpec};
+use archive::{self, Archive};
+use cfg_if::cfg_if;
+use fs_utils::ensure_containing_dir_exists;
+use log::debug;
+use node_semver::Version;
+use serde::Deserialize;
+
+cfg_if! {
+    if #[cfg(feature = "mock-network")] {
+        // TODO: We need to reconsider our mocking strategy in light of mockito deprecating the
+        // SERVER_URL constant: Since our acceptance tests run the binary in a separate process,
+        // we can't use `mockito::server_url()`, which relies on shared memory.
+        fn public_node_server_root() -> String {
+            #[allow(deprecated)]
+            mockito::SERVER_URL.to_string()
+        }
+    } else {
+        fn public_node_server_root() -> String {
+            "https://nodejs.org/dist".to_string()
+        }
+    }
+}
+
+fn npm_manifest_path(version: &Version) -> PathBuf {
+    let mut manifest = PathBuf::from(Node::archive_basename(version));
+
+    #[cfg(unix)]
+    manifest.push("lib");
+
+    manifest.push("node_modules");
+    manifest.push("npm");
+    manifest.push("package.json");
+
+    manifest
+}
+
+pub fn fetch(version: &Version, hooks: Option<&ToolHooks<Node>>) -> Fallible<NodeVersion> {
+    let home = volta_home()?;
+    let node_dir = home.node_inventory_dir();
+    let cache_file = node_dir.join(Node::archive_filename(version));
+
+    let (archive, staging) = match load_cached_distro(&cache_file) {
+        Some(archive) => {
+            debug!(
+                "Loading {} from cached archive at '{}'",
+                tool_version("node", version),
+                cache_file.display()
+            );
+            (archive, None)
+        }
+        None => {
+            let staging = create_staging_file()?;
+            let remote_url = determine_remote_url(version, hooks)?;
+            let archive = fetch_remote_distro(version, &remote_url, staging.path())?;
+            (archive, Some(staging))
+        }
+    };
+
+    let node_version = unpack_archive(archive, version)?;
+
+    if let Some(staging_file) = staging {
+        ensure_containing_dir_exists(&cache_file).with_context(|| {
+            ErrorKind::ContainingDirError {
+                path: cache_file.clone(),
+            }
+        })?;
+        staging_file
+            .persist(cache_file)
+            .with_context(|| ErrorKind::PersistInventoryError {
+                tool: "Node".into(),
+            })?;
+    }
+
+    Ok(node_version)
+}
+
+/// Unpack the node archive into the image directory so that it is ready for use
+fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<NodeVersion> {
+    let temp = create_staging_dir()?;
+    debug!("Unpacking node into '{}'", temp.path().display());
+
+    let progress = progress_bar(
+        archive.origin(),
+        &tool_version("node", version),
+        archive.compressed_size(),
+    );
+    let version_string = version.to_string();
+
+    archive
+        .unpack(temp.path(), &mut |_, read| {
+            progress.inc(read as u64);
+        })
+        .with_context(|| ErrorKind::UnpackArchiveError {
+            tool: "Node".into(),
+            version: version_string.clone(),
+        })?;
+
+    // Save the npm version number in the npm version file for this distro
+    let npm_package_json = temp.path().join(npm_manifest_path(version));
+    let npm = Manifest::version(&npm_package_json)?;
+    save_default_npm_version(version, &npm)?;
+
+    let dest = volta_home()?.node_image_dir(&version_string);
+    ensure_containing_dir_exists(&dest)
+        .with_context(|| ErrorKind::ContainingDirError { path: dest.clone() })?;
+
+    rename(temp.path().join(Node::archive_basename(version)), &dest).with_context(|| {
+        ErrorKind::SetupToolImageError {
+            tool: "Node".into(),
+            version: version_string,
+            dir: dest.clone(),
+        }
+    })?;
+
+    progress.finish_and_clear();
+
+    // Note: We write these after the progress bar is finished to avoid display bugs with re-renders of the progress
+    debug!("Saving bundled npm version ({})", npm);
+    debug!("Installing node in '{}'", dest.display());
+
+    Ok(NodeVersion {
+        runtime: version.clone(),
+        npm,
+    })
+}
+
+/// Return the archive if it is valid. It may have been corrupted or interrupted in the middle of
+/// downloading.
+// ISSUE(#134) - verify checksum
+fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>> {
+    if file.is_file() {
+        let file = File::open(file).ok()?;
+        archive::load_native(file).ok()
+    } else {
+        None
+    }
+}
+
+/// Determine the remote URL to download from, using the hooks if available
+fn determine_remote_url(version: &Version, hooks: Option<&ToolHooks<Node>>) -> Fallible<String> {
+    let distro_file_name = Node::archive_filename(version);
+    match hooks {
+        Some(&ToolHooks {
+            distro: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using node.distro hook to determine download URL");
+            hook.resolve(version, &distro_file_name)
+        }
+        _ => Ok(format!(
+            "{}/v{}/{}",
+            public_node_server_root(),
+            version,
+            distro_file_name
+        )),
+    }
+}
+
+/// Fetch the distro archive from the internet
+fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path,
+) -> Fallible<Box<dyn Archive>> {
+    debug!("Downloading {} from {}", tool_version("node", version), url);
+    archive::fetch_native(url, staging_path).with_context(download_tool_error(
+        tool::Spec::Node(VersionSpec::Exact(version.clone())),
+        url,
+    ))
+}
+
+/// The portion of npm's `package.json` file that we care about
+#[derive(Deserialize)]
+struct Manifest {
+    version: String,
+}
+
+impl Manifest {
+    /// Parse the version out of a package.json file
+    fn version(path: &Path) -> Fallible<Version> {
+        let file = File::open(path).with_context(|| ErrorKind::ReadNpmManifestError)?;
+        let manifest: Manifest =
+            serde_json::de::from_reader(file).with_context(|| ErrorKind::ParseNpmManifestError)?;
+        parse_version(manifest.version)
+    }
+}
+
+/// Load the local npm version file to determine the default npm version for a given version of Node
+pub fn load_default_npm_version(node: &Version) -> Fallible<Version> {
+    let npm_version_file_path = volta_home()?.node_npm_version_file(&node.to_string());
+    let npm_version =
+        read_to_string(&npm_version_file_path).with_context(|| ErrorKind::ReadDefaultNpmError {
+            file: npm_version_file_path,
+        })?;
+    parse_version(npm_version)
+}
+
+/// Save the default npm version to the filesystem for a given version of Node
+fn save_default_npm_version(node: &Version, npm: &Version) -> Fallible<()> {
+    let npm_version_file_path = volta_home()?.node_npm_version_file(&node.to_string());
+    write(&npm_version_file_path, npm.to_string().as_bytes()).with_context(|| {
+        ErrorKind::WriteDefaultNpmError {
+            file: npm_version_file_path,
+        }
+    })
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/node/metadata.rs.html b/main/src/volta_core/tool/node/metadata.rs.html new file mode 100644 index 000000000..527026cc1 --- /dev/null +++ b/main/src/volta_core/tool/node/metadata.rs.html @@ -0,0 +1,179 @@ +metadata.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+
use std::collections::HashSet;
+
+use super::NODE_DISTRO_IDENTIFIER;
+#[cfg(any(
+    all(target_os = "macos", target_arch = "aarch64"),
+    all(target_os = "windows", target_arch = "aarch64")
+))]
+use super::NODE_DISTRO_IDENTIFIER_FALLBACK;
+use crate::version::{option_version_serde, version_serde};
+use node_semver::Version;
+use serde::{Deserialize, Deserializer};
+
+/// The index of the public Node server.
+pub struct NodeIndex {
+    pub(super) entries: Vec<NodeEntry>,
+}
+
+#[derive(Debug)]
+pub struct NodeEntry {
+    pub version: Version,
+    pub lts: bool,
+}
+
+#[derive(Deserialize)]
+pub struct RawNodeIndex(Vec<RawNodeEntry>);
+
+#[derive(Deserialize)]
+pub struct RawNodeEntry {
+    #[serde(with = "version_serde")]
+    version: Version,
+    #[serde(default)] // handles Option
+    #[serde(with = "option_version_serde")]
+    npm: Option<Version>,
+    files: HashSet<String>,
+    #[serde(deserialize_with = "lts_version_serde")]
+    lts: bool,
+}
+
+impl From<RawNodeIndex> for NodeIndex {
+    fn from(raw: RawNodeIndex) -> NodeIndex {
+        let entries = raw
+            .0
+            .into_iter()
+            .filter_map(|entry| {
+                #[cfg(not(any(
+                    all(target_os = "macos", target_arch = "aarch64"),
+                    all(target_os = "windows", target_arch = "aarch64")
+                )))]
+                if entry.npm.is_some() && entry.files.contains(NODE_DISTRO_IDENTIFIER) {
+                    Some(NodeEntry {
+                        version: entry.version,
+                        lts: entry.lts,
+                    })
+                } else {
+                    None
+                }
+
+                #[cfg(any(
+                    all(target_os = "macos", target_arch = "aarch64"),
+                    all(target_os = "windows", target_arch = "aarch64")
+                ))]
+                if entry.npm.is_some()
+                    && (entry.files.contains(NODE_DISTRO_IDENTIFIER)
+                        || entry.files.contains(NODE_DISTRO_IDENTIFIER_FALLBACK))
+                {
+                    Some(NodeEntry {
+                        version: entry.version,
+                        lts: entry.lts,
+                    })
+                } else {
+                    None
+                }
+            })
+            .collect();
+
+        NodeIndex { entries }
+    }
+}
+
+#[allow(clippy::unnecessary_wraps)] // Needs to match the API expected by Serde
+fn lts_version_serde<'de, D>(deserializer: D) -> Result<bool, D::Error>
+where
+    D: Deserializer<'de>,
+{
+    match String::deserialize(deserializer) {
+        Ok(_) => Ok(true),
+        Err(_) => Ok(false),
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/node/mod.rs.html b/main/src/volta_core/tool/node/mod.rs.html new file mode 100644 index 000000000..0b77fcc56 --- /dev/null +++ b/main/src/volta_core/tool/node/mod.rs.html @@ -0,0 +1,727 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+
use std::fmt::{self, Display};
+
+use super::{
+    check_fetched, check_shim_reachable, debug_already_fetched, info_fetched, info_installed,
+    info_pinned, info_project_version, FetchStatus, Tool,
+};
+use crate::error::{ErrorKind, Fallible};
+use crate::inventory::node_available;
+use crate::session::Session;
+use crate::style::{note_prefix, tool_version};
+use crate::sync::VoltaLock;
+use cfg_if::cfg_if;
+use log::info;
+use node_semver::Version;
+
+mod fetch;
+mod metadata;
+mod resolve;
+
+pub use fetch::load_default_npm_version;
+pub use resolve::resolve;
+
+cfg_if! {
+    if #[cfg(all(target_os = "windows", target_arch = "x86"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "win";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "x86";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "zip";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "win-x86-zip";
+    } else if #[cfg(all(target_os = "windows", target_arch = "x86_64"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "win";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "x64";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "zip";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "win-x64-zip";
+    } else if #[cfg(all(target_os = "windows", target_arch = "aarch64"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "win";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "arm64";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "zip";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "win-arm64-zip";
+
+        // NOTE: Node support for pre-built ARM64 binaries on Windows was added in major version 20
+        // For versions prior to that, we need to fall back on the x64 binaries via emulator
+
+        /// The fallback architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH_FALLBACK: &str = "x64";
+        /// The fallback file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER_FALLBACK: &str = "win-x64-zip";
+    } else if #[cfg(all(target_os = "macos", target_arch = "x86_64"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "darwin";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "x64";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "tar.gz";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "osx-x64-tar";
+    } else if #[cfg(all(target_os = "macos", target_arch = "aarch64"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "darwin";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "arm64";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "tar.gz";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "osx-arm64-tar";
+
+        // NOTE: Node support for pre-built Apple Silicon binaries was added in major version 16
+        // For versions prior to that, we need to fall back on the x64 binaries via Rosetta 2
+
+        /// The fallback architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH_FALLBACK: &str = "x64";
+        /// The fallback file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER_FALLBACK: &str = "osx-x64-tar";
+    } else if #[cfg(all(target_os = "linux", target_arch = "x86_64"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "linux";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "x64";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "tar.gz";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "linux-x64";
+    } else if #[cfg(all(target_os = "linux", target_arch = "aarch64"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "linux";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "arm64";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "tar.gz";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "linux-arm64";
+    } else if #[cfg(all(target_os = "linux", target_arch = "arm"))] {
+        /// The OS component of a Node distro filename
+        pub const NODE_DISTRO_OS: &str = "linux";
+        /// The architecture component of a Node distro filename
+        pub const NODE_DISTRO_ARCH: &str = "armv7l";
+        /// The extension for Node distro files
+        pub const NODE_DISTRO_EXTENSION: &str = "tar.gz";
+        /// The file identifier in the Node index `files` array
+        pub const NODE_DISTRO_IDENTIFIER: &str = "linux-armv7l";
+    } else {
+        compile_error!("Unsuppored operating system + architecture combination");
+    }
+}
+
+/// A full Node version including not just the version of Node itself
+/// but also the specific version of npm installed globally with that
+/// Node installation.
+#[derive(Clone, Debug)]
+pub struct NodeVersion {
+    /// The version of Node itself.
+    pub runtime: Version,
+    /// The npm version globally installed with the Node distro.
+    pub npm: Version,
+}
+
+impl Display for NodeVersion {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(
+            f,
+            "{} (with {})",
+            tool_version("node", &self.runtime),
+            tool_version("npm", &self.npm)
+        )
+    }
+}
+
+/// The Tool implementation for fetching and installing Node
+pub struct Node {
+    pub(super) version: Version,
+}
+
+impl Node {
+    pub fn new(version: Version) -> Self {
+        Node { version }
+    }
+
+    #[cfg(not(any(
+        all(target_os = "macos", target_arch = "aarch64"),
+        all(target_os = "windows", target_arch = "aarch64")
+    )))]
+    pub fn archive_basename(version: &Version) -> String {
+        format!("node-v{}-{}-{}", version, NODE_DISTRO_OS, NODE_DISTRO_ARCH)
+    }
+
+    #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
+    pub fn archive_basename(version: &Version) -> String {
+        // Note: Node began shipping pre-built binaries for Apple Silicon with Major version 16
+        // Prior to that, we need to fall back on the x64 binaries
+        format!(
+            "node-v{}-{}-{}",
+            version,
+            NODE_DISTRO_OS,
+            if version.major >= 16 {
+                NODE_DISTRO_ARCH
+            } else {
+                NODE_DISTRO_ARCH_FALLBACK
+            }
+        )
+    }
+
+    #[cfg(all(target_os = "windows", target_arch = "aarch64"))]
+    pub fn archive_basename(version: &Version) -> String {
+        // Note: Node began shipping pre-built binaries for Windows ARM with Major version 20
+        // Prior to that, we need to fall back on the x64 binaries
+        format!(
+            "node-v{}-{}-{}",
+            version,
+            NODE_DISTRO_OS,
+            if version.major >= 20 {
+                NODE_DISTRO_ARCH
+            } else {
+                NODE_DISTRO_ARCH_FALLBACK
+            }
+        )
+    }
+
+    pub fn archive_filename(version: &Version) -> String {
+        format!(
+            "{}.{}",
+            Node::archive_basename(version),
+            NODE_DISTRO_EXTENSION
+        )
+    }
+
+    pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<NodeVersion> {
+        match check_fetched(|| node_available(&self.version))? {
+            FetchStatus::AlreadyFetched => {
+                debug_already_fetched(self);
+                let npm = fetch::load_default_npm_version(&self.version)?;
+
+                Ok(NodeVersion {
+                    runtime: self.version.clone(),
+                    npm,
+                })
+            }
+            FetchStatus::FetchNeeded(_lock) => fetch::fetch(&self.version, session.hooks()?.node()),
+        }
+    }
+}
+
+impl Tool for Node {
+    fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        let node_version = self.ensure_fetched(session)?;
+
+        info_fetched(node_version);
+        Ok(())
+    }
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        // Acquire a lock on the Volta directory, if possible, to prevent concurrent changes
+        let _lock = VoltaLock::acquire();
+        let node_version = self.ensure_fetched(session)?;
+
+        let default_toolchain = session.toolchain_mut()?;
+        default_toolchain.set_active_node(&self.version)?;
+
+        // If the user has a default version of `npm`, we shouldn't show the "(with npm@X.Y.ZZZ)" text in the success message
+        // Instead we should check if the bundled version is higher than the default and inform the user
+        // Note: The previous line ensures that there will be a default platform
+        if let Some(default_npm) = &default_toolchain.platform().unwrap().npm {
+            info_installed(&self); // includes node version
+
+            if node_version.npm > *default_npm {
+                info!("{} this version of Node includes {}, which is higher than your default version ({}).
+      To use the version included with Node, run `volta install npm@bundled`",
+                    note_prefix(),
+                    tool_version("npm", node_version.npm),
+                    default_npm.to_string()
+                );
+            }
+        } else {
+            info_installed(node_version); // includes node and npm version
+        }
+
+        check_shim_reachable("node");
+
+        if let Ok(Some(project)) = session.project_platform() {
+            info_project_version(tool_version("node", &project.node), &self);
+        }
+
+        Ok(())
+    }
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        if session.project()?.is_some() {
+            let node_version = self.ensure_fetched(session)?;
+
+            // Note: We know this will succeed, since we checked above
+            let project = session.project_mut()?.unwrap();
+            project.pin_node(self.version.clone())?;
+
+            // If the user has a pinned version of `npm`, we shouldn't show the "(with npm@X.Y.ZZZ)" text in the success message
+            // Instead we should check if the bundled version is higher than the pinned and inform the user
+            // Note: The pin operation guarantees there will be a platform
+            if let Some(pinned_npm) = &project.platform().unwrap().npm {
+                info_pinned(self); // includes node version
+
+                if node_version.npm > *pinned_npm {
+                    info!("{} this version of Node includes {}, which is higher than your pinned version ({}).
+      To use the version included with Node, run `volta pin npm@bundled`",
+                        note_prefix(),
+                        tool_version("npm", node_version.npm),
+                        pinned_npm.to_string()
+                    );
+                }
+            } else {
+                info_pinned(node_version); // includes node and npm version
+            }
+
+            Ok(())
+        } else {
+            Err(ErrorKind::NotInPackage.into())
+        }
+    }
+}
+
+impl Display for Node {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(&tool_version("node", &self.version))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_node_archive_basename() {
+        assert_eq!(
+            Node::archive_basename(&Version::parse("20.2.3").unwrap()),
+            format!("node-v20.2.3-{}-{}", NODE_DISTRO_OS, NODE_DISTRO_ARCH)
+        );
+    }
+
+    #[test]
+    fn test_node_archive_filename() {
+        assert_eq!(
+            Node::archive_filename(&Version::parse("20.2.3").unwrap()),
+            format!(
+                "node-v20.2.3-{}-{}.{}",
+                NODE_DISTRO_OS, NODE_DISTRO_ARCH, NODE_DISTRO_EXTENSION
+            )
+        );
+    }
+
+    #[test]
+    #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
+    fn test_fallback_node_archive_basename() {
+        assert_eq!(
+            Node::archive_basename(&Version::parse("15.2.3").unwrap()),
+            format!(
+                "node-v15.2.3-{}-{}",
+                NODE_DISTRO_OS, NODE_DISTRO_ARCH_FALLBACK
+            )
+        );
+    }
+
+    #[test]
+    #[cfg(all(target_os = "windows", target_arch = "aarch64"))]
+    fn test_fallback_node_archive_basename() {
+        assert_eq!(
+            Node::archive_basename(&Version::parse("19.2.3").unwrap()),
+            format!(
+                "node-v19.2.3-{}-{}",
+                NODE_DISTRO_OS, NODE_DISTRO_ARCH_FALLBACK
+            )
+        );
+    }
+
+    #[test]
+    #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
+    fn test_fallback_node_archive_filename() {
+        assert_eq!(
+            Node::archive_filename(&Version::parse("15.2.3").unwrap()),
+            format!(
+                "node-v15.2.3-{}-{}.{}",
+                NODE_DISTRO_OS, NODE_DISTRO_ARCH_FALLBACK, NODE_DISTRO_EXTENSION
+            )
+        );
+    }
+
+    #[test]
+    #[cfg(all(target_os = "windows", target_arch = "aarch64"))]
+    fn test_fallback_node_archive_filename() {
+        assert_eq!(
+            Node::archive_filename(&Version::parse("19.2.3").unwrap()),
+            format!(
+                "node-v19.2.3-{}-{}.{}",
+                NODE_DISTRO_OS, NODE_DISTRO_ARCH_FALLBACK, NODE_DISTRO_EXTENSION
+            )
+        );
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/node/resolve.rs.html b/main/src/volta_core/tool/node/resolve.rs.html new file mode 100644 index 000000000..558276c0e --- /dev/null +++ b/main/src/volta_core/tool/node/resolve.rs.html @@ -0,0 +1,541 @@ +resolve.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+
//! Provides resolution of Node requirements into specific versions, using the NodeJS index
+
+use std::fs::File;
+use std::io::Write;
+use std::time::{Duration, SystemTime};
+
+use super::super::registry_fetch_error;
+use super::metadata::{NodeEntry, NodeIndex, RawNodeIndex};
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{create_staging_file, read_file};
+use crate::hook::ToolHooks;
+use crate::layout::volta_home;
+use crate::session::Session;
+use crate::style::progress_spinner;
+use crate::tool::Node;
+use crate::version::{VersionSpec, VersionTag};
+use attohttpc::header::HeaderMap;
+use attohttpc::Response;
+use cfg_if::cfg_if;
+use fs_utils::ensure_containing_dir_exists;
+use headers::{CacheControl, Expires, HeaderMapExt};
+use log::debug;
+use node_semver::{Range, Version};
+
+// ISSUE (#86): Move public repository URLs to config file
+cfg_if! {
+    if #[cfg(feature = "mock-network")] {
+        // TODO: We need to reconsider our mocking strategy in light of mockito deprecating the
+        // SERVER_URL constant: Since our acceptance tests run the binary in a separate process,
+        // we can't use `mockito::server_url()`, which relies on shared memory.
+        #[allow(deprecated)]
+        const SERVER_URL: &str = mockito::SERVER_URL;
+        fn public_node_version_index() -> String {
+            format!("{}/node-dist/index.json", SERVER_URL)
+        }
+    } else {
+        /// Returns the URL of the index of available Node versions on the public Node server.
+        fn public_node_version_index() -> String {
+            "https://nodejs.org/dist/index.json".to_string()
+        }
+    }
+}
+
+pub fn resolve(matching: VersionSpec, session: &mut Session) -> Fallible<Version> {
+    let hooks = session.hooks()?.node();
+    match matching {
+        VersionSpec::Semver(requirement) => resolve_semver(requirement, hooks),
+        VersionSpec::Exact(version) => Ok(version),
+        VersionSpec::None | VersionSpec::Tag(VersionTag::Lts) => resolve_lts(hooks),
+        VersionSpec::Tag(VersionTag::Latest) => resolve_latest(hooks),
+        // Node doesn't have "tagged" versions (apart from 'latest' and 'lts'), so custom tags will always be an error
+        VersionSpec::Tag(VersionTag::Custom(tag)) => {
+            Err(ErrorKind::NodeVersionNotFound { matching: tag }.into())
+        }
+    }
+}
+
+fn resolve_latest(hooks: Option<&ToolHooks<Node>>) -> Fallible<Version> {
+    // NOTE: This assumes the registry always produces a list in sorted order
+    //       from newest to oldest. This should be specified as a requirement
+    //       when we document the plugin API.
+    let url = match hooks {
+        Some(&ToolHooks {
+            latest: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using node.latest hook to determine node index URL");
+            hook.resolve("index.json")?
+        }
+        _ => public_node_version_index(),
+    };
+    let version_opt = match_node_version(&url, |_| true)?;
+
+    match version_opt {
+        Some(version) => {
+            debug!("Found latest node version ({}) from {}", version, url);
+            Ok(version)
+        }
+        None => Err(ErrorKind::NodeVersionNotFound {
+            matching: "latest".into(),
+        }
+        .into()),
+    }
+}
+
+fn resolve_lts(hooks: Option<&ToolHooks<Node>>) -> Fallible<Version> {
+    let url = match hooks {
+        Some(&ToolHooks {
+            index: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using node.index hook to determine node index URL");
+            hook.resolve("index.json")?
+        }
+        _ => public_node_version_index(),
+    };
+    let version_opt = match_node_version(&url, |&NodeEntry { lts, .. }| lts)?;
+
+    match version_opt {
+        Some(version) => {
+            debug!("Found newest LTS node version ({}) from {}", version, url);
+            Ok(version)
+        }
+        None => Err(ErrorKind::NodeVersionNotFound {
+            matching: "lts".into(),
+        }
+        .into()),
+    }
+}
+
+fn resolve_semver(matching: Range, hooks: Option<&ToolHooks<Node>>) -> Fallible<Version> {
+    let url = match hooks {
+        Some(&ToolHooks {
+            index: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using node.index hook to determine node index URL");
+            hook.resolve("index.json")?
+        }
+        _ => public_node_version_index(),
+    };
+    let version_opt = match_node_version(&url, |NodeEntry { version, .. }| {
+        matching.satisfies(version)
+    })?;
+
+    match version_opt {
+        Some(version) => {
+            debug!(
+                "Found node@{} matching requirement '{}' from {}",
+                version, matching, url
+            );
+            Ok(version)
+        }
+        None => Err(ErrorKind::NodeVersionNotFound {
+            matching: matching.to_string(),
+        }
+        .into()),
+    }
+}
+
+fn match_node_version(
+    url: &str,
+    predicate: impl Fn(&NodeEntry) -> bool,
+) -> Fallible<Option<Version>> {
+    let index: NodeIndex = resolve_node_versions(url)?.into();
+    let mut entries = index.entries.into_iter();
+    Ok(entries
+        .find(predicate)
+        .map(|NodeEntry { version, .. }| version))
+}
+
+/// Reads a public index from the Node cache, if it exists and hasn't expired.
+fn read_cached_opt(url: &str) -> Fallible<Option<RawNodeIndex>> {
+    let expiry_file = volta_home()?.node_index_expiry_file();
+    let expiry = read_file(expiry_file).with_context(|| ErrorKind::ReadNodeIndexExpiryError {
+        file: expiry_file.to_owned(),
+    })?;
+
+    if !expiry
+        .map(|date| httpdate::parse_http_date(&date))
+        .transpose()
+        .with_context(|| ErrorKind::ParseNodeIndexExpiryError)?
+        .is_some_and(|expiry_date| SystemTime::now() < expiry_date)
+    {
+        return Ok(None);
+    };
+
+    let index_file = volta_home()?.node_index_file();
+    let cached = read_file(index_file).with_context(|| ErrorKind::ReadNodeIndexCacheError {
+        file: index_file.to_owned(),
+    })?;
+
+    let Some(json) = cached
+        .as_ref()
+        .and_then(|content| content.strip_prefix(url))
+    else {
+        return Ok(None);
+    };
+
+    serde_json::de::from_str(json).with_context(|| ErrorKind::ParseNodeIndexCacheError)
+}
+
+/// Get the cache max-age of an HTTP response.
+fn max_age(headers: &HeaderMap) -> Duration {
+    const FOUR_HOURS: Duration = Duration::from_secs(4 * 60 * 60);
+    headers
+        .typed_get::<CacheControl>()
+        .and_then(|cache_control| cache_control.max_age())
+        .unwrap_or(FOUR_HOURS)
+}
+
+fn resolve_node_versions(url: &str) -> Fallible<RawNodeIndex> {
+    match read_cached_opt(url)? {
+        Some(serial) => {
+            debug!("Found valid cache of Node version index");
+            Ok(serial)
+        }
+        None => {
+            debug!("Node index cache was not found or was invalid");
+            let spinner = progress_spinner(format!("Fetching public registry: {}", url));
+
+            let (_, headers, response) = attohttpc::get(url)
+                .send()
+                .and_then(Response::error_for_status)
+                .with_context(registry_fetch_error("Node", url))?
+                .split();
+
+            let expires = headers
+                .typed_get::<Expires>()
+                .map(SystemTime::from)
+                .unwrap_or_else(|| SystemTime::now() + max_age(&headers));
+
+            let response_text = response
+                .text()
+                .with_context(registry_fetch_error("Node", url))?;
+
+            let index: RawNodeIndex =
+                serde_json::de::from_str(&response_text).with_context(|| {
+                    ErrorKind::ParseNodeIndexError {
+                        from_url: url.to_string(),
+                    }
+                })?;
+
+            let cached = create_staging_file()?;
+
+            let mut cached_file: &File = cached.as_file();
+            writeln!(cached_file, "{}", url)
+                .and_then(|_| cached_file.write(response_text.as_bytes()))
+                .with_context(|| ErrorKind::WriteNodeIndexCacheError {
+                    file: cached.path().to_path_buf(),
+                })?;
+
+            let index_cache_file = volta_home()?.node_index_file();
+            ensure_containing_dir_exists(&index_cache_file).with_context(|| {
+                ErrorKind::ContainingDirError {
+                    path: index_cache_file.to_owned(),
+                }
+            })?;
+            cached.persist(index_cache_file).with_context(|| {
+                ErrorKind::WriteNodeIndexCacheError {
+                    file: index_cache_file.to_owned(),
+                }
+            })?;
+
+            let expiry = create_staging_file()?;
+            let mut expiry_file: &File = expiry.as_file();
+
+            write!(expiry_file, "{}", httpdate::fmt_http_date(expires)).with_context(|| {
+                ErrorKind::WriteNodeIndexExpiryError {
+                    file: expiry.path().to_path_buf(),
+                }
+            })?;
+
+            let index_expiry_file = volta_home()?.node_index_expiry_file();
+            ensure_containing_dir_exists(&index_expiry_file).with_context(|| {
+                ErrorKind::ContainingDirError {
+                    path: index_expiry_file.to_owned(),
+                }
+            })?;
+            expiry.persist(index_expiry_file).with_context(|| {
+                ErrorKind::WriteNodeIndexExpiryError {
+                    file: index_expiry_file.to_owned(),
+                }
+            })?;
+
+            spinner.finish_and_clear();
+            Ok(index)
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/npm/fetch.rs.html b/main/src/volta_core/tool/npm/fetch.rs.html new file mode 100644 index 000000000..55d144396 --- /dev/null +++ b/main/src/volta_core/tool/npm/fetch.rs.html @@ -0,0 +1,375 @@ +fetch.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+
//! Provides fetcher for npm distributions
+
+use std::fs::{write, File};
+use std::path::Path;
+
+use super::super::download_tool_error;
+use super::super::registry::public_registry_package;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{create_staging_dir, create_staging_file, rename, set_executable};
+use crate::hook::ToolHooks;
+use crate::layout::volta_home;
+use crate::style::{progress_bar, tool_version};
+use crate::tool::{self, Npm};
+use crate::version::VersionSpec;
+use archive::{Archive, Tarball};
+use fs_utils::ensure_containing_dir_exists;
+use log::debug;
+use node_semver::Version;
+
+pub fn fetch(version: &Version, hooks: Option<&ToolHooks<Npm>>) -> Fallible<()> {
+    let npm_dir = volta_home()?.npm_inventory_dir();
+    let cache_file = npm_dir.join(Npm::archive_filename(&version.to_string()));
+
+    let (archive, staging) = match load_cached_distro(&cache_file) {
+        Some(archive) => {
+            debug!(
+                "Loading {} from cached archive at '{}'",
+                tool_version("npm", version),
+                cache_file.display()
+            );
+            (archive, None)
+        }
+        None => {
+            let staging = create_staging_file()?;
+            let remote_url = determine_remote_url(version, hooks)?;
+            let archive = fetch_remote_distro(version, &remote_url, staging.path())?;
+            (archive, Some(staging))
+        }
+    };
+
+    unpack_archive(archive, version)?;
+
+    if let Some(staging_file) = staging {
+        ensure_containing_dir_exists(&cache_file).with_context(|| {
+            ErrorKind::ContainingDirError {
+                path: cache_file.clone(),
+            }
+        })?;
+        staging_file
+            .persist(cache_file)
+            .with_context(|| ErrorKind::PersistInventoryError { tool: "npm".into() })?;
+    }
+
+    Ok(())
+}
+
+/// Unpack the npm archive into the image directory so that it is ready for use
+fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<()> {
+    let temp = create_staging_dir()?;
+    debug!("Unpacking npm into '{}'", temp.path().display());
+
+    let progress = progress_bar(
+        archive.origin(),
+        &tool_version("npm", version),
+        archive.compressed_size(),
+    );
+    let version_string = version.to_string();
+
+    archive
+        .unpack(temp.path(), &mut |_, read| {
+            progress.inc(read as u64);
+        })
+        .with_context(|| ErrorKind::UnpackArchiveError {
+            tool: "npm".into(),
+            version: version_string.clone(),
+        })?;
+
+    let bin_path = temp.path().join("package").join("bin");
+    overwrite_launcher(&bin_path, "npm")?;
+    overwrite_launcher(&bin_path, "npx")?;
+
+    #[cfg(windows)]
+    {
+        overwrite_cmd_launcher(&bin_path, "npm")?;
+        overwrite_cmd_launcher(&bin_path, "npx")?;
+    }
+
+    let dest = volta_home()?.npm_image_dir(&version_string);
+    ensure_containing_dir_exists(&dest)
+        .with_context(|| ErrorKind::ContainingDirError { path: dest.clone() })?;
+
+    rename(temp.path().join("package"), &dest).with_context(|| ErrorKind::SetupToolImageError {
+        tool: "npm".into(),
+        version: version_string.clone(),
+        dir: dest.clone(),
+    })?;
+
+    progress.finish_and_clear();
+
+    // Note: We write this after the progress bar is finished to avoid display bugs with re-renders of the progress
+    debug!("Installing npm in '{}'", dest.display());
+
+    Ok(())
+}
+
+/// Return the archive if it is valid. It may have been corrupted or interrupted in the middle of
+/// downloading.
+/// ISSUE(#134) - verify checksum
+fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>> {
+    if file.is_file() {
+        let file = File::open(file).ok()?;
+        Tarball::load(file).ok()
+    } else {
+        None
+    }
+}
+
+/// Determine the remote URL to download from, using the hooks if avaialble
+fn determine_remote_url(version: &Version, hooks: Option<&ToolHooks<Npm>>) -> Fallible<String> {
+    let version_str = version.to_string();
+    match hooks {
+        Some(&ToolHooks {
+            distro: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using npm.distro hook to determine download URL");
+            let distro_file_name = Npm::archive_filename(&version_str);
+            hook.resolve(version, &distro_file_name)
+        }
+        _ => Ok(public_registry_package("npm", &version_str)),
+    }
+}
+
+/// Fetch the distro archive from the internet
+fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path,
+) -> Fallible<Box<dyn Archive>> {
+    debug!("Downloading {} from {}", tool_version("npm", version), url);
+    Tarball::fetch(url, staging_path).with_context(download_tool_error(
+        tool::Spec::Npm(VersionSpec::Exact(version.clone())),
+        url,
+    ))
+}
+
+/// Overwrite the launcher script
+fn overwrite_launcher(base_path: &Path, tool: &str) -> Fallible<()> {
+    let path = base_path.join(tool);
+    write(
+        &path,
+        // Note: Adapted from the existing npm/npx launcher, without unnecessary detection of Node location
+        format!(
+            r#"#!/bin/sh
+(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
+
+basedir=`dirname "$0"`
+
+case `uname` in
+    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+node "$basedir/{}-cli.js" "$@"
+"#,
+            tool
+        ),
+    )
+    .and_then(|_| set_executable(&path))
+    .with_context(|| ErrorKind::WriteLauncherError { tool: tool.into() })
+}
+
+/// Overwrite the CMD launcher
+#[cfg(windows)]
+fn overwrite_cmd_launcher(base_path: &Path, tool: &str) -> Fallible<()> {
+    write(
+        base_path.join(format!("{}.cmd", tool)),
+        // Note: Adapted from the existing npm/npx cmd launcher, without unnecessary detection of Node location
+        format!(
+            r#"@ECHO OFF
+
+node "%~dp0\{}-cli.js" %*
+"#,
+            tool
+        ),
+    )
+    .with_context(|| ErrorKind::WriteLauncherError { tool: tool.into() })
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/npm/mod.rs.html b/main/src/volta_core/tool/npm/mod.rs.html new file mode 100644 index 000000000..b8822e3f7 --- /dev/null +++ b/main/src/volta_core/tool/npm/mod.rs.html @@ -0,0 +1,387 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+
use std::fmt::{self, Display};
+
+use super::node::load_default_npm_version;
+use super::{
+    check_fetched, check_shim_reachable, debug_already_fetched, info_fetched, info_installed,
+    info_pinned, info_project_version, FetchStatus, Tool,
+};
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::inventory::npm_available;
+use crate::session::Session;
+use crate::style::{success_prefix, tool_version};
+use crate::sync::VoltaLock;
+use log::info;
+use node_semver::Version;
+
+mod fetch;
+mod resolve;
+
+pub use resolve::resolve;
+
+/// The Tool implementation for fetching and installing npm
+pub struct Npm {
+    pub(super) version: Version,
+}
+
+impl Npm {
+    pub fn new(version: Version) -> Self {
+        Npm { version }
+    }
+
+    pub fn archive_basename(version: &str) -> String {
+        format!("npm-{}", version)
+    }
+
+    pub fn archive_filename(version: &str) -> String {
+        format!("{}.tgz", Npm::archive_basename(version))
+    }
+
+    pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<()> {
+        match check_fetched(|| npm_available(&self.version))? {
+            FetchStatus::AlreadyFetched => {
+                debug_already_fetched(self);
+                Ok(())
+            }
+            FetchStatus::FetchNeeded(_lock) => fetch::fetch(&self.version, session.hooks()?.npm()),
+        }
+    }
+}
+
+impl Tool for Npm {
+    fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        self.ensure_fetched(session)?;
+
+        info_fetched(self);
+        Ok(())
+    }
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        // Acquire a lock on the Volta directory, if possible, to prevent concurrent changes
+        let _lock = VoltaLock::acquire();
+        self.ensure_fetched(session)?;
+
+        session
+            .toolchain_mut()?
+            .set_active_npm(Some(self.version.clone()))?;
+
+        info_installed(&self);
+        check_shim_reachable("npm");
+
+        if let Ok(Some(project)) = session.project_platform() {
+            if let Some(npm) = &project.npm {
+                info_project_version(tool_version("npm", npm), &self);
+            }
+        }
+        Ok(())
+    }
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        if session.project()?.is_some() {
+            self.ensure_fetched(session)?;
+
+            // Note: We know this will succeed, since we checked above
+            let project = session.project_mut()?.unwrap();
+            project.pin_npm(Some(self.version.clone()))?;
+
+            info_pinned(self);
+            Ok(())
+        } else {
+            Err(ErrorKind::NotInPackage.into())
+        }
+    }
+}
+
+impl Display for Npm {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(&tool_version("npm", &self.version))
+    }
+}
+
+/// The Tool implementation for setting npm to the version bundled with Node
+pub struct BundledNpm;
+
+impl Tool for BundledNpm {
+    fn fetch(self: Box<Self>, _session: &mut Session) -> Fallible<()> {
+        info!("Bundled npm is included with Node, use `volta fetch node` to fetch Node");
+        Ok(())
+    }
+
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        let toolchain = session.toolchain_mut()?;
+
+        toolchain.set_active_npm(None)?;
+
+        let bundled_version = match toolchain.platform() {
+            Some(platform) => {
+                let version = load_default_npm_version(&platform.node).with_context(|| {
+                    ErrorKind::NoBundledNpm {
+                        command: "install".into(),
+                    }
+                })?;
+                version.to_string()
+            }
+            None => {
+                return Err(ErrorKind::NoBundledNpm {
+                    command: "install".into(),
+                }
+                .into());
+            }
+        };
+
+        info!(
+            "{} set bundled npm (currently {}) as default",
+            success_prefix(),
+            bundled_version
+        );
+
+        Ok(())
+    }
+
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        match session.project_mut()? {
+            Some(project) => {
+                project.pin_npm(None)?;
+
+                let bundled_version = match project.platform() {
+                    Some(platform) => {
+                        let version =
+                            load_default_npm_version(&platform.node).with_context(|| {
+                                ErrorKind::NoBundledNpm {
+                                    command: "pin".into(),
+                                }
+                            })?;
+                        version.to_string()
+                    }
+                    None => {
+                        return Err(ErrorKind::NoBundledNpm {
+                            command: "pin".into(),
+                        }
+                        .into());
+                    }
+                };
+
+                info!(
+                    "{} set package.json to use bundled npm (currently {})",
+                    success_prefix(),
+                    bundled_version
+                );
+
+                Ok(())
+            }
+            None => Err(ErrorKind::NotInPackage.into()),
+        }
+    }
+}
+
+impl Display for BundledNpm {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(&tool_version("npm", "bundled"))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_npm_archive_basename() {
+        assert_eq!(Npm::archive_basename("1.2.3"), "npm-1.2.3");
+    }
+
+    #[test]
+    fn test_npm_archive_filename() {
+        assert_eq!(Npm::archive_filename("1.2.3"), "npm-1.2.3.tgz");
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/npm/resolve.rs.html b/main/src/volta_core/tool/npm/resolve.rs.html new file mode 100644 index 000000000..1a75d01a7 --- /dev/null +++ b/main/src/volta_core/tool/npm/resolve.rs.html @@ -0,0 +1,157 @@ +resolve.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+
//! Provides resolution of npm Version requirements into specific versions
+
+use super::super::registry::{
+    fetch_npm_registry, public_registry_index, PackageDetails, PackageIndex,
+};
+use crate::error::{ErrorKind, Fallible};
+use crate::hook::ToolHooks;
+use crate::session::Session;
+use crate::tool::Npm;
+use crate::version::{VersionSpec, VersionTag};
+use log::debug;
+use node_semver::{Range, Version};
+
+pub fn resolve(matching: VersionSpec, session: &mut Session) -> Fallible<Option<Version>> {
+    let hooks = session.hooks()?.npm();
+    match matching {
+        VersionSpec::Semver(requirement) => resolve_semver(requirement, hooks).map(Some),
+        VersionSpec::Exact(version) => Ok(Some(version)),
+        VersionSpec::None | VersionSpec::Tag(VersionTag::Latest) => {
+            resolve_tag("latest", hooks).map(Some)
+        }
+        VersionSpec::Tag(VersionTag::Custom(tag)) if tag == "bundled" => Ok(None),
+        VersionSpec::Tag(tag) => resolve_tag(&tag.to_string(), hooks).map(Some),
+    }
+}
+
+fn fetch_npm_index(hooks: Option<&ToolHooks<Npm>>) -> Fallible<(String, PackageIndex)> {
+    let url = match hooks {
+        Some(&ToolHooks {
+            index: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using npm.index hook to determine npm index URL");
+            hook.resolve("npm")?
+        }
+        _ => public_registry_index("npm"),
+    };
+
+    fetch_npm_registry(url, "npm")
+}
+
+fn resolve_tag(tag: &str, hooks: Option<&ToolHooks<Npm>>) -> Fallible<Version> {
+    let (url, mut index) = fetch_npm_index(hooks)?;
+
+    match index.tags.remove(tag) {
+        Some(version) => {
+            debug!("Found npm@{} matching tag '{}' from {}", version, tag, url);
+            Ok(version)
+        }
+        None => Err(ErrorKind::NpmVersionNotFound {
+            matching: tag.into(),
+        }
+        .into()),
+    }
+}
+
+fn resolve_semver(matching: Range, hooks: Option<&ToolHooks<Npm>>) -> Fallible<Version> {
+    let (url, index) = fetch_npm_index(hooks)?;
+
+    let details_opt = index
+        .entries
+        .into_iter()
+        .find(|PackageDetails { version, .. }| matching.satisfies(version));
+
+    match details_opt {
+        Some(details) => {
+            debug!(
+                "Found npm@{} matching requirement '{}' from {}",
+                details.version, matching, url
+            );
+            Ok(details.version)
+        }
+        None => Err(ErrorKind::NpmVersionNotFound {
+            matching: matching.to_string(),
+        }
+        .into()),
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/package/configure.rs.html b/main/src/volta_core/tool/package/configure.rs.html new file mode 100644 index 000000000..0e8e752b8 --- /dev/null +++ b/main/src/volta_core/tool/package/configure.rs.html @@ -0,0 +1,179 @@ +configure.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+
use std::path::PathBuf;
+
+use super::manager::PackageManager;
+use super::metadata::{BinConfig, PackageConfig, PackageManifest};
+use crate::error::{ErrorKind, Fallible};
+use crate::layout::volta_home;
+use crate::platform::{Image, PlatformSpec};
+use crate::shim;
+use crate::tool::check_shim_reachable;
+
+/// Read the manifest for the package being installed
+pub(super) fn parse_manifest(
+    package_name: &str,
+    staging_dir: PathBuf,
+    manager: PackageManager,
+) -> Fallible<PackageManifest> {
+    let mut package_dir = manager.source_dir(staging_dir);
+    package_dir.push(package_name);
+
+    PackageManifest::for_dir(package_name, &package_dir)
+}
+
+/// Generate configuration files and shims for the package and each of its bins
+pub(super) fn write_config_and_shims(
+    name: &str,
+    manifest: &PackageManifest,
+    image: &Image,
+    manager: PackageManager,
+) -> Fallible<()> {
+    validate_bins(name, manifest)?;
+
+    let platform = PlatformSpec {
+        node: image.node.value.clone(),
+        npm: image.npm.clone().map(|s| s.value),
+        pnpm: image.pnpm.clone().map(|s| s.value),
+        yarn: image.yarn.clone().map(|s| s.value),
+    };
+
+    // Generate the shims and bin configs for each bin provided by the package
+    for bin_name in &manifest.bin {
+        shim::create(bin_name)?;
+        check_shim_reachable(bin_name);
+
+        BinConfig {
+            name: bin_name.clone(),
+            package: name.into(),
+            version: manifest.version.clone(),
+            platform: platform.clone(),
+            manager,
+        }
+        .write()?;
+    }
+
+    // Write the config for the package
+    PackageConfig {
+        name: name.into(),
+        version: manifest.version.clone(),
+        platform,
+        bins: manifest.bin.clone(),
+        manager,
+    }
+    .write()?;
+
+    Ok(())
+}
+
+/// Validate that we aren't attempting to install a bin that is already installed by
+/// another package.
+fn validate_bins(package_name: &str, manifest: &PackageManifest) -> Fallible<()> {
+    let home = volta_home()?;
+    for bin_name in &manifest.bin {
+        // Check for name conflicts with already-installed bins
+        // Some packages may install bins with the same name
+        if let Ok(config) = BinConfig::from_file(home.default_tool_bin_config(bin_name)) {
+            // The file exists, so there is a bin with this name
+            // That is okay iff it came from the package that is currently being installed
+            if package_name != config.package {
+                return Err(ErrorKind::BinaryAlreadyInstalled {
+                    bin_name: bin_name.into(),
+                    existing_package: config.package,
+                    new_package: package_name.into(),
+                }
+                .into());
+            }
+        }
+    }
+
+    Ok(())
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/package/install.rs.html b/main/src/volta_core/tool/package/install.rs.html new file mode 100644 index 000000000..b31a760d8 --- /dev/null +++ b/main/src/volta_core/tool/package/install.rs.html @@ -0,0 +1,117 @@ +install.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
use std::path::PathBuf;
+
+use super::manager::PackageManager;
+use crate::command::create_command;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::platform::Image;
+use crate::style::progress_spinner;
+use log::debug;
+
+/// Use `npm install --global` to install the package
+///
+/// Sets the environment variable `npm_config_prefix` to redirect the install to the Volta
+/// data directory, taking advantage of the standard global install behavior with a custom
+/// location
+pub(super) fn run_global_install(
+    package: String,
+    staging_dir: PathBuf,
+    platform_image: &Image,
+) -> Fallible<()> {
+    let mut command = create_command("npm");
+    command.args([
+        "install",
+        "--global",
+        "--loglevel=warn",
+        "--no-update-notifier",
+        "--no-audit",
+    ]);
+    command.arg(&package);
+    command.env("PATH", platform_image.path()?);
+    PackageManager::Npm.setup_global_command(&mut command, staging_dir);
+
+    debug!("Installing {} with command: {:?}", package, command);
+    let spinner = progress_spinner(format!("Installing {}", package));
+    let output_result = command
+        .output()
+        .with_context(|| ErrorKind::PackageInstallFailed {
+            package: package.clone(),
+        });
+    spinner.finish_and_clear();
+    let output = output_result?;
+
+    let stderr = String::from_utf8_lossy(&output.stderr);
+    debug!("[install stderr]\n{}", stderr);
+    debug!(
+        "[install stdout]\n{}",
+        String::from_utf8_lossy(&output.stdout)
+    );
+
+    if output.status.success() {
+        Ok(())
+    } else if stderr.contains("code E404") {
+        // npm outputs "code E404" as part of the error output when a package couldn't be found
+        // Detect that and show a nicer error message (since we likely know the problem in that case)
+        Err(ErrorKind::PackageNotFound { package }.into())
+    } else {
+        Err(ErrorKind::PackageInstallFailed { package }.into())
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/package/manager.rs.html b/main/src/volta_core/tool/package/manager.rs.html new file mode 100644 index 000000000..cf25755cd --- /dev/null +++ b/main/src/volta_core/tool/package/manager.rs.html @@ -0,0 +1,429 @@ +manager.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+
use std::ffi::OsStr;
+use std::fs::File;
+use std::path::{Path, PathBuf};
+use std::process::Command;
+
+use super::metadata::GlobalYarnManifest;
+use crate::fs::read_dir_eager;
+
+/// The package manager used to install a given package
+#[derive(
+    Copy, Clone, serde::Serialize, serde::Deserialize, PartialOrd, Ord, PartialEq, Eq, Debug,
+)]
+pub enum PackageManager {
+    Npm,
+    Pnpm,
+    Yarn,
+}
+
+impl PackageManager {
+    /// Given the `package_root`, returns the directory where the source is stored for this
+    /// package manager. This will include the top-level `node_modules`, where appropriate.
+    pub fn source_dir(self, package_root: PathBuf) -> PathBuf {
+        let mut path = self.source_root(package_root);
+        path.push("node_modules");
+
+        path
+    }
+
+    /// Given the `package_root`, returns the root of the source directory. This directory will
+    /// contain the top-level `node-modules`
+    #[cfg(unix)]
+    pub fn source_root(self, package_root: PathBuf) -> PathBuf {
+        let mut path = package_root;
+        match self {
+            // On Unix, the source is always within a `lib` subdirectory, with both npm and Yarn
+            PackageManager::Npm | PackageManager::Yarn => path.push("lib"),
+            // pnpm puts the source node_modules directory in the global-dir
+            // plus a versioned subdirectory.
+            // FIXME: Here the subdirectory is hard-coded, I don't know if it's
+            // possible to retrieve it from pnpm dynamically.
+            PackageManager::Pnpm => path.push("5"),
+        }
+
+        path
+    }
+
+    /// Given the `package_root`, returns the root of the source directory. This directory will
+    /// contain the top-level `node-modules`
+    #[cfg(windows)]
+    pub fn source_root(self, package_root: PathBuf) -> PathBuf {
+        match self {
+            // On Windows, npm puts the source node_modules directory in the root of the `prefix`
+            PackageManager::Npm => package_root,
+            // On Windows, we still tell yarn to use the `lib` subdirectory
+            PackageManager::Yarn => {
+                let mut path = package_root;
+                path.push("lib");
+                path
+            }
+            // pnpm puts the source node_modules directory in the global-dir
+            // plus a versioned subdirectory.
+            // FIXME: Here the subdirectory is hard-coded, I don't know if it's
+            // possible to retrieve it from pnpm dynamically.
+            PackageManager::Pnpm => {
+                let mut path = package_root;
+                path.push("5");
+                path
+            }
+        }
+    }
+
+    /// Given the `package_root`, returns the directory where binaries are stored for this package
+    /// manager.
+    #[cfg(unix)]
+    pub fn binary_dir(self, package_root: PathBuf) -> PathBuf {
+        // On Unix, the binaries are always within a `bin` subdirectory for both npm and Yarn
+        let mut path = package_root;
+        path.push("bin");
+
+        path
+    }
+
+    /// Given the `package_root`, returns the directory where binaries are stored for this package
+    /// manager.
+    #[cfg(windows)]
+    pub fn binary_dir(self, package_root: PathBuf) -> PathBuf {
+        match self {
+            // On Windows, npm leaves the binaries at the root of the `prefix` directory
+            PackageManager::Npm => package_root,
+            // On Windows, Yarn still includes the `bin` subdirectory. pnpm by
+            // default generates binaries into the `PNPM_HOME` path
+            PackageManager::Yarn | PackageManager::Pnpm => {
+                let mut path = package_root;
+                path.push("bin");
+                path
+            }
+        }
+    }
+
+    /// Modify a given `Command` to be set up for global installs, given the package root
+    pub fn setup_global_command(self, command: &mut Command, package_root: PathBuf) {
+        command.env("npm_config_prefix", &package_root);
+
+        if let PackageManager::Yarn = self {
+            command.env("npm_config_global_folder", self.source_root(package_root));
+        } else if let PackageManager::Pnpm = self {
+            // FIXME: Find out if there is a perfect way to intercept pnpm global
+            // installs by using environment variables or whatever.
+            // Using `--global-dir` and `--global-bin-dir` flags here is not enough,
+            // because pnpm generates _absolute path_ based symlinks, and this makes
+            // impossible to simply move installed packages from the staging directory
+            // to the final `image/packages/` destination.
+
+            // Specify the staging directory to store global package,
+            // see: https://pnpm.io/npmrc#global-dir
+            command.arg("--global-dir").arg(&package_root);
+            // Specify the staging directory for the bin files of globally installed packages.
+            // See: https://pnpm.io/npmrc#global-bin-dir (>= 6.15.0)
+            // and https://github.com/volta-cli/rfcs/pull/46#discussion_r933296625
+            let global_bin_dir = self.binary_dir(package_root);
+            command.arg("--global-bin-dir").arg(&global_bin_dir);
+            // pnpm requires the `global-bin-dir` to be in PATH, otherwise it
+            // will not trigger global installs. One can also use the `PNPM_HOME`
+            // environment variable, which is only available in pnpm v7+, to
+            // pass the check.
+            // See: https://github.com/volta-cli/rfcs/pull/46#discussion_r861943740
+            let mut new_path = global_bin_dir;
+            for (name, value) in command.get_envs() {
+                if name == "PATH" {
+                    if let Some(old_path) = value {
+                        #[cfg(unix)]
+                        let path_delimiter = OsStr::new(":");
+                        #[cfg(windows)]
+                        let path_delimiter = OsStr::new(";");
+                        new_path =
+                            PathBuf::from([new_path.as_os_str(), old_path].join(path_delimiter));
+                        break;
+                    }
+                }
+            }
+            command.env("PATH", new_path);
+        }
+    }
+
+    /// Determine the name of the package that was installed into the `package_root`
+    ///
+    /// If there are none or more than one package installed, then we return None
+    pub(super) fn get_installed_package(self, package_root: PathBuf) -> Option<String> {
+        match self {
+            PackageManager::Npm => get_npm_package_name(self.source_dir(package_root)),
+            PackageManager::Pnpm | PackageManager::Yarn => {
+                get_pnpm_or_yarn_package_name(self.source_root(package_root))
+            }
+        }
+    }
+}
+
+/// Determine the package name for an npm global install
+///
+/// npm doesn't hoist the packages inside of `node_modules`, so the only directory will be the
+/// globally installed package.
+fn get_npm_package_name(mut source_dir: PathBuf) -> Option<String> {
+    let possible_name = get_single_directory_name(&source_dir)?;
+
+    // If the directory starts with `@`, that represents a scoped package, so we need to step
+    // a level deeper to determine the full package name (`@scope/package`)
+    if possible_name.starts_with('@') {
+        source_dir.push(&possible_name);
+        let package = get_single_directory_name(&source_dir)?;
+        Some(format!("{}/{}", possible_name, package))
+    } else {
+        Some(possible_name)
+    }
+}
+
+/// Return the name of the single subdirectory (if any) to the given `parent_dir`
+///
+/// If there are more than one subdirectory, then this will return `None`
+fn get_single_directory_name(parent_dir: &Path) -> Option<String> {
+    let mut entries = read_dir_eager(parent_dir)
+        .ok()?
+        .filter_map(|(entry, metadata)| {
+            // If the entry is a symlink, _both_ is_dir() _and_ is_file() will be false. We want to
+            // include symlinks as well as directories in our search, since `npm link` uses
+            // symlinks internally, so we only exclude files from this search
+            if !metadata.is_file() {
+                Some(entry)
+            } else {
+                None
+            }
+        });
+
+    match (entries.next(), entries.next()) {
+        (Some(entry), None) => entry.file_name().into_string().ok(),
+        _ => None,
+    }
+}
+
+/// Determine the package name for a pnpm or Yarn global install
+///
+/// pnpm/Yarn creates a `package.json` file with the globally installed package as a dependency
+fn get_pnpm_or_yarn_package_name(source_root: PathBuf) -> Option<String> {
+    let package_file = source_root.join("package.json");
+    let file = File::open(package_file).ok()?;
+    let manifest: GlobalYarnManifest = serde_json::de::from_reader(file).ok()?;
+    let mut dependencies = manifest.dependencies.into_iter();
+
+    match (dependencies.next(), dependencies.next()) {
+        // If there is exactly one dependency, we return it
+        (Some((key, _)), None) => Some(key),
+        // Otherwise, we can't determine the package name
+        _ => None,
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/package/metadata.rs.html b/main/src/volta_core/tool/package/metadata.rs.html new file mode 100644 index 000000000..0d47be6bf --- /dev/null +++ b/main/src/volta_core/tool/package/metadata.rs.html @@ -0,0 +1,647 @@ +metadata.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+
use std::collections::HashMap;
+use std::fs::File;
+use std::io;
+use std::path::Path;
+
+use super::manager::PackageManager;
+use crate::error::{Context, ErrorKind, Fallible, VoltaError};
+use crate::layout::volta_home;
+use crate::platform::PlatformSpec;
+use crate::version::{option_version_serde, version_serde};
+use fs_utils::ensure_containing_dir_exists;
+use node_semver::Version;
+
+/// Configuration information about an installed package
+///
+/// Will be stored in `<VOLTA_HOME>/tools/user/packages/<package>.json`
+#[derive(serde::Serialize, serde::Deserialize, PartialOrd, Ord, PartialEq, Eq)]
+pub struct PackageConfig {
+    /// The package name
+    pub name: String,
+    /// The package version
+    #[serde(with = "version_serde")]
+    pub version: Version,
+    /// The platform used to install this package
+    #[serde(with = "RawPlatformSpec")]
+    pub platform: PlatformSpec,
+    /// The binaries installed by this package
+    pub bins: Vec<String>,
+    /// The package manager that was used to install this package
+    pub manager: PackageManager,
+}
+
+impl PackageConfig {
+    /// Parse a `PackageConfig` instance from a config file
+    pub fn from_file<P>(file: P) -> Fallible<Self>
+    where
+        P: AsRef<Path>,
+    {
+        let config = File::open(&file).with_context(|| ErrorKind::ReadPackageConfigError {
+            file: file.as_ref().to_owned(),
+        })?;
+        serde_json::from_reader(config).with_context(|| ErrorKind::ParsePackageConfigError)
+    }
+
+    pub fn from_file_if_exists<P>(file: P) -> Fallible<Option<Self>>
+    where
+        P: AsRef<Path>,
+    {
+        match File::open(&file) {
+            Err(error) => {
+                if error.kind() == io::ErrorKind::NotFound {
+                    Ok(None)
+                } else {
+                    Err(VoltaError::from_source(
+                        error,
+                        ErrorKind::ReadPackageConfigError {
+                            file: file.as_ref().to_owned(),
+                        },
+                    ))
+                }
+            }
+            Ok(config) => serde_json::from_reader(config)
+                .with_context(|| ErrorKind::ParsePackageConfigError)
+                .map(Some),
+        }
+    }
+
+    /// Write this `PackageConfig` into the appropriate config file
+    pub fn write(self) -> Fallible<()> {
+        let config_file_path = volta_home()?.default_package_config_file(&self.name);
+
+        ensure_containing_dir_exists(&config_file_path).with_context(|| {
+            ErrorKind::ContainingDirError {
+                path: config_file_path.clone(),
+            }
+        })?;
+
+        let file = File::create(&config_file_path).with_context(|| {
+            ErrorKind::WritePackageConfigError {
+                file: config_file_path,
+            }
+        })?;
+        serde_json::to_writer_pretty(file, &self)
+            .with_context(|| ErrorKind::StringifyPackageConfigError)
+    }
+}
+
+/// Configuration information about a single installed binary from a package
+///
+/// Will be stored in <VOLTA_HOME>/tools/user/bins/<bin-name>.json
+#[derive(serde::Serialize, serde::Deserialize)]
+pub struct BinConfig {
+    /// The binary name
+    pub name: String,
+    /// The package that installed the binary
+    pub package: String,
+    /// The package version
+    #[serde(with = "version_serde")]
+    pub version: Version,
+    /// The platform used to install this binary
+    #[serde(with = "RawPlatformSpec")]
+    pub platform: PlatformSpec,
+    /// The package manager used to install this binary
+    pub manager: PackageManager,
+}
+
+impl BinConfig {
+    /// Parse a `BinConfig` instance from the given config file
+    pub fn from_file<P>(file: P) -> Fallible<Self>
+    where
+        P: AsRef<Path>,
+    {
+        let config = File::open(&file).with_context(|| ErrorKind::ReadBinConfigError {
+            file: file.as_ref().to_owned(),
+        })?;
+        serde_json::from_reader(config).with_context(|| ErrorKind::ParseBinConfigError)
+    }
+
+    pub fn from_file_if_exists<P>(file: P) -> Fallible<Option<Self>>
+    where
+        P: AsRef<Path>,
+    {
+        match File::open(&file) {
+            Err(error) => {
+                if error.kind() == io::ErrorKind::NotFound {
+                    Ok(None)
+                } else {
+                    Err(VoltaError::from_source(
+                        error,
+                        ErrorKind::ReadBinConfigError {
+                            file: file.as_ref().to_owned(),
+                        },
+                    ))
+                }
+            }
+            Ok(config) => serde_json::from_reader(config)
+                .with_context(|| ErrorKind::ParseBinConfigError)
+                .map(Some),
+        }
+    }
+
+    /// Write this `BinConfig` to the appropriate config file
+    pub fn write(self) -> Fallible<()> {
+        let config_file_path = volta_home()?.default_tool_bin_config(&self.name);
+
+        ensure_containing_dir_exists(&config_file_path).with_context(|| {
+            ErrorKind::ContainingDirError {
+                path: config_file_path.clone(),
+            }
+        })?;
+
+        let file =
+            File::create(&config_file_path).with_context(|| ErrorKind::WriteBinConfigError {
+                file: config_file_path,
+            })?;
+        serde_json::to_writer_pretty(file, &self)
+            .with_context(|| ErrorKind::StringifyBinConfigError)
+    }
+}
+
+#[derive(serde::Serialize, serde::Deserialize)]
+#[serde(remote = "PlatformSpec")]
+struct RawPlatformSpec {
+    #[serde(with = "version_serde")]
+    node: Version,
+    #[serde(with = "option_version_serde")]
+    npm: Option<Version>,
+    // The magic:
+    // `serde(default)` to assign the pnpm field with a default value, this
+    // ensures a seamless migration is performed from the previous package
+    // platformspec which did not have a pnpm field despite the same layout.v3
+    #[serde(default)]
+    #[serde(with = "option_version_serde")]
+    pnpm: Option<Version>,
+    #[serde(with = "option_version_serde")]
+    yarn: Option<Version>,
+}
+
+/// The relevant information we need out of a package's `package.json` file
+///
+/// This includes the exact Version (since we can install using a range)
+/// and the list of bins provided by the package.
+#[derive(serde::Deserialize)]
+pub struct PackageManifest {
+    /// The name of the package
+    pub name: String,
+    /// The version of the package
+    #[serde(deserialize_with = "version_serde::deserialize")]
+    pub version: Version,
+    /// The `bin` section, containing a map of binary names to locations
+    #[serde(default, deserialize_with = "serde_bins::deserialize")]
+    pub bin: Vec<String>,
+}
+
+impl PackageManifest {
+    /// Parse the `package.json` for a given package directory
+    pub fn for_dir(package: &str, package_root: &Path) -> Fallible<Self> {
+        let package_file = package_root.join("package.json");
+        let file =
+            File::open(package_file).with_context(|| ErrorKind::PackageManifestReadError {
+                package: package.into(),
+            })?;
+
+        let mut manifest: Self = serde_json::de::from_reader(file).with_context(|| {
+            ErrorKind::PackageManifestParseError {
+                package: package.into(),
+            }
+        })?;
+
+        // If the bin list contains only an empty string, that means `bin` was a string value,
+        // rather than a map. In that case, to match `npm`s behavior, we use the name of the package
+        // as the bin name.
+        // Note: For a scoped package, we should remove the scope and only use the package name
+        if manifest.bin == [""] {
+            manifest.bin.pop();
+            manifest.bin.push(default_binary_name(&manifest.name));
+        }
+
+        Ok(manifest)
+    }
+}
+
+#[derive(serde::Deserialize)]
+/// Struct to read the `dependencies` out of Yarn's global manifest.
+///
+/// For global installs, yarn creates a `package.json` file in the `global-folder` and installs
+/// global packages as dependencies of that pseudo-package
+pub(super) struct GlobalYarnManifest {
+    #[serde(default)]
+    pub dependencies: HashMap<String, String>,
+}
+
+mod serde_bins {
+    use std::fmt;
+
+    use serde::de::{Deserializer, Error, MapAccess, Visitor};
+
+    pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
+    where
+        D: Deserializer<'de>,
+    {
+        deserializer.deserialize_any(BinMapVisitor)
+    }
+
+    struct BinMapVisitor;
+
+    impl<'de> Visitor<'de> for BinMapVisitor {
+        type Value = Vec<String>;
+
+        fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+            f.write_str("string or map")
+        }
+
+        // Handle String values with only the path
+        fn visit_str<E>(self, _path: &str) -> Result<Self::Value, E>
+        where
+            E: Error,
+        {
+            // Use an empty string as a placeholder for the binary name, since at this level we
+            // don't know the binary name for sure (npm uses the package name in this case)
+            Ok(vec![String::new()])
+        }
+
+        // Handle maps of Name -> Path
+        fn visit_map<M>(self, mut access: M) -> Result<Self::Value, M::Error>
+        where
+            M: MapAccess<'de>,
+        {
+            let mut bins = Vec::new();
+            while let Some((name, _)) = access.next_entry::<String, String>()? {
+                // Bin names that include path separators are invalid, as they would then point to
+                // other locations on the filesystem. To match the behavior of npm & Yarn, we
+                // filter those values out of the list of bins.
+                if !name.contains(&['/', '\\'][..]) {
+                    bins.push(name);
+                }
+            }
+            Ok(bins)
+        }
+    }
+}
+
+/// Determine the default binary name from the package name
+///
+/// For non-scoped packages, this is just the package name
+/// For scoped packages, to match the behavior of the package managers, we remove the scope and use
+/// only the package part, e.g. `@microsoft/rush` would have a default name of `rush`
+fn default_binary_name(package_name: &str) -> String {
+    if package_name.starts_with('@') {
+        let mut chars = package_name.chars();
+
+        loop {
+            match chars.next() {
+                Some('/') | None => break,
+                _ => {}
+            }
+        }
+
+        let name = chars.as_str();
+        if name.is_empty() {
+            package_name.to_string()
+        } else {
+            name.to_string()
+        }
+    } else {
+        package_name.to_string()
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::default_binary_name;
+
+    #[test]
+    fn default_binary_uses_full_name_if_unscoped() {
+        assert_eq!(default_binary_name("my-package"), "my-package");
+    }
+
+    #[test]
+    fn default_binary_removes_scope() {
+        assert_eq!(default_binary_name("@scope/my-package"), "my-package");
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/package/mod.rs.html b/main/src/volta_core/tool/package/mod.rs.html new file mode 100644 index 000000000..e45ddfd19 --- /dev/null +++ b/main/src/volta_core/tool/package/mod.rs.html @@ -0,0 +1,651 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+
use std::fmt::{self, Display};
+use std::fs::create_dir_all;
+use std::path::{Path, PathBuf};
+use std::process::Command;
+
+use super::Tool;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{remove_dir_if_exists, rename, symlink_dir};
+use crate::layout::volta_home;
+use crate::platform::{Image, PlatformSpec};
+use crate::session::Session;
+use crate::style::{success_prefix, tool_version};
+use crate::sync::VoltaLock;
+use crate::version::VersionSpec;
+use fs_utils::ensure_containing_dir_exists;
+use log::info;
+use tempfile::{tempdir_in, TempDir};
+
+mod configure;
+mod install;
+mod manager;
+mod metadata;
+mod uninstall;
+
+pub use manager::PackageManager;
+pub use metadata::{BinConfig, PackageConfig, PackageManifest};
+pub use uninstall::uninstall;
+
+/// The Tool implementation for installing 3rd-party global packages
+pub struct Package {
+    name: String,
+    version: VersionSpec,
+    staging: TempDir,
+}
+
+impl Package {
+    pub fn new(name: String, version: VersionSpec) -> Fallible<Self> {
+        let staging = setup_staging_directory(PackageManager::Npm, NeedsScope::No)?;
+
+        Ok(Package {
+            name,
+            version,
+            staging,
+        })
+    }
+
+    pub fn run_install(&self, platform_image: &Image) -> Fallible<()> {
+        install::run_global_install(
+            self.to_string(),
+            self.staging.path().to_owned(),
+            platform_image,
+        )
+    }
+
+    pub fn complete_install(self, image: &Image) -> Fallible<PackageManifest> {
+        let manager = PackageManager::Npm;
+        let manifest =
+            configure::parse_manifest(&self.name, self.staging.path().to_owned(), manager)?;
+
+        persist_install(&self.name, &self.version, self.staging.path())?;
+        link_package_to_shared_dir(&self.name, manager)?;
+        configure::write_config_and_shims(&self.name, &manifest, image, manager)?;
+
+        Ok(manifest)
+    }
+}
+
+impl Tool for Package {
+    fn fetch(self: Box<Self>, _session: &mut Session) -> Fallible<()> {
+        Err(ErrorKind::CannotFetchPackage {
+            package: self.to_string(),
+        }
+        .into())
+    }
+
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        let _lock = VoltaLock::acquire();
+
+        let default_image = session
+            .default_platform()?
+            .map(PlatformSpec::as_default)
+            .ok_or(ErrorKind::NoPlatform)?
+            .checkout(session)?;
+
+        self.run_install(&default_image)?;
+        let manifest = self.complete_install(&default_image)?;
+
+        let bins = manifest.bin.join(", ");
+
+        if bins.is_empty() {
+            info!(
+                "{} installed {}",
+                success_prefix(),
+                tool_version(manifest.name, manifest.version)
+            );
+        } else {
+            info!(
+                "{} installed {} with executables: {}",
+                success_prefix(),
+                tool_version(manifest.name, manifest.version),
+                bins
+            );
+        }
+
+        Ok(())
+    }
+
+    fn pin(self: Box<Self>, _session: &mut Session) -> Fallible<()> {
+        Err(ErrorKind::CannotPinPackage { package: self.name }.into())
+    }
+}
+
+impl Display for Package {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self.version {
+            VersionSpec::None => f.write_str(&self.name),
+            _ => f.write_str(&tool_version(&self.name, &self.version)),
+        }
+    }
+}
+
+/// Helper struct for direct installs through `npm i -g` or `yarn global add`
+///
+/// Provides methods to simplify installing into a staging directory and then moving that install
+/// into the proper location after it is complete.
+///
+/// Note: We don't always know the name of the package up-front, as the install could be from a
+/// tarball or a git coordinate. If we do know ahead of time, then we can skip looking it up
+pub struct DirectInstall {
+    staging: TempDir,
+    manager: PackageManager,
+    name: Option<String>,
+}
+
+impl DirectInstall {
+    pub fn new(manager: PackageManager) -> Fallible<Self> {
+        let staging = setup_staging_directory(manager, NeedsScope::No)?;
+
+        Ok(DirectInstall {
+            staging,
+            manager,
+            name: None,
+        })
+    }
+
+    pub fn with_name(manager: PackageManager, name: String) -> Fallible<Self> {
+        let staging = setup_staging_directory(manager, name.contains('/').into())?;
+
+        Ok(DirectInstall {
+            staging,
+            manager,
+            name: Some(name),
+        })
+    }
+
+    pub fn setup_command(&self, command: &mut Command) {
+        self.manager
+            .setup_global_command(command, self.staging.path().to_owned());
+    }
+
+    pub fn complete_install(self, image: &Image) -> Fallible<()> {
+        let DirectInstall {
+            staging,
+            name,
+            manager,
+        } = self;
+
+        let name = name
+            .or_else(|| manager.get_installed_package(staging.path().to_owned()))
+            .ok_or(ErrorKind::InstalledPackageNameError)?;
+        let manifest = configure::parse_manifest(&name, staging.path().to_owned(), manager)?;
+
+        persist_install(&name, &manifest.version, staging.path())?;
+        link_package_to_shared_dir(&name, manager)?;
+        configure::write_config_and_shims(&name, &manifest, image, manager)
+    }
+}
+
+/// Helper struct for direct in-place upgrades using `npm update -g` or `yarn global upgrade`
+///
+/// Upgrades the requested package directly in the image directory
+pub struct InPlaceUpgrade {
+    package: String,
+    directory: PathBuf,
+    manager: PackageManager,
+}
+
+impl InPlaceUpgrade {
+    pub fn new(package: String, manager: PackageManager) -> Fallible<Self> {
+        let directory = volta_home()?.package_image_dir(&package);
+
+        Ok(Self {
+            package,
+            directory,
+            manager,
+        })
+    }
+
+    /// Check for possible failure cases with the package to be upgraded
+    ///     - The package is not installed as a global
+    ///     - The package exists, but was installed with a different package manager
+    pub fn check_upgraded_package(&self) -> Fallible<()> {
+        let config =
+            PackageConfig::from_file(volta_home()?.default_package_config_file(&self.package))
+                .with_context(|| ErrorKind::UpgradePackageNotFound {
+                    package: self.package.clone(),
+                    manager: self.manager,
+                })?;
+
+        if config.manager != self.manager {
+            Err(ErrorKind::UpgradePackageWrongManager {
+                package: self.package.clone(),
+                manager: config.manager,
+            }
+            .into())
+        } else {
+            Ok(())
+        }
+    }
+
+    pub fn setup_command(&self, command: &mut Command) {
+        self.manager
+            .setup_global_command(command, self.directory.clone());
+    }
+
+    pub fn complete_upgrade(self, image: &Image) -> Fallible<()> {
+        let manifest = configure::parse_manifest(&self.package, self.directory, self.manager)?;
+
+        link_package_to_shared_dir(&self.package, self.manager)?;
+        configure::write_config_and_shims(&self.package, &manifest, image, self.manager)
+    }
+}
+
+#[derive(Clone, Copy, PartialEq)]
+enum NeedsScope {
+    Yes,
+    No,
+}
+
+impl From<bool> for NeedsScope {
+    fn from(value: bool) -> Self {
+        if value {
+            NeedsScope::Yes
+        } else {
+            NeedsScope::No
+        }
+    }
+}
+
+/// Create the temporary staging directory we will use to install and ensure expected
+/// subdirectories exist within it
+fn setup_staging_directory(manager: PackageManager, needs_scope: NeedsScope) -> Fallible<TempDir> {
+    // Workaround to ensure relative symlinks continue to work.
+    // The final installed location of packages is:
+    //      $VOLTA_HOME/tools/image/packages/{name}/
+    // To ensure that the temp directory has the same amount of nesting, we use:
+    //      $VOLTA_HOME/tmp/image/packages/{tempdir}/
+    // This way any relative symlinks will have the same amount of nesting and will remain valid
+    // even when the directory is persisted.
+    // We also need to handle the case when the linked package has a scope, which requires another
+    // level of nesting
+    let mut staging_root = volta_home()?.tmp_dir().to_owned();
+    staging_root.push("image");
+    staging_root.push("packages");
+    if needs_scope == NeedsScope::Yes {
+        staging_root.push("scope");
+    }
+    create_dir_all(&staging_root).with_context(|| ErrorKind::ContainingDirError {
+        path: staging_root.clone(),
+    })?;
+    let staging = tempdir_in(&staging_root).with_context(|| ErrorKind::CreateTempDirError {
+        in_dir: staging_root,
+    })?;
+
+    let source_dir = manager.source_dir(staging.path().to_owned());
+    ensure_containing_dir_exists(&source_dir)
+        .with_context(|| ErrorKind::ContainingDirError { path: source_dir })?;
+
+    let binary_dir = manager.binary_dir(staging.path().to_owned());
+    ensure_containing_dir_exists(&binary_dir)
+        .with_context(|| ErrorKind::ContainingDirError { path: binary_dir })?;
+
+    Ok(staging)
+}
+
+fn persist_install<V>(package_name: &str, package_version: V, staging_dir: &Path) -> Fallible<()>
+where
+    V: Display,
+{
+    let package_dir = volta_home()?.package_image_dir(package_name);
+
+    remove_dir_if_exists(&package_dir)?;
+
+    // Handle scoped packages (@vue/cli), which have an extra directory for the scope
+    ensure_containing_dir_exists(&package_dir).with_context(|| ErrorKind::ContainingDirError {
+        path: package_dir.to_owned(),
+    })?;
+
+    rename(staging_dir, &package_dir).with_context(|| ErrorKind::SetupToolImageError {
+        tool: package_name.into(),
+        version: package_version.to_string(),
+        dir: package_dir,
+    })?;
+
+    Ok(())
+}
+
+fn link_package_to_shared_dir(package_name: &str, manager: PackageManager) -> Fallible<()> {
+    let home = volta_home()?;
+    let mut source = manager.source_dir(home.package_image_dir(package_name));
+    source.push(package_name);
+
+    let target = home.shared_lib_dir(package_name);
+
+    remove_dir_if_exists(&target)?;
+
+    // Handle scoped packages (@vue/cli), which have an extra directory for the scope
+    ensure_containing_dir_exists(&target).with_context(|| ErrorKind::ContainingDirError {
+        path: target.clone(),
+    })?;
+
+    symlink_dir(source, target).with_context(|| ErrorKind::CreateSharedLinkError {
+        name: package_name.into(),
+    })
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/package/uninstall.rs.html b/main/src/volta_core/tool/package/uninstall.rs.html new file mode 100644 index 000000000..1e1e19ddb --- /dev/null +++ b/main/src/volta_core/tool/package/uninstall.rs.html @@ -0,0 +1,235 @@ +uninstall.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+
use super::metadata::{BinConfig, PackageConfig};
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{
+    dir_entry_match, ok_if_not_found, read_dir_eager, remove_dir_if_exists, remove_file_if_exists,
+};
+use crate::layout::volta_home;
+use crate::shim;
+use crate::style::success_prefix;
+use crate::sync::VoltaLock;
+use log::{info, warn};
+
+/// Uninstalls the specified package.
+///
+/// This removes:
+///
+/// - The JSON configuration files for both the package and its bins
+/// - The shims for the package bins
+/// - The package directory itself
+pub fn uninstall(name: &str) -> Fallible<()> {
+    let home = volta_home()?;
+    // Acquire a lock on the Volta directory, if possible, to prevent concurrent changes
+    let _lock = VoltaLock::acquire();
+
+    // If the package config file exists, use that to remove any installed bins and shims
+    let package_config_file = home.default_package_config_file(name);
+
+    let package_found = match PackageConfig::from_file_if_exists(&package_config_file)? {
+        None => {
+            // there is no package config - check for orphaned binaries
+            let package_binary_list = binaries_from_package(name)?;
+            if !package_binary_list.is_empty() {
+                for bin_name in package_binary_list {
+                    remove_config_and_shim(&bin_name, name)?;
+                }
+                true
+            } else {
+                false
+            }
+        }
+        Some(package_config) => {
+            for bin_name in package_config.bins {
+                remove_config_and_shim(&bin_name, name)?;
+            }
+
+            remove_file_if_exists(package_config_file)?;
+            true
+        }
+    };
+
+    remove_shared_link_dir(name)?;
+
+    // Remove the package directory itself
+    let package_image_dir = home.package_image_dir(name);
+    remove_dir_if_exists(package_image_dir)?;
+
+    if package_found {
+        info!("{} package '{}' uninstalled", success_prefix(), name);
+    } else {
+        warn!("No package '{}' found to uninstall", name);
+    }
+
+    Ok(())
+}
+
+/// Remove a shim and its associated configuration file
+fn remove_config_and_shim(bin_name: &str, pkg_name: &str) -> Fallible<()> {
+    shim::delete(bin_name)?;
+    let config_file = volta_home()?.default_tool_bin_config(bin_name);
+    remove_file_if_exists(config_file)?;
+    info!(
+        "Removed executable '{}' installed by '{}'",
+        bin_name, pkg_name
+    );
+    Ok(())
+}
+
+/// Reads the contents of a directory and returns a Vec containing the names of
+/// all the binaries installed by the given package.
+fn binaries_from_package(package: &str) -> Fallible<Vec<String>> {
+    let bin_config_dir = volta_home()?.default_bin_dir();
+
+    dir_entry_match(bin_config_dir, |entry| {
+        let path = entry.path();
+        if let Ok(config) = BinConfig::from_file(path) {
+            if config.package == package {
+                return Some(config.name);
+            }
+        }
+        None
+    })
+    .or_else(ok_if_not_found)
+    .with_context(|| ErrorKind::ReadBinConfigDirError {
+        dir: bin_config_dir.to_owned(),
+    })
+}
+
+/// Remove the link to the package in the shared lib directory
+///
+/// For scoped packages, if the scope directory is now empty, it will also be removed
+fn remove_shared_link_dir(name: &str) -> Fallible<()> {
+    // Remove the link in the shared package directory, if it exists
+    let mut shared_lib_dir = volta_home()?.shared_lib_dir(name);
+    remove_dir_if_exists(&shared_lib_dir)?;
+
+    // For scoped packages, clean up the scope directory if it is now empty
+    if name.starts_with('@') {
+        shared_lib_dir.pop();
+
+        if let Ok(mut entries) = read_dir_eager(&shared_lib_dir) {
+            if entries.next().is_none() {
+                remove_dir_if_exists(&shared_lib_dir)?;
+            }
+        }
+    }
+
+    Ok(())
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/pnpm/fetch.rs.html b/main/src/volta_core/tool/pnpm/fetch.rs.html new file mode 100644 index 000000000..f24343e79 --- /dev/null +++ b/main/src/volta_core/tool/pnpm/fetch.rs.html @@ -0,0 +1,363 @@ +fetch.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+
//! Provides fetcher for pnpm distributions
+
+use std::fs::{write, File};
+use std::path::Path;
+
+use archive::{Archive, Tarball};
+use fs_utils::ensure_containing_dir_exists;
+use log::debug;
+use node_semver::Version;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{create_staging_dir, create_staging_file, rename, set_executable};
+use crate::hook::ToolHooks;
+use crate::layout::volta_home;
+use crate::style::{progress_bar, tool_version};
+use crate::tool::registry::public_registry_package;
+use crate::tool::{self, download_tool_error, Pnpm};
+use crate::version::VersionSpec;
+
+pub fn fetch(version: &Version, hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<()> {
+    let pnpm_dir = volta_home()?.pnpm_inventory_dir();
+    let cache_file = pnpm_dir.join(Pnpm::archive_filename(&version.to_string()));
+
+    let (archive, staging) = match load_cached_distro(&cache_file) {
+        Some(archive) => {
+            debug!(
+                "Loading {} from cached archive at '{}'",
+                tool_version("pnpm", version),
+                cache_file.display(),
+            );
+            (archive, None)
+        }
+        None => {
+            let staging = create_staging_file()?;
+            let remote_url = determine_remote_url(version, hooks)?;
+            let archive = fetch_remote_distro(version, &remote_url, staging.path())?;
+            (archive, Some(staging))
+        }
+    };
+
+    unpack_archive(archive, version)?;
+
+    if let Some(staging_file) = staging {
+        ensure_containing_dir_exists(&cache_file).with_context(|| {
+            ErrorKind::ContainingDirError {
+                path: cache_file.clone(),
+            }
+        })?;
+        staging_file
+            .persist(cache_file)
+            .with_context(|| ErrorKind::PersistInventoryError {
+                tool: "pnpm".into(),
+            })?;
+    }
+
+    Ok(())
+}
+
+/// Unpack the pnpm archive into the image directory so that it is ready for use
+fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<()> {
+    let temp = create_staging_dir()?;
+    debug!("Unpacking pnpm into '{}'", temp.path().display());
+
+    let progress = progress_bar(
+        archive.origin(),
+        &tool_version("pnpm", version),
+        archive.compressed_size(),
+    );
+    let version_string = version.to_string();
+
+    archive
+        .unpack(temp.path(), &mut |_, read| {
+            progress.inc(read as u64);
+        })
+        .with_context(|| ErrorKind::UnpackArchiveError {
+            tool: "pnpm".into(),
+            version: version_string.clone(),
+        })?;
+
+    let bin_path = temp.path().join("package").join("bin");
+    write_launcher(&bin_path, "pnpm")?;
+    write_launcher(&bin_path, "pnpx")?;
+
+    #[cfg(windows)]
+    {
+        write_cmd_launcher(&bin_path, "pnpm")?;
+        write_cmd_launcher(&bin_path, "pnpx")?;
+    }
+
+    let dest = volta_home()?.pnpm_image_dir(&version_string);
+    ensure_containing_dir_exists(&dest)
+        .with_context(|| ErrorKind::ContainingDirError { path: dest.clone() })?;
+
+    rename(temp.path().join("package"), &dest).with_context(|| ErrorKind::SetupToolImageError {
+        tool: "pnpm".into(),
+        version: version_string.clone(),
+        dir: dest.clone(),
+    })?;
+
+    progress.finish_and_clear();
+
+    // Note: We write this after the progress bar is finished to avoid display bugs with re-renders of the progress
+    debug!("Installing pnpm in '{}'", dest.display());
+
+    Ok(())
+}
+
+/// Return the archive if it is valid. It may have been corrupted or interrupted in the middle of
+/// downloading.
+// ISSUE(#134) - verify checksum
+fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>> {
+    if file.is_file() {
+        let file = File::open(file).ok()?;
+        Tarball::load(file).ok()
+    } else {
+        None
+    }
+}
+
+/// Determine the remote URL to download from, using the hooks if avaialble
+fn determine_remote_url(version: &Version, hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<String> {
+    let version_str = version.to_string();
+    match hooks {
+        Some(&ToolHooks {
+            distro: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using pnpm.distro hook to determine download URL");
+            let distro_file_name = Pnpm::archive_filename(&version_str);
+            hook.resolve(version, &distro_file_name)
+        }
+        _ => Ok(public_registry_package("pnpm", &version_str)),
+    }
+}
+
+/// Fetch the distro archive from the internet
+fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path,
+) -> Fallible<Box<dyn Archive>> {
+    debug!("Downloading {} from {}", tool_version("pnpm", version), url);
+    Tarball::fetch(url, staging_path).with_context(download_tool_error(
+        tool::Spec::Pnpm(VersionSpec::Exact(version.clone())),
+        url,
+    ))
+}
+
+/// Create executable launchers for the pnpm and pnpx binaries
+fn write_launcher(base_path: &Path, tool: &str) -> Fallible<()> {
+    let path = base_path.join(tool);
+    write(
+        &path,
+        format!(
+            r#"#!/bin/sh
+(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
+
+basedir=`dirname "$0"`
+
+case `uname` in
+    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+esac
+
+node "$basedir/{}.cjs" "$@"
+"#,
+            tool
+        ),
+    )
+    .and_then(|_| set_executable(&path))
+    .with_context(|| ErrorKind::WriteLauncherError { tool: tool.into() })
+}
+
+/// Create CMD executable launchers for the pnpm and pnpx binaries for Windows
+#[cfg(windows)]
+fn write_cmd_launcher(base_path: &Path, tool: &str) -> Fallible<()> {
+    write(
+        base_path.join(format!("{}.cmd", tool)),
+        format!("@echo off\nnode \"%~dp0\\{}.cjs\" %*", tool),
+    )
+    .with_context(|| ErrorKind::WriteLauncherError { tool: tool.into() })
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/pnpm/mod.rs.html b/main/src/volta_core/tool/pnpm/mod.rs.html new file mode 100644 index 000000000..c2ceb45c5 --- /dev/null +++ b/main/src/volta_core/tool/pnpm/mod.rs.html @@ -0,0 +1,225 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+
use node_semver::Version;
+use std::fmt::{self, Display};
+
+use crate::error::{ErrorKind, Fallible};
+use crate::inventory::pnpm_available;
+use crate::session::Session;
+use crate::style::tool_version;
+use crate::sync::VoltaLock;
+
+use super::{
+    check_fetched, check_shim_reachable, debug_already_fetched, info_fetched, info_installed,
+    info_pinned, info_project_version, FetchStatus, Tool,
+};
+
+mod fetch;
+mod resolve;
+
+pub use resolve::resolve;
+
+/// The Tool implementation for fetching and installing pnpm
+pub struct Pnpm {
+    pub(super) version: Version,
+}
+
+impl Pnpm {
+    pub fn new(version: Version) -> Self {
+        Pnpm { version }
+    }
+
+    pub fn archive_basename(version: &str) -> String {
+        format!("pnpm-{}", version)
+    }
+
+    pub fn archive_filename(version: &str) -> String {
+        format!("{}.tgz", Pnpm::archive_basename(version))
+    }
+
+    pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<()> {
+        match check_fetched(|| pnpm_available(&self.version))? {
+            FetchStatus::AlreadyFetched => {
+                debug_already_fetched(self);
+                Ok(())
+            }
+            FetchStatus::FetchNeeded(_lock) => fetch::fetch(&self.version, session.hooks()?.pnpm()),
+        }
+    }
+}
+
+impl Tool for Pnpm {
+    fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        self.ensure_fetched(session)?;
+
+        info_fetched(self);
+        Ok(())
+    }
+
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        // Acquire a lock on the Volta directory, if possible, to prevent concurrent changes
+        let _lock = VoltaLock::acquire();
+        self.ensure_fetched(session)?;
+
+        session
+            .toolchain_mut()?
+            .set_active_pnpm(Some(self.version.clone()))?;
+
+        info_installed(&self);
+        check_shim_reachable("pnpm");
+
+        if let Ok(Some(project)) = session.project_platform() {
+            if let Some(pnpm) = &project.pnpm {
+                info_project_version(tool_version("pnpm", pnpm), &self);
+            }
+        }
+        Ok(())
+    }
+
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        if session.project()?.is_some() {
+            self.ensure_fetched(session)?;
+
+            // Note: We know this will succeed, since we checked above
+            let project = session.project_mut()?.unwrap();
+            project.pin_pnpm(Some(self.version.clone()))?;
+
+            info_pinned(self);
+            Ok(())
+        } else {
+            Err(ErrorKind::NotInPackage.into())
+        }
+    }
+}
+
+impl Display for Pnpm {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(&tool_version("pnpm", &self.version))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_pnpm_archive_basename() {
+        assert_eq!(Pnpm::archive_basename("1.2.3"), "pnpm-1.2.3");
+    }
+
+    #[test]
+    fn test_pnpm_archive_filename() {
+        assert_eq!(Pnpm::archive_filename("1.2.3"), "pnpm-1.2.3.tgz");
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/pnpm/resolve.rs.html b/main/src/volta_core/tool/pnpm/resolve.rs.html new file mode 100644 index 000000000..7cb98ba01 --- /dev/null +++ b/main/src/volta_core/tool/pnpm/resolve.rs.html @@ -0,0 +1,147 @@ +resolve.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+
use log::debug;
+use node_semver::{Range, Version};
+
+use crate::error::{ErrorKind, Fallible};
+use crate::hook::ToolHooks;
+use crate::session::Session;
+use crate::tool::registry::{fetch_npm_registry, public_registry_index, PackageIndex};
+use crate::tool::{PackageDetails, Pnpm};
+use crate::version::{VersionSpec, VersionTag};
+
+pub fn resolve(matching: VersionSpec, session: &mut Session) -> Fallible<Version> {
+    let hooks = session.hooks()?.pnpm();
+    match matching {
+        VersionSpec::Semver(requirement) => resolve_semver(requirement, hooks),
+        VersionSpec::Exact(version) => Ok(version),
+        VersionSpec::None | VersionSpec::Tag(VersionTag::Latest) => resolve_tag("latest", hooks),
+        VersionSpec::Tag(tag) => resolve_tag(&tag.to_string(), hooks),
+    }
+}
+
+fn resolve_tag(tag: &str, hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<Version> {
+    let (url, mut index) = fetch_pnpm_index(hooks)?;
+
+    match index.tags.remove(tag) {
+        Some(version) => {
+            debug!("Found pnpm@{} matching tag '{}' from {}", version, tag, url);
+            Ok(version)
+        }
+        None => Err(ErrorKind::PnpmVersionNotFound {
+            matching: tag.into(),
+        }
+        .into()),
+    }
+}
+
+fn resolve_semver(matching: Range, hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<Version> {
+    let (url, index) = fetch_pnpm_index(hooks)?;
+
+    let details_opt = index
+        .entries
+        .into_iter()
+        .find(|PackageDetails { version, .. }| matching.satisfies(version));
+
+    match details_opt {
+        Some(details) => {
+            debug!(
+                "Found pnpm@{} matching requirement '{}' from {}",
+                details.version, matching, url
+            );
+            Ok(details.version)
+        }
+        None => Err(ErrorKind::PnpmVersionNotFound {
+            matching: matching.to_string(),
+        }
+        .into()),
+    }
+}
+
+/// Fetch the index of available pnpm versions from the npm registry
+fn fetch_pnpm_index(hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<(String, PackageIndex)> {
+    let url = match hooks {
+        Some(&ToolHooks {
+            index: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using pnpm.index hook to determine pnpm index URL");
+            hook.resolve("pnpm")?
+        }
+        _ => public_registry_index("pnpm"),
+    };
+
+    fetch_npm_registry(url, "pnpm")
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/registry.rs.html b/main/src/volta_core/tool/registry.rs.html new file mode 100644 index 000000000..316838e92 --- /dev/null +++ b/main/src/volta_core/tool/registry.rs.html @@ -0,0 +1,297 @@ +registry.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+
use std::collections::HashMap;
+use std::path::{Path, PathBuf};
+
+use super::registry_fetch_error;
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::read_dir_eager;
+use crate::style::progress_spinner;
+use crate::version::{hashmap_version_serde, version_serde};
+use attohttpc::header::ACCEPT;
+use attohttpc::Response;
+use cfg_if::cfg_if;
+use node_semver::Version;
+use serde::Deserialize;
+
+// Accept header needed to request the abbreviated metadata from the npm registry
+// See https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md
+pub const NPM_ABBREVIATED_ACCEPT_HEADER: &str =
+    "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*";
+
+cfg_if! {
+    if #[cfg(feature = "mock-network")] {
+        // TODO: We need to reconsider our mocking strategy in light of mockito deprecating the
+        // SERVER_URL constant: Since our acceptance tests run the binary in a separate process,
+        // we can't use `mockito::server_url()`, which relies on shared memory.
+        #[allow(deprecated)]
+        const SERVER_URL: &str = mockito::SERVER_URL;
+        pub fn public_registry_index(package: &str) -> String {
+            format!("{}/{}", SERVER_URL, package)
+        }
+    } else {
+        pub fn public_registry_index(package: &str) -> String {
+            format!("https://registry.npmjs.org/{}", package)
+        }
+    }
+}
+
+// fetch a registry that returns info in Npm format
+pub fn fetch_npm_registry(url: String, name: &str) -> Fallible<(String, PackageIndex)> {
+    let spinner = progress_spinner(format!("Fetching npm registry: {}", url));
+    let metadata: RawPackageMetadata = attohttpc::get(&url)
+        .header(ACCEPT, NPM_ABBREVIATED_ACCEPT_HEADER)
+        .send()
+        .and_then(Response::error_for_status)
+        .and_then(Response::json)
+        .with_context(registry_fetch_error(name, &url))?;
+
+    spinner.finish_and_clear();
+    Ok((url, metadata.into()))
+}
+
+pub fn public_registry_package(package: &str, version: &str) -> String {
+    format!(
+        "{}/-/{}-{}.tgz",
+        public_registry_index(package),
+        package,
+        version
+    )
+}
+
+// need package and filename for namespaced tools like @yarnpkg/cli-dist, which is located at
+//   https://registry.npmjs.org/@yarnpkg/cli-dist/-/cli-dist-1.2.3.tgz
+pub fn scoped_public_registry_package(scope: &str, package: &str, version: &str) -> String {
+    format!(
+        "{}/{}/-/{}-{}.tgz",
+        public_registry_index(scope),
+        package,
+        package,
+        version
+    )
+}
+
+/// Figure out the unpacked package directory name dynamically
+///
+/// Packages typically extract to a "package" directory, but not always
+pub fn find_unpack_dir(in_dir: &Path) -> Fallible<PathBuf> {
+    let dirs: Vec<_> = read_dir_eager(in_dir)
+        .with_context(|| ErrorKind::PackageUnpackError)?
+        .collect();
+
+    // if there is only one directory, return that
+    if let [(entry, metadata)] = dirs.as_slice() {
+        if metadata.is_dir() {
+            return Ok(entry.path());
+        }
+    }
+    // there is more than just a single directory here, something is wrong
+    Err(ErrorKind::PackageUnpackError.into())
+}
+
+/// Details about a package in the npm Registry
+#[derive(Debug)]
+pub struct PackageDetails {
+    pub(crate) version: Version,
+}
+
+/// Index of versions of a specific package from the npm Registry
+pub struct PackageIndex {
+    pub tags: HashMap<String, Version>,
+    pub entries: Vec<PackageDetails>,
+}
+
+/// Package Metadata Response
+///
+/// See npm registry API doc:
+/// https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md
+#[derive(Deserialize, Debug)]
+pub struct RawPackageMetadata {
+    pub name: String,
+    pub versions: HashMap<String, RawPackageVersionInfo>,
+    #[serde(
+        rename = "dist-tags",
+        deserialize_with = "hashmap_version_serde::deserialize"
+    )]
+    pub dist_tags: HashMap<String, Version>,
+}
+
+#[derive(Deserialize, Debug)]
+pub struct RawPackageVersionInfo {
+    // there's a lot more in there, but right now just care about the version
+    #[serde(with = "version_serde")]
+    pub version: Version,
+    pub dist: RawDistInfo,
+}
+
+#[derive(Deserialize, Clone, Debug)]
+pub struct RawDistInfo {
+    pub shasum: String,
+    pub tarball: String,
+}
+
+impl From<RawPackageMetadata> for PackageIndex {
+    fn from(serial: RawPackageMetadata) -> PackageIndex {
+        let mut entries: Vec<PackageDetails> = serial
+            .versions
+            .into_values()
+            .map(|version_info| PackageDetails {
+                version: version_info.version,
+            })
+            .collect();
+
+        entries.sort_by(|a, b| b.version.cmp(&a.version));
+
+        PackageIndex {
+            tags: serial.dist_tags,
+            entries,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/serial.rs.html b/main/src/volta_core/tool/serial.rs.html new file mode 100644 index 000000000..4a513e3ce --- /dev/null +++ b/main/src/volta_core/tool/serial.rs.html @@ -0,0 +1,1025 @@ +serial.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+
use std::cmp::Ordering;
+
+use super::Spec;
+use crate::error::{ErrorKind, Fallible};
+use crate::version::{VersionSpec, VersionTag};
+use once_cell::sync::Lazy;
+use regex::Regex;
+use validate_npm_package_name::{validate, Validity};
+
+static TOOL_SPEC_PATTERN: Lazy<Regex> = Lazy::new(|| {
+    Regex::new("^(?P<name>(?:@([^/]+?)[/])?([^/]+?))(@(?P<version>.+))?$").expect("regex is valid")
+});
+static HAS_VERSION: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[^\s]+@").expect("regex is valid"));
+
+/// Methods for parsing a Spec out of string values
+impl Spec {
+    pub fn from_str_and_version(tool_name: &str, version: VersionSpec) -> Self {
+        match tool_name {
+            "node" => Spec::Node(version),
+            "npm" => Spec::Npm(version),
+            "pnpm" => Spec::Pnpm(version),
+            "yarn" => Spec::Yarn(version),
+            package => Spec::Package(package.to_string(), version),
+        }
+    }
+
+    /// Try to parse a tool and version from a string like `<tool>[@<version>].
+    pub fn try_from_str(tool_spec: &str) -> Fallible<Self> {
+        let captures =
+            TOOL_SPEC_PATTERN
+                .captures(tool_spec)
+                .ok_or_else(|| ErrorKind::ParseToolSpecError {
+                    tool_spec: tool_spec.into(),
+                })?;
+
+        // Validate that the captured name is a valid NPM package name.
+        let name = &captures["name"];
+        if let Validity::Invalid { errors, .. } = validate(name) {
+            return Err(ErrorKind::InvalidToolName {
+                name: name.into(),
+                errors,
+            }
+            .into());
+        }
+
+        let version = captures
+            .name("version")
+            .map(|version| version.as_str().parse())
+            .transpose()?
+            .unwrap_or_default();
+
+        Ok(match name {
+            "node" => Spec::Node(version),
+            "npm" => Spec::Npm(version),
+            "pnpm" => Spec::Pnpm(version),
+            "yarn" => Spec::Yarn(version),
+            package => Spec::Package(package.into(), version),
+        })
+    }
+
+    /// Get a valid, sorted `Vec<Spec>` given a `Vec<String>`.
+    ///
+    /// Accounts for the following error conditions:
+    ///
+    /// - `volta install node 12`, where the user intended to install `node@12`
+    ///   but used syntax like in nodenv or nvm
+    /// - invalid version specs
+    ///
+    /// Returns a listed sorted so that if `node` is included in the list, it is
+    /// always first.
+    pub fn from_strings<T>(tool_strs: &[T], action: &str) -> Fallible<Vec<Spec>>
+    where
+        T: AsRef<str>,
+    {
+        Self::check_args(tool_strs, action)?;
+
+        let mut tools = tool_strs
+            .iter()
+            .map(|arg| Self::try_from_str(arg.as_ref()))
+            .collect::<Fallible<Vec<Spec>>>()?;
+
+        tools.sort_by(Self::sort_comparator);
+        Ok(tools)
+    }
+
+    /// Check the args for the bad patterns of
+    /// - `volta install <number>`
+    /// - `volta install <tool> <number>`
+    fn check_args<T>(args: &[T], action: &str) -> Fallible<()>
+    where
+        T: AsRef<str>,
+    {
+        let mut args = args.iter();
+
+        match (args.next(), args.next(), args.next()) {
+            // The case we are concerned with here is where we have `<number>`.
+            // That is, exactly one argument, which is a valid version specifier.
+            //
+            // - `volta install node@12` is allowed.
+            // - `volta install 12` is an error.
+            // - `volta install lts` is an error.
+            (Some(maybe_version), None, None) if is_version_like(maybe_version.as_ref()) => {
+                Err(ErrorKind::InvalidInvocationOfBareVersion {
+                    action: action.to_string(),
+                    version: maybe_version.as_ref().to_string(),
+                }
+                .into())
+            }
+            // The case we are concerned with here is where we have `<tool> <number>`.
+            // This is only interesting if there are exactly two args. Then we care
+            // whether the two items are a bare name (with no `@version`), followed
+            // by a valid version specifier (ignoring custom tags). That is:
+            //
+            // - `volta install node@lts latest` is allowed.
+            // - `volta install node latest` is an error.
+            // - `volta install node latest yarn` is allowed.
+            (Some(name), Some(maybe_version), None)
+                if !HAS_VERSION.is_match(name.as_ref())
+                    && is_version_like(maybe_version.as_ref()) =>
+            {
+                Err(ErrorKind::InvalidInvocation {
+                    action: action.to_string(),
+                    name: name.as_ref().to_string(),
+                    version: maybe_version.as_ref().to_string(),
+                }
+                .into())
+            }
+            _ => Ok(()),
+        }
+    }
+
+    /// Compare `Spec`s for sorting when converting from strings
+    ///
+    /// We want to preserve the original order as much as possible, so we treat tools in
+    /// the same tool category as equal. We still need to pull Node to the front of the
+    /// list, followed by Npm, pnpm, Yarn, and then Packages last.
+    fn sort_comparator(left: &Spec, right: &Spec) -> Ordering {
+        match (left, right) {
+            (Spec::Node(_), Spec::Node(_)) => Ordering::Equal,
+            (Spec::Node(_), _) => Ordering::Less,
+            (_, Spec::Node(_)) => Ordering::Greater,
+            (Spec::Npm(_), Spec::Npm(_)) => Ordering::Equal,
+            (Spec::Npm(_), _) => Ordering::Less,
+            (_, Spec::Npm(_)) => Ordering::Greater,
+            (Spec::Pnpm(_), Spec::Pnpm(_)) => Ordering::Equal,
+            (Spec::Pnpm(_), _) => Ordering::Less,
+            (_, Spec::Pnpm(_)) => Ordering::Greater,
+            (Spec::Yarn(_), Spec::Yarn(_)) => Ordering::Equal,
+            (Spec::Yarn(_), _) => Ordering::Less,
+            (_, Spec::Yarn(_)) => Ordering::Greater,
+            (Spec::Package(_, _), Spec::Package(_, _)) => Ordering::Equal,
+        }
+    }
+}
+
+/// Determine if a given string is "version-like".
+///
+/// This means it is either 'latest', 'lts', a Version, or a Version Range.
+fn is_version_like(value: &str) -> bool {
+    matches!(
+        value.parse(),
+        Ok(VersionSpec::Exact(_))
+            | Ok(VersionSpec::Semver(_))
+            | Ok(VersionSpec::Tag(VersionTag::Latest))
+            | Ok(VersionSpec::Tag(VersionTag::Lts))
+    )
+}
+
+#[cfg(test)]
+mod tests {
+    mod try_from_str {
+        use std::str::FromStr as _;
+
+        use super::super::super::Spec;
+        use crate::version::{VersionSpec, VersionTag};
+
+        const LTS: &str = "lts";
+        const LATEST: &str = "latest";
+        const MAJOR: &str = "3";
+        const MINOR: &str = "3.0";
+        const PATCH: &str = "3.0.0";
+        const BETA: &str = "beta";
+
+        /// Convenience macro for generating the <tool>@<version> string.
+        macro_rules! versioned_tool {
+            ($tool:expr, $version:expr) => {
+                format!("{}@{}", $tool, $version)
+            };
+        }
+
+        #[test]
+        fn parses_bare_node() {
+            assert_eq!(
+                Spec::try_from_str("node").expect("succeeds"),
+                Spec::Node(VersionSpec::default())
+            );
+        }
+
+        #[test]
+        fn parses_node_with_valid_versions() {
+            let tool = "node";
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, MAJOR)).expect("succeeds"),
+                Spec::Node(VersionSpec::from_str(MAJOR).expect("`VersionSpec` has its own tests"))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, MINOR)).expect("succeeds"),
+                Spec::Node(VersionSpec::from_str(MINOR).expect("`VersionSpec` has its own tests"))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, PATCH)).expect("succeeds"),
+                Spec::Node(VersionSpec::from_str(PATCH).expect("`VersionSpec` has its own tests"))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, LATEST)).expect("succeeds"),
+                Spec::Node(VersionSpec::Tag(VersionTag::Latest))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, LTS)).expect("succeeds"),
+                Spec::Node(VersionSpec::Tag(VersionTag::Lts))
+            );
+        }
+
+        #[test]
+        fn parses_bare_yarn() {
+            assert_eq!(
+                Spec::try_from_str("yarn").expect("succeeds"),
+                Spec::Yarn(VersionSpec::default())
+            );
+        }
+
+        #[test]
+        fn parses_yarn_with_valid_versions() {
+            let tool = "yarn";
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, MAJOR)).expect("succeeds"),
+                Spec::Yarn(VersionSpec::from_str(MAJOR).expect("`VersionSpec` has its own tests"))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, MINOR)).expect("succeeds"),
+                Spec::Yarn(VersionSpec::from_str(MINOR).expect("`VersionSpec` has its own tests"))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, PATCH)).expect("succeeds"),
+                Spec::Yarn(VersionSpec::from_str(PATCH).expect("`VersionSpec` has its own tests"))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(tool, LATEST)).expect("succeeds"),
+                Spec::Yarn(VersionSpec::Tag(VersionTag::Latest))
+            );
+        }
+
+        #[test]
+        fn parses_bare_packages() {
+            let package = "ember-cli";
+            assert_eq!(
+                Spec::try_from_str(package).expect("succeeds"),
+                Spec::Package(package.into(), VersionSpec::default())
+            );
+        }
+
+        #[test]
+        fn parses_namespaced_packages() {
+            let package = "@types/lodash";
+            assert_eq!(
+                Spec::try_from_str(package).expect("succeeds"),
+                Spec::Package(package.into(), VersionSpec::default())
+            );
+        }
+
+        #[test]
+        fn parses_bare_packages_with_valid_versions() {
+            let package = "something-awesome";
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, MAJOR)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::from_str(MAJOR).expect("`VersionSpec` has its own tests")
+                )
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, MINOR)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::from_str(MINOR).expect("`VersionSpec` has its own tests")
+                )
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, PATCH)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::from_str(PATCH).expect("`VersionSpec` has its own tests")
+                )
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, LATEST)).expect("succeeds"),
+                Spec::Package(package.into(), VersionSpec::Tag(VersionTag::Latest))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, LTS)).expect("succeeds"),
+                Spec::Package(package.into(), VersionSpec::Tag(VersionTag::Lts))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, BETA)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::Tag(VersionTag::Custom(BETA.into()))
+                )
+            );
+        }
+
+        #[test]
+        fn parses_namespaced_packages_with_valid_versions() {
+            let package = "@something/awesome";
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, MAJOR)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::from_str(MAJOR).expect("`VersionSpec` has its own tests")
+                )
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, MINOR)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::from_str(MINOR).expect("`VersionSpec` has its own tests")
+                )
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, PATCH)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::from_str(PATCH).expect("`VersionSpec` has its own tests")
+                )
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, LATEST)).expect("succeeds"),
+                Spec::Package(package.into(), VersionSpec::Tag(VersionTag::Latest))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, LTS)).expect("succeeds"),
+                Spec::Package(package.into(), VersionSpec::Tag(VersionTag::Lts))
+            );
+
+            assert_eq!(
+                Spec::try_from_str(&versioned_tool!(package, BETA)).expect("succeeds"),
+                Spec::Package(
+                    package.into(),
+                    VersionSpec::Tag(VersionTag::Custom(BETA.into()))
+                )
+            );
+        }
+    }
+
+    mod from_strings {
+        use super::super::*;
+        use std::str::FromStr;
+
+        static PIN: &str = "pin";
+
+        #[test]
+        fn special_cases_just_number() {
+            let version = "1.2.3";
+            let args: Vec<String> = vec![version.into()];
+
+            let err = Spec::from_strings(&args, PIN).unwrap_err();
+
+            assert_eq!(
+                err.kind(),
+                &ErrorKind::InvalidInvocationOfBareVersion {
+                    action: PIN.into(),
+                    version: version.into()
+                },
+                "`volta <action> number` results in the correct error"
+            );
+        }
+
+        #[test]
+        fn special_cases_tool_space_number() {
+            let name = "potato";
+            let version = "1.2.3";
+            let args: Vec<String> = vec![name.into(), version.into()];
+
+            let err = Spec::from_strings(&args, PIN).unwrap_err();
+
+            assert_eq!(
+                err.kind(),
+                &ErrorKind::InvalidInvocation {
+                    action: PIN.into(),
+                    name: name.into(),
+                    version: version.into()
+                },
+                "`volta <action> tool number` results in the correct error"
+            );
+        }
+
+        #[test]
+        fn leaves_other_scenarios_alone() {
+            let empty: Vec<&str> = Vec::new();
+            assert_eq!(
+                Spec::from_strings(&empty, PIN).expect("is ok").len(),
+                empty.len(),
+                "when there are no args"
+            );
+
+            let only_one = ["node".to_owned()];
+            assert_eq!(
+                Spec::from_strings(&only_one, PIN).expect("is ok").len(),
+                only_one.len(),
+                "when there is only one arg"
+            );
+
+            let one_with_explicit_verson = ["10@latest".to_owned()];
+            assert_eq!(
+                Spec::from_strings(&one_with_explicit_verson, PIN)
+                    .expect("is ok")
+                    .len(),
+                only_one.len(),
+                "when the sole arg is version-like but has an explicit version"
+            );
+
+            let two_but_unmistakable = ["12".to_owned(), "node".to_owned()];
+            assert_eq!(
+                Spec::from_strings(&two_but_unmistakable, PIN)
+                    .expect("is ok")
+                    .len(),
+                two_but_unmistakable.len(),
+                "when there are two args but the order is not likely to be a mistake"
+            );
+
+            let two_but_valid_first = ["node@lts".to_owned(), "12".to_owned()];
+            assert_eq!(
+                Spec::from_strings(&two_but_valid_first, PIN)
+                    .expect("is ok")
+                    .len(),
+                two_but_valid_first.len(),
+                "when there are two args but the first is a valid tool spec"
+            );
+
+            let more_than_two_tools = ["node".to_owned(), "12".to_owned(), "yarn".to_owned()];
+            assert_eq!(
+                Spec::from_strings(&more_than_two_tools, PIN)
+                    .expect("is ok")
+                    .len(),
+                more_than_two_tools.len(),
+                "when there are more than two args"
+            );
+        }
+
+        #[test]
+        fn sorts_node_npm_yarn_to_front() {
+            let multiple = [
+                "ember-cli@3".to_owned(),
+                "yarn".to_owned(),
+                "npm@5".to_owned(),
+                "node@latest".to_owned(),
+            ];
+            let expected = [
+                Spec::Node(VersionSpec::Tag(VersionTag::Latest)),
+                Spec::Npm(VersionSpec::from_str("5").expect("requirement is valid")),
+                Spec::Yarn(VersionSpec::default()),
+                Spec::Package(
+                    "ember-cli".to_owned(),
+                    VersionSpec::from_str("3").expect("requirement is valid"),
+                ),
+            ];
+            assert_eq!(Spec::from_strings(&multiple, PIN).expect("is ok"), expected);
+        }
+
+        #[test]
+        fn keeps_package_order_unchanged() {
+            let packages_with_node = ["typescript@latest", "ember-cli@3", "node@lts", "mocha"];
+            let expected = [
+                Spec::Node(VersionSpec::Tag(VersionTag::Lts)),
+                Spec::Package(
+                    "typescript".to_owned(),
+                    VersionSpec::Tag(VersionTag::Latest),
+                ),
+                Spec::Package(
+                    "ember-cli".to_owned(),
+                    VersionSpec::from_str("3").expect("requirement is valid"),
+                ),
+                Spec::Package("mocha".to_owned(), VersionSpec::default()),
+            ];
+
+            assert_eq!(
+                Spec::from_strings(&packages_with_node, PIN).expect("is ok"),
+                expected
+            );
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/yarn/fetch.rs.html b/main/src/volta_core/tool/yarn/fetch.rs.html new file mode 100644 index 000000000..df8cd76f1 --- /dev/null +++ b/main/src/volta_core/tool/yarn/fetch.rs.html @@ -0,0 +1,317 @@ +fetch.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+
//! Provides fetcher for Yarn distributions
+
+use std::fs::File;
+use std::path::Path;
+
+use super::super::download_tool_error;
+use super::super::registry::{
+    find_unpack_dir, public_registry_package, scoped_public_registry_package,
+};
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::{create_staging_dir, create_staging_file, rename, set_executable};
+use crate::hook::YarnHooks;
+use crate::layout::volta_home;
+use crate::style::{progress_bar, tool_version};
+use crate::tool::{self, Yarn};
+use crate::version::VersionSpec;
+use archive::{Archive, Tarball};
+use fs_utils::ensure_containing_dir_exists;
+use log::debug;
+use node_semver::Version;
+
+pub fn fetch(version: &Version, hooks: Option<&YarnHooks>) -> Fallible<()> {
+    let yarn_dir = volta_home()?.yarn_inventory_dir();
+    let cache_file = yarn_dir.join(Yarn::archive_filename(&version.to_string()));
+
+    let (archive, staging) = match load_cached_distro(&cache_file) {
+        Some(archive) => {
+            debug!(
+                "Loading {} from cached archive at '{}'",
+                tool_version("yarn", version),
+                cache_file.display(),
+            );
+            (archive, None)
+        }
+        None => {
+            let staging = create_staging_file()?;
+            let remote_url = determine_remote_url(version, hooks)?;
+            let archive = fetch_remote_distro(version, &remote_url, staging.path())?;
+            (archive, Some(staging))
+        }
+    };
+
+    unpack_archive(archive, version)?;
+
+    if let Some(staging_file) = staging {
+        ensure_containing_dir_exists(&cache_file).with_context(|| {
+            ErrorKind::ContainingDirError {
+                path: cache_file.clone(),
+            }
+        })?;
+        staging_file
+            .persist(cache_file)
+            .with_context(|| ErrorKind::PersistInventoryError {
+                tool: "Yarn".into(),
+            })?;
+    }
+
+    Ok(())
+}
+
+/// Unpack the yarn archive into the image directory so that it is ready for use
+fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<()> {
+    let temp = create_staging_dir()?;
+    debug!("Unpacking yarn into '{}'", temp.path().display());
+
+    let progress = progress_bar(
+        archive.origin(),
+        &tool_version("yarn", version),
+        archive.compressed_size(),
+    );
+    let version_string = version.to_string();
+
+    archive
+        .unpack(temp.path(), &mut |_, read| {
+            progress.inc(read as u64);
+        })
+        .with_context(|| ErrorKind::UnpackArchiveError {
+            tool: "Yarn".into(),
+            version: version_string.clone(),
+        })?;
+
+    let unpack_dir = find_unpack_dir(temp.path())?;
+    // "bin/yarn" is not executable in the @yarnpkg/cli-dist package
+    ensure_bin_is_executable(&unpack_dir, "yarn")?;
+
+    let dest = volta_home()?.yarn_image_dir(&version_string);
+    ensure_containing_dir_exists(&dest)
+        .with_context(|| ErrorKind::ContainingDirError { path: dest.clone() })?;
+
+    rename(unpack_dir, &dest).with_context(|| ErrorKind::SetupToolImageError {
+        tool: "Yarn".into(),
+        version: version_string.clone(),
+        dir: dest.clone(),
+    })?;
+
+    progress.finish_and_clear();
+
+    // Note: We write this after the progress bar is finished to avoid display bugs with re-renders of the progress
+    debug!("Installing yarn in '{}'", dest.display());
+
+    Ok(())
+}
+
+/// Return the archive if it is valid. It may have been corrupted or interrupted in the middle of
+/// downloading.
+// ISSUE(#134) - verify checksum
+fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>> {
+    if file.is_file() {
+        let file = File::open(file).ok()?;
+        Tarball::load(file).ok()
+    } else {
+        None
+    }
+}
+
+/// Determine the remote URL to download from, using the hooks if available
+fn determine_remote_url(version: &Version, hooks: Option<&YarnHooks>) -> Fallible<String> {
+    let version_str = version.to_string();
+    match hooks {
+        Some(&YarnHooks {
+            distro: Some(ref hook),
+            ..
+        }) => {
+            debug!("Using yarn.distro hook to determine download URL");
+            let distro_file_name = Yarn::archive_filename(&version_str);
+            hook.resolve(version, &distro_file_name)
+        }
+        _ => {
+            if version.major >= 2 {
+                Ok(scoped_public_registry_package(
+                    "@yarnpkg",
+                    "cli-dist",
+                    &version_str,
+                ))
+            } else {
+                Ok(public_registry_package("yarn", &version_str))
+            }
+        }
+    }
+}
+
+/// Fetch the distro archive from the internet
+fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path,
+) -> Fallible<Box<dyn Archive>> {
+    debug!("Downloading {} from {}", tool_version("yarn", version), url);
+    Tarball::fetch(url, staging_path).with_context(download_tool_error(
+        tool::Spec::Yarn(VersionSpec::Exact(version.clone())),
+        url,
+    ))
+}
+
+fn ensure_bin_is_executable(unpack_dir: &Path, tool: &str) -> Fallible<()> {
+    let exec_path = unpack_dir.join("bin").join(tool);
+    set_executable(&exec_path).with_context(|| ErrorKind::SetToolExecutable { tool: tool.into() })
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/yarn/metadata.rs.html b/main/src/volta_core/tool/yarn/metadata.rs.html new file mode 100644 index 000000000..3ebd3129c --- /dev/null +++ b/main/src/volta_core/tool/yarn/metadata.rs.html @@ -0,0 +1,111 @@ +metadata.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+
use std::collections::BTreeSet;
+
+use crate::version::version_serde;
+use node_semver::Version;
+use serde::Deserialize;
+
+/// The public Yarn index.
+pub struct YarnIndex {
+    pub(super) entries: BTreeSet<Version>,
+}
+
+#[derive(Deserialize)]
+pub struct RawYarnIndex(Vec<RawYarnEntry>);
+
+#[derive(Deserialize)]
+pub struct RawYarnEntry {
+    /// Yarn releases are given a tag name of the form "v$version" where $version
+    /// is the release's version string.
+    #[serde(with = "version_serde")]
+    pub tag_name: Version,
+
+    /// The GitHub API provides a list of assets. Some Yarn releases don't include
+    /// a tarball, so we don't support them and remove them from the set of available
+    /// Yarn versions.
+    pub assets: Vec<RawYarnAsset>,
+}
+
+impl RawYarnEntry {
+    /// Is this entry a full release, i.e., does this entry's asset list include a
+    /// proper release tarball?
+    fn is_full_release(&self) -> bool {
+        let release_filename = &format!("yarn-v{}.tar.gz", self.tag_name)[..];
+        self.assets
+            .iter()
+            .any(|raw_asset| raw_asset.name == release_filename)
+    }
+}
+
+#[derive(Deserialize)]
+pub struct RawYarnAsset {
+    /// The filename of an asset included in a Yarn GitHub release.
+    pub name: String,
+}
+
+impl From<RawYarnIndex> for YarnIndex {
+    fn from(raw: RawYarnIndex) -> YarnIndex {
+        let mut entries = BTreeSet::new();
+        for entry in raw.0 {
+            if entry.is_full_release() {
+                entries.insert(entry.tag_name);
+            }
+        }
+        YarnIndex { entries }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/yarn/mod.rs.html b/main/src/volta_core/tool/yarn/mod.rs.html new file mode 100644 index 000000000..0edbfeffa --- /dev/null +++ b/main/src/volta_core/tool/yarn/mod.rs.html @@ -0,0 +1,221 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+
use std::fmt::{self, Display};
+
+use super::{
+    check_fetched, check_shim_reachable, debug_already_fetched, info_fetched, info_installed,
+    info_pinned, info_project_version, FetchStatus, Tool,
+};
+use crate::error::{ErrorKind, Fallible};
+use crate::inventory::yarn_available;
+use crate::session::Session;
+use crate::style::tool_version;
+use crate::sync::VoltaLock;
+use node_semver::Version;
+
+mod fetch;
+mod metadata;
+mod resolve;
+
+pub use resolve::resolve;
+
+/// The Tool implementation for fetching and installing Yarn
+pub struct Yarn {
+    pub(super) version: Version,
+}
+
+impl Yarn {
+    pub fn new(version: Version) -> Self {
+        Yarn { version }
+    }
+
+    pub fn archive_basename(version: &str) -> String {
+        format!("yarn-v{}", version)
+    }
+
+    pub fn archive_filename(version: &str) -> String {
+        format!("{}.tar.gz", Yarn::archive_basename(version))
+    }
+
+    pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<()> {
+        match check_fetched(|| yarn_available(&self.version))? {
+            FetchStatus::AlreadyFetched => {
+                debug_already_fetched(self);
+                Ok(())
+            }
+            FetchStatus::FetchNeeded(_lock) => fetch::fetch(&self.version, session.hooks()?.yarn()),
+        }
+    }
+}
+
+impl Tool for Yarn {
+    fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        self.ensure_fetched(session)?;
+
+        info_fetched(self);
+        Ok(())
+    }
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        // Acquire a lock on the Volta directory, if possible, to prevent concurrent changes
+        let _lock = VoltaLock::acquire();
+        self.ensure_fetched(session)?;
+
+        session
+            .toolchain_mut()?
+            .set_active_yarn(Some(self.version.clone()))?;
+
+        info_installed(&self);
+        check_shim_reachable("yarn");
+
+        if let Ok(Some(project)) = session.project_platform() {
+            if let Some(yarn) = &project.yarn {
+                info_project_version(tool_version("yarn", yarn), &self);
+            }
+        }
+        Ok(())
+    }
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()> {
+        if session.project()?.is_some() {
+            self.ensure_fetched(session)?;
+
+            // Note: We know this will succeed, since we checked above
+            let project = session.project_mut()?.unwrap();
+            project.pin_yarn(Some(self.version.clone()))?;
+
+            info_pinned(self);
+            Ok(())
+        } else {
+            Err(ErrorKind::NotInPackage.into())
+        }
+    }
+}
+
+impl Display for Yarn {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str(&tool_version("yarn", &self.version))
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_yarn_archive_basename() {
+        assert_eq!(Yarn::archive_basename("1.2.3"), "yarn-v1.2.3");
+    }
+
+    #[test]
+    fn test_yarn_archive_filename() {
+        assert_eq!(Yarn::archive_filename("1.2.3"), "yarn-v1.2.3.tar.gz");
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/tool/yarn/resolve.rs.html b/main/src/volta_core/tool/yarn/resolve.rs.html new file mode 100644 index 000000000..bd010c261 --- /dev/null +++ b/main/src/volta_core/tool/yarn/resolve.rs.html @@ -0,0 +1,449 @@ +resolve.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+
//! Provides resolution of Yarn requirements into specific versions
+
+use super::super::registry::{
+    fetch_npm_registry, public_registry_index, PackageDetails, PackageIndex,
+};
+use super::super::registry_fetch_error;
+use super::metadata::{RawYarnIndex, YarnIndex};
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::hook::{RegistryFormat, YarnHooks};
+use crate::session::Session;
+use crate::style::progress_spinner;
+use crate::version::{parse_version, VersionSpec, VersionTag};
+use attohttpc::Response;
+use log::debug;
+use node_semver::{Range, Version};
+
+pub fn resolve(matching: VersionSpec, session: &mut Session) -> Fallible<Version> {
+    let hooks = session.hooks()?.yarn();
+    match matching {
+        VersionSpec::Semver(requirement) => resolve_semver(requirement, hooks),
+        VersionSpec::Exact(version) => Ok(version),
+        VersionSpec::None => resolve_tag(VersionTag::Latest, hooks),
+        VersionSpec::Tag(tag) => resolve_tag(tag, hooks),
+    }
+}
+
+fn resolve_tag(tag: VersionTag, hooks: Option<&YarnHooks>) -> Fallible<Version> {
+    // This triage is complicated because we need to maintain the legacy behavior of hooks
+    // First, if the tag is 'latest' and we have a 'latest' hook, we use the old behavior
+    // Next, if the tag is 'latest' and we _do not_ have a 'latest' hook, we use the new behavior
+    // Next, if the tag is _not_ 'latest' and we have an 'index' hook, we show an error since
+    //     the previous behavior did not support generic tags
+    // Finally, we don't have any relevant hooks, so we can use the new behavior
+    match (tag, hooks) {
+        (
+            VersionTag::Latest,
+            Some(&YarnHooks {
+                latest: Some(ref hook),
+                ..
+            }),
+        ) => {
+            debug!("Using yarn.latest hook to determine latest-version URL");
+            // does yarn3 use latest-version? no
+            resolve_latest_legacy(hook.resolve("latest-version")?)
+        }
+        (VersionTag::Latest, _) => resolve_custom_tag(VersionTag::Latest.to_string()),
+        (tag, Some(&YarnHooks { index: Some(_), .. })) => Err(ErrorKind::YarnVersionNotFound {
+            matching: tag.to_string(),
+        }
+        .into()),
+        (tag, _) => resolve_custom_tag(tag.to_string()),
+    }
+}
+
+fn resolve_semver(matching: Range, hooks: Option<&YarnHooks>) -> Fallible<Version> {
+    // For semver, the triage is less complicated: The previous behavior _always_ used
+    // the 'index' hook, so we can check for that to decide which behavior to use.
+    //
+    // If the user specifies a format for the registry, we use that. Otherwise Github format
+    // is the default legacy behavior.
+    if let Some(&YarnHooks {
+        index: Some(ref hook),
+        ..
+    }) = hooks
+    {
+        debug!("Using yarn.index hook to determine yarn index URL");
+        match hook.format {
+            RegistryFormat::Github => resolve_semver_legacy(matching, hook.resolve("releases")?),
+            RegistryFormat::Npm => resolve_semver_npm(matching, hook.resolve("")?),
+        }
+    } else {
+        resolve_semver_from_registry(matching)
+    }
+}
+
+fn fetch_yarn_index(package: &str) -> Fallible<(String, PackageIndex)> {
+    let url = public_registry_index(package);
+    fetch_npm_registry(url, "Yarn")
+}
+
+fn resolve_custom_tag(tag: String) -> Fallible<Version> {
+    // first try yarn2+, which uses "@yarnpkg/cli-dist" instead of "yarn"
+    if let Ok((url, mut index)) = fetch_yarn_index("@yarnpkg/cli-dist") {
+        if let Some(version) = index.tags.remove(&tag) {
+            debug!("Found yarn@{} matching tag '{}' from {}", version, tag, url);
+            if version.major == 2 {
+                return Err(ErrorKind::Yarn2NotSupported.into());
+            }
+            return Ok(version);
+        }
+    }
+    debug!(
+        "Did not find yarn matching tag '{}' from @yarnpkg/cli-dist",
+        tag
+    );
+
+    let (url, mut index) = fetch_yarn_index("yarn")?;
+    match index.tags.remove(&tag) {
+        Some(version) => {
+            debug!("Found yarn@{} matching tag '{}' from {}", version, tag, url);
+            Ok(version)
+        }
+        None => Err(ErrorKind::YarnVersionNotFound { matching: tag }.into()),
+    }
+}
+
+fn resolve_latest_legacy(url: String) -> Fallible<Version> {
+    let response_text = attohttpc::get(&url)
+        .send()
+        .and_then(Response::error_for_status)
+        .and_then(Response::text)
+        .with_context(|| ErrorKind::YarnLatestFetchError {
+            from_url: url.clone(),
+        })?;
+
+    debug!("Found yarn latest version ({}) from {}", response_text, url);
+    parse_version(response_text)
+}
+
+fn resolve_semver_from_registry(matching: Range) -> Fallible<Version> {
+    // first try yarn2+, which uses "@yarnpkg/cli-dist" instead of "yarn"
+    if let Ok((url, index)) = fetch_yarn_index("@yarnpkg/cli-dist") {
+        let matching_entries: Vec<PackageDetails> = index
+            .entries
+            .into_iter()
+            .filter(|PackageDetails { version, .. }| matching.satisfies(version))
+            .collect();
+
+        if !matching_entries.is_empty() {
+            let details_opt = matching_entries
+                .iter()
+                .find(|PackageDetails { version, .. }| version.major >= 3);
+
+            match details_opt {
+                Some(details) => {
+                    debug!(
+                        "Found yarn@{} matching requirement '{}' from {}",
+                        details.version, matching, url
+                    );
+                    return Ok(details.version.clone());
+                }
+                None => {
+                    return Err(ErrorKind::Yarn2NotSupported.into());
+                }
+            }
+        }
+    }
+    debug!(
+        "Did not find yarn matching requirement '{}' for @yarnpkg/cli-dist",
+        matching
+    );
+
+    let (url, index) = fetch_yarn_index("yarn")?;
+
+    let details_opt = index
+        .entries
+        .into_iter()
+        .find(|PackageDetails { version, .. }| matching.satisfies(version));
+
+    match details_opt {
+        Some(details) => {
+            debug!(
+                "Found yarn@{} matching requirement '{}' from {}",
+                details.version, matching, url
+            );
+            Ok(details.version)
+        }
+        // at this point Yarn is not found in either registry
+        None => Err(ErrorKind::YarnVersionNotFound {
+            matching: matching.to_string(),
+        }
+        .into()),
+    }
+}
+
+fn resolve_semver_legacy(matching: Range, url: String) -> Fallible<Version> {
+    let spinner = progress_spinner(format!("Fetching registry: {}", url));
+    let releases: RawYarnIndex = attohttpc::get(&url)
+        .send()
+        .and_then(Response::error_for_status)
+        .and_then(Response::json)
+        .with_context(registry_fetch_error("Yarn", &url))?;
+    let index = YarnIndex::from(releases);
+    let releases = index.entries;
+    spinner.finish_and_clear();
+    let version_opt = releases.into_iter().rev().find(|v| matching.satisfies(v));
+
+    match version_opt {
+        Some(version) => {
+            debug!(
+                "Found yarn@{} matching requirement '{}' from {}",
+                version, matching, url
+            );
+            Ok(version)
+        }
+        None => Err(ErrorKind::YarnVersionNotFound {
+            matching: matching.to_string(),
+        }
+        .into()),
+    }
+}
+
+fn resolve_semver_npm(matching: Range, url: String) -> Fallible<Version> {
+    let (url, index) = fetch_npm_registry(url, "Yarn")?;
+
+    let details_opt = index
+        .entries
+        .into_iter()
+        .find(|PackageDetails { version, .. }| matching.satisfies(version));
+
+    match details_opt {
+        Some(details) => {
+            debug!(
+                "Found yarn@{} matching requirement '{}' from {}",
+                details.version, matching, url
+            );
+            Ok(details.version)
+        }
+        None => Err(ErrorKind::YarnVersionNotFound {
+            matching: matching.to_string(),
+        }
+        .into()),
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/toolchain/mod.rs.html b/main/src/volta_core/toolchain/mod.rs.html new file mode 100644 index 000000000..37e1affa7 --- /dev/null +++ b/main/src/volta_core/toolchain/mod.rs.html @@ -0,0 +1,307 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+
use std::fs::write;
+
+use crate::error::{Context, ErrorKind, Fallible};
+use crate::fs::touch;
+use crate::layout::volta_home;
+use crate::platform::PlatformSpec;
+use log::debug;
+use node_semver::Version;
+use once_cell::unsync::OnceCell;
+use readext::ReadExt;
+
+pub mod serial;
+
+/// Lazily loaded toolchain
+pub struct LazyToolchain {
+    toolchain: OnceCell<Toolchain>,
+}
+
+impl LazyToolchain {
+    /// Creates a new `LazyToolchain`
+    pub fn init() -> Self {
+        LazyToolchain {
+            toolchain: OnceCell::new(),
+        }
+    }
+
+    /// Forces loading of the toolchain and returns an immutable reference to it
+    pub fn get(&self) -> Fallible<&Toolchain> {
+        self.toolchain.get_or_try_init(Toolchain::current)
+    }
+
+    /// Forces loading of the toolchain and returns a mutable reference to it
+    pub fn get_mut(&mut self) -> Fallible<&mut Toolchain> {
+        let _ = self.toolchain.get_or_try_init(Toolchain::current)?;
+        Ok(self.toolchain.get_mut().unwrap())
+    }
+}
+
+pub struct Toolchain {
+    platform: Option<PlatformSpec>,
+}
+
+impl Toolchain {
+    fn current() -> Fallible<Toolchain> {
+        let path = volta_home()?.default_platform_file();
+        let src = touch(path)
+            .and_then(|mut file| file.read_into_string())
+            .with_context(|| ErrorKind::ReadPlatformError {
+                file: path.to_owned(),
+            })?;
+
+        let platform: Option<PlatformSpec> = serial::Platform::try_from(src)?.into();
+        if platform.is_some() {
+            debug!("Found default configuration at '{}'", path.display());
+        }
+        Ok(Toolchain { platform })
+    }
+
+    pub fn platform(&self) -> Option<&PlatformSpec> {
+        self.platform.as_ref()
+    }
+
+    /// Set the active Node version in the default platform file.
+    pub fn set_active_node(&mut self, node_version: &Version) -> Fallible<()> {
+        let mut dirty = false;
+
+        match self.platform.as_mut() {
+            Some(platform) => {
+                if platform.node != *node_version {
+                    platform.node = node_version.clone();
+                    dirty = true;
+                }
+            }
+            None => {
+                self.platform = Some(PlatformSpec {
+                    node: node_version.clone(),
+                    npm: None,
+                    pnpm: None,
+                    yarn: None,
+                });
+                dirty = true;
+            }
+        }
+
+        if dirty {
+            self.save()?;
+        }
+
+        Ok(())
+    }
+
+    /// Set the active Yarn version in the default platform file.
+    pub fn set_active_yarn(&mut self, yarn: Option<Version>) -> Fallible<()> {
+        if let Some(platform) = self.platform.as_mut() {
+            if platform.yarn != yarn {
+                platform.yarn = yarn;
+                self.save()?;
+            }
+        } else if yarn.is_some() {
+            return Err(ErrorKind::NoDefaultNodeVersion {
+                tool: "Yarn".into(),
+            }
+            .into());
+        }
+
+        Ok(())
+    }
+
+    /// Set the active pnpm version in the default platform file.
+    pub fn set_active_pnpm(&mut self, pnpm: Option<Version>) -> Fallible<()> {
+        if let Some(platform) = self.platform.as_mut() {
+            if platform.pnpm != pnpm {
+                platform.pnpm = pnpm;
+                self.save()?;
+            }
+        } else if pnpm.is_some() {
+            return Err(ErrorKind::NoDefaultNodeVersion {
+                tool: "pnpm".into(),
+            }
+            .into());
+        }
+
+        Ok(())
+    }
+
+    /// Set the active Npm version in the default platform file.
+    pub fn set_active_npm(&mut self, npm: Option<Version>) -> Fallible<()> {
+        if let Some(platform) = self.platform.as_mut() {
+            if platform.npm != npm {
+                platform.npm = npm;
+                self.save()?;
+            }
+        } else if npm.is_some() {
+            return Err(ErrorKind::NoDefaultNodeVersion { tool: "npm".into() }.into());
+        }
+
+        Ok(())
+    }
+
+    pub fn save(&self) -> Fallible<()> {
+        let path = volta_home()?.default_platform_file();
+        let result = match &self.platform {
+            Some(platform) => {
+                let src = serial::Platform::of(platform).into_json()?;
+                write(path, src)
+            }
+            None => write(path, "{}"),
+        };
+        result.with_context(|| ErrorKind::WritePlatformError {
+            file: path.to_owned(),
+        })
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/toolchain/serial.rs.html b/main/src/volta_core/toolchain/serial.rs.html new file mode 100644 index 000000000..4245aa174 --- /dev/null +++ b/main/src/volta_core/toolchain/serial.rs.html @@ -0,0 +1,263 @@ +serial.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+
use crate::error::{Context, ErrorKind, Fallible, VoltaError};
+use crate::platform::PlatformSpec;
+use crate::version::{option_version_serde, version_serde};
+use node_semver::Version;
+use serde::{Deserialize, Serialize};
+
+#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
+pub struct NodeVersion {
+    #[serde(with = "version_serde")]
+    pub runtime: Version,
+    #[serde(with = "option_version_serde")]
+    pub npm: Option<Version>,
+}
+
+#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
+pub struct Platform {
+    #[serde(default)]
+    pub node: Option<NodeVersion>,
+    #[serde(default)]
+    #[serde(with = "option_version_serde")]
+    pub pnpm: Option<Version>,
+    #[serde(default)]
+    #[serde(with = "option_version_serde")]
+    pub yarn: Option<Version>,
+}
+
+impl Platform {
+    pub fn of(source: &PlatformSpec) -> Self {
+        Platform {
+            node: Some(NodeVersion {
+                runtime: source.node.clone(),
+                npm: source.npm.clone(),
+            }),
+            pnpm: source.pnpm.clone(),
+            yarn: source.yarn.clone(),
+        }
+    }
+
+    /// Serialize the Platform to a JSON String
+    pub fn into_json(self) -> Fallible<String> {
+        serde_json::to_string_pretty(&self).with_context(|| ErrorKind::StringifyPlatformError)
+    }
+}
+
+impl TryFrom<String> for Platform {
+    type Error = VoltaError;
+    fn try_from(src: String) -> Fallible<Self> {
+        let result = if src.is_empty() {
+            serde_json::de::from_str("{}")
+        } else {
+            serde_json::de::from_str(&src)
+        };
+
+        result.with_context(|| ErrorKind::ParsePlatformError)
+    }
+}
+
+impl From<Platform> for Option<PlatformSpec> {
+    fn from(platform: Platform) -> Option<PlatformSpec> {
+        let yarn = platform.yarn;
+        let pnpm = platform.pnpm;
+        platform.node.map(|node_version| PlatformSpec {
+            node: node_version.runtime,
+            npm: node_version.npm,
+            pnpm,
+            yarn,
+        })
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use super::*;
+    use crate::platform;
+    use node_semver::Version;
+
+    // NOTE: serde_json is required with the "preserve_order" feature in Cargo.toml,
+    // so these tests will serialized/deserialize in a predictable order
+
+    const BASIC_JSON_STR: &str = r#"{
+  "node": {
+    "runtime": "4.5.6",
+    "npm": "7.8.9"
+  },
+  "pnpm": "3.2.1",
+  "yarn": "1.2.3"
+}"#;
+
+    #[test]
+    fn test_from_json() {
+        let json_str = BASIC_JSON_STR.to_string();
+        let platform = Platform::try_from(json_str).expect("could not parse JSON string");
+        let expected_platform = Platform {
+            pnpm: Some(Version::parse("3.2.1").expect("could not parse version")),
+            yarn: Some(Version::parse("1.2.3").expect("could not parse version")),
+            node: Some(NodeVersion {
+                runtime: Version::parse("4.5.6").expect("could not parse version"),
+                npm: Some(Version::parse("7.8.9").expect("could not parse version")),
+            }),
+        };
+        assert_eq!(platform, expected_platform);
+    }
+
+    #[test]
+    fn test_from_json_empty_string() {
+        let json_str = "".to_string();
+        let platform = Platform::try_from(json_str).expect("could not parse JSON string");
+        let expected_platform = Platform {
+            node: None,
+            pnpm: None,
+            yarn: None,
+        };
+        assert_eq!(platform, expected_platform);
+    }
+
+    #[test]
+    fn test_into_json() {
+        let platform_spec = platform::PlatformSpec {
+            pnpm: Some(Version::parse("3.2.1").expect("could not parse version")),
+            yarn: Some(Version::parse("1.2.3").expect("could not parse version")),
+            node: Version::parse("4.5.6").expect("could not parse version"),
+            npm: Some(Version::parse("7.8.9").expect("could not parse version")),
+        };
+        let json_str = Platform::of(&platform_spec)
+            .into_json()
+            .expect("could not serialize platform to JSON");
+        let expected_json_str = BASIC_JSON_STR.to_string();
+        assert_eq!(json_str, expected_json_str);
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/version/mod.rs.html b/main/src/volta_core/version/mod.rs.html new file mode 100644 index 000000000..65a8f725c --- /dev/null +++ b/main/src/volta_core/version/mod.rs.html @@ -0,0 +1,399 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+
use std::fmt;
+use std::str::FromStr;
+
+use crate::error::{Context, ErrorKind, Fallible, VoltaError};
+use node_semver::{Range, Version};
+
+mod serial;
+
+#[derive(Debug, Default)]
+#[cfg_attr(test, derive(PartialEq, Eq))]
+pub enum VersionSpec {
+    /// No version specified (default)
+    #[default]
+    None,
+
+    /// SemVer Range
+    Semver(Range),
+
+    /// Exact Version
+    Exact(Version),
+
+    /// Arbitrary Version Tag
+    Tag(VersionTag),
+}
+
+#[derive(Debug)]
+#[cfg_attr(test, derive(PartialEq, Eq))]
+pub enum VersionTag {
+    /// The 'latest' tag, a special case that exists for all packages
+    Latest,
+
+    /// The 'lts' tag, a special case for Node
+    Lts,
+
+    /// An arbitrary tag version
+    Custom(String),
+}
+
+impl fmt::Display for VersionSpec {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            VersionSpec::None => write!(f, "<default>"),
+            VersionSpec::Semver(req) => req.fmt(f),
+            VersionSpec::Exact(version) => version.fmt(f),
+            VersionSpec::Tag(tag) => tag.fmt(f),
+        }
+    }
+}
+
+impl fmt::Display for VersionTag {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            VersionTag::Latest => write!(f, "latest"),
+            VersionTag::Lts => write!(f, "lts"),
+            VersionTag::Custom(s) => s.fmt(f),
+        }
+    }
+}
+
+impl FromStr for VersionSpec {
+    type Err = VoltaError;
+
+    fn from_str(s: &str) -> Fallible<Self> {
+        if let Ok(version) = parse_version(s) {
+            Ok(VersionSpec::Exact(version))
+        } else if let Ok(req) = parse_requirements(s) {
+            Ok(VersionSpec::Semver(req))
+        } else {
+            s.parse().map(VersionSpec::Tag)
+        }
+    }
+}
+
+impl FromStr for VersionTag {
+    type Err = VoltaError;
+
+    fn from_str(s: &str) -> Fallible<Self> {
+        if s == "latest" {
+            Ok(VersionTag::Latest)
+        } else if s == "lts" {
+            Ok(VersionTag::Lts)
+        } else {
+            Ok(VersionTag::Custom(s.into()))
+        }
+    }
+}
+
+pub fn parse_requirements(s: impl AsRef<str>) -> Fallible<Range> {
+    let s = s.as_ref();
+    serial::parse_requirements(s)
+        .with_context(|| ErrorKind::VersionParseError { version: s.into() })
+}
+
+pub fn parse_version(s: impl AsRef<str>) -> Fallible<Version> {
+    let s = s.as_ref();
+    s.parse()
+        .with_context(|| ErrorKind::VersionParseError { version: s.into() })
+}
+
+// remove the leading 'v' from the version string, if present
+fn trim_version(s: &str) -> &str {
+    let s = s.trim();
+    match s.strip_prefix('v') {
+        Some(stripped) => stripped,
+        None => s,
+    }
+}
+
+// custom serialization and de-serialization for Version
+// because Version doesn't work with serde out of the box
+pub mod version_serde {
+    use node_semver::Version;
+    use serde::de::{Error, Visitor};
+    use serde::{self, Deserializer, Serializer};
+    use std::fmt;
+
+    struct VersionVisitor;
+
+    impl Visitor<'_> for VersionVisitor {
+        type Value = Version;
+
+        fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+            formatter.write_str("string")
+        }
+
+        // parse the version from the string
+        fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
+        where
+            E: Error,
+        {
+            Version::parse(super::trim_version(value)).map_err(Error::custom)
+        }
+    }
+
+    pub fn serialize<S>(version: &Version, s: S) -> Result<S::Ok, S::Error>
+    where
+        S: Serializer,
+    {
+        s.serialize_str(&version.to_string())
+    }
+
+    pub fn deserialize<'de, D>(deserializer: D) -> Result<Version, D::Error>
+    where
+        D: Deserializer<'de>,
+    {
+        deserializer.deserialize_string(VersionVisitor)
+    }
+}
+
+// custom serialization and de-serialization for Option<Version>
+// because Version doesn't work with serde out of the box
+pub mod option_version_serde {
+    use node_semver::Version;
+    use serde::de::Error;
+    use serde::{self, Deserialize, Deserializer, Serializer};
+
+    pub fn serialize<S>(version: &Option<Version>, s: S) -> Result<S::Ok, S::Error>
+    where
+        S: Serializer,
+    {
+        match version {
+            Some(v) => s.serialize_str(&v.to_string()),
+            None => s.serialize_none(),
+        }
+    }
+
+    pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Version>, D::Error>
+    where
+        D: Deserializer<'de>,
+    {
+        let s: Option<String> = Option::deserialize(deserializer)?;
+        if let Some(v) = s {
+            return Ok(Some(
+                Version::parse(super::trim_version(&v)).map_err(Error::custom)?,
+            ));
+        }
+        Ok(None)
+    }
+}
+
+// custom deserialization for HashMap<String, Version>
+// because Version doesn't work with serde out of the box
+pub mod hashmap_version_serde {
+    use super::version_serde;
+    use node_semver::Version;
+    use serde::{self, Deserialize, Deserializer};
+    use std::collections::HashMap;
+
+    #[derive(Deserialize)]
+    struct Wrapper(#[serde(deserialize_with = "version_serde::deserialize")] Version);
+
+    pub fn deserialize<'de, D>(deserializer: D) -> Result<HashMap<String, Version>, D::Error>
+    where
+        D: Deserializer<'de>,
+    {
+        let m = HashMap::<String, Wrapper>::deserialize(deserializer)?;
+        Ok(m.into_iter().map(|(k, Wrapper(v))| (k, v)).collect())
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_core/version/serial.rs.html b/main/src/volta_core/version/serial.rs.html new file mode 100644 index 000000000..ccc505ba0 --- /dev/null +++ b/main/src/volta_core/version/serial.rs.html @@ -0,0 +1,107 @@ +serial.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+
use node_semver::{Range, SemverError};
+
+// NOTE: using `parse_compat` here because the semver crate defaults to
+// parsing in a cargo-compatible way. This is normally fine, except for
+// 2 cases (that I know about):
+//  * "1.2.3" parses as `^1.2.3` for cargo, but `=1.2.3` for Node
+//  * `>1.2.3 <2.0.0` serializes to ">1.2.3, <2.0.0" for cargo (with the
+//    comma), but ">1.2.3 <2.0.0" for Node (no comma, because Node parses
+//    commas differently)
+//
+// Because we are parsing the version requirements from the command line,
+// then serializing them to pass to `npm view`, they need to be handled in
+// a Node-compatible way (or we get the wrong version info returned).
+pub fn parse_requirements(src: &str) -> Result<Range, SemverError> {
+    let src = src.trim().trim_start_matches('v');
+
+    Range::parse(src)
+}
+
+#[cfg(test)]
+pub mod tests {
+
+    use crate::version::serial::parse_requirements;
+    use node_semver::Range;
+
+    #[test]
+    fn test_parse_requirements() {
+        assert_eq!(
+            parse_requirements("1.2.3").unwrap(),
+            Range::parse("=1.2.3").unwrap()
+        );
+        assert_eq!(
+            parse_requirements("v1.5").unwrap(),
+            Range::parse("=1.5").unwrap()
+        );
+        assert_eq!(
+            parse_requirements("=1.2.3").unwrap(),
+            Range::parse("=1.2.3").unwrap()
+        );
+        assert_eq!(
+            parse_requirements("^1.2").unwrap(),
+            Range::parse("^1.2").unwrap()
+        );
+        assert_eq!(
+            parse_requirements(">=1.4").unwrap(),
+            Range::parse(">=1.4").unwrap()
+        );
+        assert_eq!(
+            parse_requirements("8.11 - 8.17 || 10.* || >= 12").unwrap(),
+            Range::parse("8.11 - 8.17 || 10.* || >= 12").unwrap()
+        );
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/lib.rs.html b/main/src/volta_layout/lib.rs.html new file mode 100644 index 000000000..082b21ef4 --- /dev/null +++ b/main/src/volta_layout/lib.rs.html @@ -0,0 +1,25 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+
#[macro_use]
+mod macros;
+
+pub mod v0;
+pub mod v1;
+pub mod v2;
+pub mod v3;
+pub mod v4;
+
+fn executable(name: &str) -> String {
+    format!("{}{}", name, std::env::consts::EXE_SUFFIX)
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/macros.rs.html b/main/src/volta_layout/macros.rs.html new file mode 100644 index 000000000..32261a76e --- /dev/null +++ b/main/src/volta_layout/macros.rs.html @@ -0,0 +1,23 @@ +macros.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+
macro_rules! path_buf {
+    ($base:expr, $( $x:expr ), *) => {
+        {
+            let mut temp = $base;
+            $(
+                temp.push($x);
+            )*
+            temp
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/v0.rs.html b/main/src/volta_layout/v0.rs.html new file mode 100644 index 000000000..f790d57cc --- /dev/null +++ b/main/src/volta_layout/v0.rs.html @@ -0,0 +1,239 @@ +v0.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+
use std::path::PathBuf;
+
+use super::executable;
+use volta_layout_macro::layout;
+
+layout! {
+    pub struct VoltaInstall {
+        "shim[.exe]": shim_executable;
+    }
+
+    pub struct VoltaHome {
+        "cache": cache_dir {
+            "node": node_cache_dir {
+                "index.json": node_index_file;
+                "index.json.expires": node_index_expiry_file;
+            }
+        }
+        "bin": shim_dir {}
+        "log": log_dir {}
+        "tools": tools_dir {
+            "inventory": inventory_dir {
+                "node": node_inventory_dir {}
+                "packages": package_inventory_dir {}
+                "yarn": yarn_inventory_dir {}
+            }
+            "image": image_dir {
+                "node": node_image_root_dir {}
+                "yarn": yarn_image_root_dir {}
+                "packages": package_image_root_dir {}
+            }
+            "user": default_toolchain_dir {
+                "bins": default_bin_dir {}
+                "packages": default_package_dir {}
+                "platform.json": default_platform_file;
+            }
+        }
+        "tmp": tmp_dir {}
+        "hooks.json": default_hooks_file;
+    }
+}
+
+impl VoltaHome {
+    pub fn package_distro_file(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(
+            self.package_inventory_dir.clone(),
+            format!("{}-{}.tgz", name, version)
+        )
+    }
+
+    pub fn package_distro_shasum(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(
+            self.package_inventory_dir.clone(),
+            format!("{}-{}.shasum", name, version)
+        )
+    }
+
+    pub fn node_image_dir(&self, node: &str, npm: &str) -> PathBuf {
+        path_buf!(self.node_image_root_dir.clone(), node, npm)
+    }
+
+    pub fn yarn_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_root_dir.clone(), version)
+    }
+
+    pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_dir(version), "bin")
+    }
+
+    pub fn package_image_dir(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(self.package_image_root_dir.clone(), name, version)
+    }
+
+    pub fn default_package_config_file(&self, package_name: &str) -> PathBuf {
+        path_buf!(
+            self.default_package_dir.clone(),
+            format!("{}.json", package_name)
+        )
+    }
+
+    pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf {
+        path_buf!(self.default_bin_dir.clone(), format!("{}.json", bin_name))
+    }
+
+    pub fn node_npm_version_file(&self, version: &str) -> PathBuf {
+        path_buf!(
+            self.node_inventory_dir.clone(),
+            format!("node-v{}-npm", version)
+        )
+    }
+
+    pub fn shim_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), executable(toolname))
+    }
+}
+
+#[cfg(windows)]
+impl VoltaHome {
+    pub fn shim_git_bash_script_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), toolname)
+    }
+
+    pub fn node_image_bin_dir(&self, node: &str, npm: &str) -> PathBuf {
+        self.node_image_dir(node, npm)
+    }
+}
+
+#[cfg(windows)]
+impl VoltaInstall {
+    pub fn bin_dir(&self) -> PathBuf {
+        path_buf!(self.root.clone(), "bin")
+    }
+}
+
+#[cfg(unix)]
+impl VoltaHome {
+    pub fn node_image_bin_dir(&self, node: &str, npm: &str) -> PathBuf {
+        path_buf!(self.node_image_dir(node, npm), "bin")
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/v1.rs.html b/main/src/volta_layout/v1.rs.html new file mode 100644 index 000000000..4c97e1aba --- /dev/null +++ b/main/src/volta_layout/v1.rs.html @@ -0,0 +1,231 @@ +v1.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+
use std::path::PathBuf;
+
+use super::executable;
+use volta_layout_macro::layout;
+
+layout! {
+    pub struct VoltaInstall {
+        "volta-shim[.exe]": shim_executable;
+        "volta[.exe]": main_executable;
+        "volta-migrate[.exe]": migrate_executable;
+    }
+
+    pub struct VoltaHome {
+        "cache": cache_dir {
+            "node": node_cache_dir {
+                "index.json": node_index_file;
+                "index.json.expires": node_index_expiry_file;
+            }
+        }
+        "bin": shim_dir {}
+        "log": log_dir {}
+        "tools": tools_dir {
+            "inventory": inventory_dir {
+                "node": node_inventory_dir {}
+                "packages": package_inventory_dir {}
+                "yarn": yarn_inventory_dir {}
+            }
+            "image": image_dir {
+                "node": node_image_root_dir {}
+                "yarn": yarn_image_root_dir {}
+                "packages": package_image_root_dir {}
+            }
+            "user": default_toolchain_dir {
+                "bins": default_bin_dir {}
+                "packages": default_package_dir {}
+                "platform.json": default_platform_file;
+            }
+        }
+        "tmp": tmp_dir {}
+        "hooks.json": default_hooks_file;
+        "layout.v1": layout_file;
+    }
+}
+
+impl VoltaHome {
+    pub fn package_distro_file(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(
+            self.package_inventory_dir.clone(),
+            format!("{}-{}.tgz", name, version)
+        )
+    }
+
+    pub fn package_distro_shasum(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(
+            self.package_inventory_dir.clone(),
+            format!("{}-{}.shasum", name, version)
+        )
+    }
+
+    pub fn node_image_dir(&self, node: &str, npm: &str) -> PathBuf {
+        path_buf!(self.node_image_root_dir.clone(), node, npm)
+    }
+
+    pub fn yarn_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_root_dir.clone(), version)
+    }
+
+    pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_dir(version), "bin")
+    }
+
+    pub fn package_image_dir(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(self.package_image_root_dir.clone(), name, version)
+    }
+
+    pub fn default_package_config_file(&self, package_name: &str) -> PathBuf {
+        path_buf!(
+            self.default_package_dir.clone(),
+            format!("{}.json", package_name)
+        )
+    }
+
+    pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf {
+        path_buf!(self.default_bin_dir.clone(), format!("{}.json", bin_name))
+    }
+
+    pub fn node_npm_version_file(&self, version: &str) -> PathBuf {
+        path_buf!(
+            self.node_inventory_dir.clone(),
+            format!("node-v{}-npm", version)
+        )
+    }
+
+    pub fn shim_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), executable(toolname))
+    }
+}
+
+#[cfg(windows)]
+impl VoltaHome {
+    pub fn shim_git_bash_script_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), toolname)
+    }
+
+    pub fn node_image_bin_dir(&self, node: &str, npm: &str) -> PathBuf {
+        self.node_image_dir(node, npm)
+    }
+}
+
+#[cfg(unix)]
+impl VoltaHome {
+    pub fn node_image_bin_dir(&self, node: &str, npm: &str) -> PathBuf {
+        path_buf!(self.node_image_dir(node, npm), "bin")
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/v2.rs.html b/main/src/volta_layout/v2.rs.html new file mode 100644 index 000000000..b9b67a287 --- /dev/null +++ b/main/src/volta_layout/v2.rs.html @@ -0,0 +1,243 @@ +v2.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+
use std::path::PathBuf;
+
+use super::executable;
+use volta_layout_macro::layout;
+
+pub use crate::v1::VoltaInstall;
+
+layout! {
+    pub struct VoltaHome {
+        "cache": cache_dir {
+            "node": node_cache_dir {
+                "index.json": node_index_file;
+                "index.json.expires": node_index_expiry_file;
+            }
+        }
+        "bin": shim_dir {}
+        "log": log_dir {}
+        "tools": tools_dir {
+            "inventory": inventory_dir {
+                "node": node_inventory_dir {}
+                "npm": npm_inventory_dir {}
+                "packages": package_inventory_dir {}
+                "yarn": yarn_inventory_dir {}
+            }
+            "image": image_dir {
+                "node": node_image_root_dir {}
+                "npm": npm_image_root_dir {}
+                "yarn": yarn_image_root_dir {}
+                "packages": package_image_root_dir {}
+            }
+            "user": default_toolchain_dir {
+                "bins": default_bin_dir {}
+                "packages": default_package_dir {}
+                "platform.json": default_platform_file;
+            }
+        }
+        "tmp": tmp_dir {}
+        "hooks.json": default_hooks_file;
+        "layout.v2": layout_file;
+    }
+}
+
+impl VoltaHome {
+    pub fn package_distro_file(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(
+            self.package_inventory_dir.clone(),
+            format!("{}-{}.tgz", name, version)
+        )
+    }
+
+    pub fn package_distro_shasum(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(
+            self.package_inventory_dir.clone(),
+            format!("{}-{}.shasum", name, version)
+        )
+    }
+
+    pub fn node_image_dir(&self, node: &str) -> PathBuf {
+        path_buf!(self.node_image_root_dir.clone(), node)
+    }
+
+    pub fn npm_image_dir(&self, npm: &str) -> PathBuf {
+        path_buf!(self.npm_image_root_dir.clone(), npm)
+    }
+
+    pub fn npm_image_bin_dir(&self, npm: &str) -> PathBuf {
+        path_buf!(self.npm_image_dir(npm), "bin")
+    }
+
+    pub fn yarn_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_root_dir.clone(), version)
+    }
+
+    pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_dir(version), "bin")
+    }
+
+    pub fn package_image_dir(&self, name: &str, version: &str) -> PathBuf {
+        path_buf!(self.package_image_root_dir.clone(), name, version)
+    }
+
+    pub fn default_package_config_file(&self, package_name: &str) -> PathBuf {
+        path_buf!(
+            self.default_package_dir.clone(),
+            format!("{}.json", package_name)
+        )
+    }
+
+    pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf {
+        path_buf!(self.default_bin_dir.clone(), format!("{}.json", bin_name))
+    }
+
+    pub fn node_npm_version_file(&self, version: &str) -> PathBuf {
+        path_buf!(
+            self.node_inventory_dir.clone(),
+            format!("node-v{}-npm", version)
+        )
+    }
+
+    pub fn shim_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), executable(toolname))
+    }
+}
+
+#[cfg(windows)]
+impl VoltaHome {
+    pub fn shim_git_bash_script_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), toolname)
+    }
+
+    pub fn node_image_bin_dir(&self, node: &str) -> PathBuf {
+        self.node_image_dir(node)
+    }
+}
+
+#[cfg(unix)]
+impl VoltaHome {
+    pub fn node_image_bin_dir(&self, node: &str) -> PathBuf {
+        path_buf!(self.node_image_dir(node), "bin")
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/v3.rs.html b/main/src/volta_layout/v3.rs.html new file mode 100644 index 000000000..159aab5e9 --- /dev/null +++ b/main/src/volta_layout/v3.rs.html @@ -0,0 +1,243 @@ +v3.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+
use std::path::PathBuf;
+
+use super::executable;
+use volta_layout_macro::layout;
+
+pub use crate::v1::VoltaInstall;
+
+layout! {
+    pub struct VoltaHome {
+        "cache": cache_dir {
+            "node": node_cache_dir {
+                "index.json": node_index_file;
+                "index.json.expires": node_index_expiry_file;
+            }
+        }
+        "bin": shim_dir {}
+        "log": log_dir {}
+        "tools": tools_dir {
+            "inventory": inventory_dir {
+                "node": node_inventory_dir {}
+                "npm": npm_inventory_dir {}
+                "pnpm": pnpm_inventory_dir {}
+                "yarn": yarn_inventory_dir {}
+            }
+            "image": image_dir {
+                "node": node_image_root_dir {}
+                "npm": npm_image_root_dir {}
+                "pnpm": pnpm_image_root_dir {}
+                "yarn": yarn_image_root_dir {}
+                "packages": package_image_root_dir {}
+            }
+            "shared": shared_lib_root {}
+            "user": default_toolchain_dir {
+                "bins": default_bin_dir {}
+                "packages": default_package_dir {}
+                "platform.json": default_platform_file;
+            }
+        }
+        "tmp": tmp_dir {}
+        "hooks.json": default_hooks_file;
+        "layout.v3": layout_file;
+    }
+}
+
+impl VoltaHome {
+    pub fn node_image_dir(&self, node: &str) -> PathBuf {
+        path_buf!(self.node_image_root_dir.clone(), node)
+    }
+
+    pub fn npm_image_dir(&self, npm: &str) -> PathBuf {
+        path_buf!(self.npm_image_root_dir.clone(), npm)
+    }
+
+    pub fn npm_image_bin_dir(&self, npm: &str) -> PathBuf {
+        path_buf!(self.npm_image_dir(npm), "bin")
+    }
+
+    pub fn pnpm_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.pnpm_image_root_dir.clone(), version)
+    }
+
+    pub fn pnpm_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.pnpm_image_dir(version), "bin")
+    }
+
+    pub fn yarn_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_root_dir.clone(), version)
+    }
+
+    pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_dir(version), "bin")
+    }
+
+    pub fn package_image_dir(&self, name: &str) -> PathBuf {
+        path_buf!(self.package_image_root_dir.clone(), name)
+    }
+
+    pub fn default_package_config_file(&self, package_name: &str) -> PathBuf {
+        path_buf!(
+            self.default_package_dir.clone(),
+            format!("{}.json", package_name)
+        )
+    }
+
+    pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf {
+        path_buf!(self.default_bin_dir.clone(), format!("{}.json", bin_name))
+    }
+
+    pub fn node_npm_version_file(&self, version: &str) -> PathBuf {
+        path_buf!(
+            self.node_inventory_dir.clone(),
+            format!("node-v{}-npm", version)
+        )
+    }
+
+    pub fn shim_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), executable(toolname))
+    }
+
+    pub fn shared_lib_dir(&self, library: &str) -> PathBuf {
+        path_buf!(self.shared_lib_root.clone(), library)
+    }
+}
+
+#[cfg(windows)]
+impl VoltaHome {
+    pub fn shim_git_bash_script_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), toolname)
+    }
+
+    pub fn node_image_bin_dir(&self, node: &str) -> PathBuf {
+        self.node_image_dir(node)
+    }
+}
+
+#[cfg(unix)]
+impl VoltaHome {
+    pub fn node_image_bin_dir(&self, node: &str) -> PathBuf {
+        path_buf!(self.node_image_dir(node), "bin")
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout/v4.rs.html b/main/src/volta_layout/v4.rs.html new file mode 100644 index 000000000..c219214d7 --- /dev/null +++ b/main/src/volta_layout/v4.rs.html @@ -0,0 +1,251 @@ +v4.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+
use std::path::PathBuf;
+
+use volta_layout_macro::layout;
+
+pub use crate::v1::VoltaInstall;
+
+layout! {
+    pub struct VoltaHome {
+        "cache": cache_dir {
+            "node": node_cache_dir {
+                "index.json": node_index_file;
+                "index.json.expires": node_index_expiry_file;
+            }
+        }
+        "bin": shim_dir {}
+        "log": log_dir {}
+        "tools": tools_dir {
+            "inventory": inventory_dir {
+                "node": node_inventory_dir {}
+                "npm": npm_inventory_dir {}
+                "pnpm": pnpm_inventory_dir {}
+                "yarn": yarn_inventory_dir {}
+            }
+            "image": image_dir {
+                "node": node_image_root_dir {}
+                "npm": npm_image_root_dir {}
+                "pnpm": pnpm_image_root_dir {}
+                "yarn": yarn_image_root_dir {}
+                "packages": package_image_root_dir {}
+            }
+            "shared": shared_lib_root {}
+            "user": default_toolchain_dir {
+                "bins": default_bin_dir {}
+                "packages": default_package_dir {}
+                "platform.json": default_platform_file;
+            }
+        }
+        "tmp": tmp_dir {}
+        "hooks.json": default_hooks_file;
+        "layout.v4": layout_file;
+    }
+}
+
+impl VoltaHome {
+    pub fn node_image_dir(&self, node: &str) -> PathBuf {
+        path_buf!(self.node_image_root_dir.clone(), node)
+    }
+
+    pub fn npm_image_dir(&self, npm: &str) -> PathBuf {
+        path_buf!(self.npm_image_root_dir.clone(), npm)
+    }
+
+    pub fn npm_image_bin_dir(&self, npm: &str) -> PathBuf {
+        path_buf!(self.npm_image_dir(npm), "bin")
+    }
+
+    pub fn pnpm_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.pnpm_image_root_dir.clone(), version)
+    }
+
+    pub fn pnpm_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.pnpm_image_dir(version), "bin")
+    }
+
+    pub fn yarn_image_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_root_dir.clone(), version)
+    }
+
+    pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf {
+        path_buf!(self.yarn_image_dir(version), "bin")
+    }
+
+    pub fn package_image_dir(&self, name: &str) -> PathBuf {
+        path_buf!(self.package_image_root_dir.clone(), name)
+    }
+
+    pub fn default_package_config_file(&self, package_name: &str) -> PathBuf {
+        path_buf!(
+            self.default_package_dir.clone(),
+            format!("{}.json", package_name)
+        )
+    }
+
+    pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf {
+        path_buf!(self.default_bin_dir.clone(), format!("{}.json", bin_name))
+    }
+
+    pub fn node_npm_version_file(&self, version: &str) -> PathBuf {
+        path_buf!(
+            self.node_inventory_dir.clone(),
+            format!("node-v{}-npm", version)
+        )
+    }
+
+    pub fn shim_file(&self, toolname: &str) -> PathBuf {
+        // On Windows, shims are created as `<name>.cmd` since they
+        // are thin scripts that use `volta run` to execute the command
+        #[cfg(windows)]
+        let toolname = format!("{}{}", toolname, ".cmd");
+
+        path_buf!(self.shim_dir.clone(), toolname)
+    }
+
+    pub fn shared_lib_dir(&self, library: &str) -> PathBuf {
+        path_buf!(self.shared_lib_root.clone(), library)
+    }
+}
+
+#[cfg(windows)]
+impl VoltaHome {
+    pub fn shim_git_bash_script_file(&self, toolname: &str) -> PathBuf {
+        path_buf!(self.shim_dir.clone(), toolname)
+    }
+
+    pub fn node_image_bin_dir(&self, node: &str) -> PathBuf {
+        self.node_image_dir(node)
+    }
+}
+
+#[cfg(unix)]
+impl VoltaHome {
+    pub fn node_image_bin_dir(&self, node: &str) -> PathBuf {
+        path_buf!(self.node_image_dir(node), "bin")
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout_macro/ast.rs.html b/main/src/volta_layout_macro/ast.rs.html new file mode 100644 index 000000000..ad9f6ce3c --- /dev/null +++ b/main/src/volta_layout_macro/ast.rs.html @@ -0,0 +1,537 @@ +ast.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+
use crate::ir::{Entry, Ir};
+use proc_macro2::TokenStream;
+use std::collections::HashMap;
+use syn::parse::{self, Parse, ParseStream};
+use syn::punctuated::Punctuated;
+use syn::{braced, Attribute, Ident, LitStr, Token, Visibility};
+
+pub(crate) type Result<T> = ::std::result::Result<T, TokenStream>;
+
+/// Abstract syntax tree (AST) for the surface syntax of the `layout!` macro.
+///
+/// The surface syntax of the `layout!` macro takes the form:
+///
+/// ```text,no_run
+/// Attribute* Visibility "struct" Ident Directory
+/// ```
+///
+/// This AST gets lowered by the `flatten` method to a vector of intermediate
+/// representation (IR) trees. See the `Ir` type for details.
+pub(crate) struct Ast {
+    decls: Vec<LayoutStruct>,
+}
+
+impl Parse for Ast {
+    fn parse(input: ParseStream) -> parse::Result<Self> {
+        let mut decls = Vec::new();
+        while !input.is_empty() {
+            let decl = input.call(LayoutStruct::parse)?;
+            decls.push(decl);
+        }
+        Ok(Ast { decls })
+    }
+}
+
+impl Ast {
+    /// Compiles (macro-expands) the AST.
+    pub(crate) fn compile(self) -> TokenStream {
+        self.decls
+            .into_iter()
+            .map(|decl| match decl.flatten() {
+                Ok(ir) => ir.codegen(),
+                Err(err) => err,
+            })
+            .collect()
+    }
+}
+
+/// Represents a single type LayoutStruct in the AST, which takes the form:
+///
+/// ```text,no_run
+/// Attribute* Visibility "struct" Ident Directory
+/// ```
+///
+/// This AST gets lowered by the `flatten` method to a flat list of entries,
+/// organized by entry type. See the `Ir` type for details.
+pub(crate) struct LayoutStruct {
+    attrs: Vec<Attribute>,
+    visibility: Visibility,
+    name: Ident,
+    directory: Directory,
+}
+
+impl Parse for LayoutStruct {
+    fn parse(input: ParseStream) -> parse::Result<Self> {
+        let attrs: Vec<Attribute> = input.call(Attribute::parse_outer)?;
+        let visibility: Visibility = input.parse()?;
+        input.parse::<Token![struct]>()?;
+        let name: Ident = input.parse()?;
+        let directory: Directory = input.parse()?;
+        Ok(LayoutStruct {
+            attrs,
+            visibility,
+            name,
+            directory,
+        })
+    }
+}
+
+impl LayoutStruct {
+    /// Lowers the AST to a flattened intermediate representation.
+    fn flatten(self) -> Result<Ir> {
+        let mut results = Ir {
+            name: self.name,
+            attrs: self.attrs,
+            visibility: self.visibility,
+            dirs: vec![],
+            files: vec![],
+            exes: vec![],
+        };
+
+        self.directory.flatten(&mut results, vec![])?;
+
+        Ok(results)
+    }
+}
+
+/// Represents a directory entry in the AST, which can recursively contain
+/// more entries.
+///
+/// The surface syntax of a directory takes the form:
+///
+/// ```text,no_run
+/// {
+///     (FieldPrefix)FieldContents*
+/// }
+/// ```
+struct Directory {
+    entries: Punctuated<FieldPrefix, FieldContents>,
+}
+
+impl Parse for Directory {
+    fn parse(input: ParseStream) -> parse::Result<Self> {
+        let content;
+        braced!(content in input);
+        Ok(Directory {
+            entries: content.parse_terminated(FieldPrefix::parse)?,
+        })
+    }
+}
+
+enum EntryKind {
+    Exe,
+    File,
+    Dir,
+}
+
+impl Directory {
+    /// Lowers the directory to a flattened intermediate representation.
+    fn flatten(self, results: &mut Ir, context: Vec<LitStr>) -> Result<()> {
+        let mut visited_entries = HashMap::new();
+
+        for pair in self.entries.into_pairs() {
+            let (prefix, punc) = pair.into_tuple();
+
+            let mut entry = Entry {
+                name: prefix.name,
+                context: context.clone(),
+                filename: prefix.filename.clone(),
+            };
+
+            match punc {
+                Some(FieldContents::Dir(dir)) => {
+                    let filename = prefix.filename.value();
+
+                    if filename.ends_with(".exe") || filename.ends_with("[.exe]") {
+                        let error = syn::Error::new(
+                            prefix.filename.span(),
+                            "the `.exe` extension is not allowed for directory names",
+                        );
+                        return Err(error.to_compile_error());
+                    }
+
+                    if let Some(kind) = visited_entries.get(&filename) {
+                        let message = match kind {
+                            EntryKind::Exe => {
+                                format!("filename `{}` is a duplicate of `{}` executable on non-Windows operating systems", filename, filename)
+                            }
+                            _ => {
+                                format!("duplicate filename `{}`", filename)
+                            }
+                        };
+                        let error = syn::Error::new(prefix.filename.span(), message);
+                        return Err(error.to_compile_error());
+                    }
+
+                    visited_entries.insert(filename.clone(), EntryKind::Dir);
+
+                    results.dirs.push(entry);
+                    let mut sub_context = context.clone();
+                    sub_context.push(prefix.filename);
+                    dir.flatten(results, sub_context)?;
+                }
+                _ => {
+                    let filename = prefix.filename.value();
+                    if filename.ends_with("[.exe]") {
+                        let filename = &filename[0..filename.len() - 6];
+
+                        if let Some(kind) = visited_entries.get(filename) {
+                            let message = match kind {
+                                EntryKind::Exe => {
+                                    format!("duplicate filename `{}.exe`", filename)
+                                }
+                                EntryKind::File => {
+                                    format!("executable `{}` (on non-Windows operating systems) is a duplicate of `{}` filename", filename, filename)
+                                }
+                                EntryKind::Dir => {
+                                    format!("executable `{}` (on non-Windows operating systems) is a duplicate of `{}` directory name", filename, filename)
+                                }
+                            };
+                            let error = syn::Error::new(prefix.filename.span(), message);
+                            return Err(error.to_compile_error());
+                        }
+
+                        visited_entries.insert(filename.to_string(), EntryKind::Exe);
+                        entry.filename = LitStr::new(filename, prefix.filename.span());
+                        results.exes.push(entry);
+                    } else {
+                        if let Some(kind) = visited_entries.get(&filename) {
+                            let message = match kind {
+                                EntryKind::Exe => {
+                                    format!("filename `{}` is a duplicate of `{}` executable on non-Windows operating systems", filename, filename)
+                                }
+                                _ => {
+                                    format!("duplicate filename `{}`", filename)
+                                }
+                            };
+                            let error = syn::Error::new(prefix.filename.span(), message);
+                            return Err(error.to_compile_error());
+                        }
+
+                        visited_entries.insert(filename, EntryKind::File);
+                        results.files.push(entry);
+                    }
+                }
+            }
+        }
+        Ok(())
+    }
+}
+
+/// AST for the common prefix of a single field in a `layout!` struct declaration,
+/// which is of the form:
+///
+/// ```text,no_run
+/// LitStr ":" Ident
+/// ```
+///
+/// This is followed either by a semicolon (`;`), indicating that the field is a
+/// file, or a braced directory entry, indicating that the field is a directory.
+///
+/// If the `LitStr` contains the suffix `"[.exe]"` it is treated specially as an
+/// executable file, whose suffix (or lack thereof) is determined by the current
+/// operating system (using the `std::env::consts::EXE_SUFFIX` constant).
+struct FieldPrefix {
+    filename: LitStr,
+    name: Ident,
+}
+
+impl Parse for FieldPrefix {
+    fn parse(input: ParseStream) -> parse::Result<Self> {
+        let filename = input.parse()?;
+        input.parse::<Token![:]>()?;
+        let name = input.parse()?;
+        Ok(FieldPrefix { filename, name })
+    }
+}
+
+/// AST for the suffix of a field in a `layout!` struct declaration.
+enum FieldContents {
+    /// A file field suffix, which consists of a single semicolon (`;`).
+    File(Token![;]),
+
+    /// A directory field suffix, which consists of a braced directory.
+    Dir(Directory),
+}
+
+impl Parse for FieldContents {
+    fn parse(input: ParseStream) -> parse::Result<Self> {
+        let lookahead = input.lookahead1();
+        Ok(if lookahead.peek(Token![;]) {
+            let semi = input.parse()?;
+            FieldContents::File(semi)
+        } else {
+            let directory = input.parse()?;
+            FieldContents::Dir(directory)
+        })
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout_macro/ir.rs.html b/main/src/volta_layout_macro/ir.rs.html new file mode 100644 index 000000000..c719cf345 --- /dev/null +++ b/main/src/volta_layout_macro/ir.rs.html @@ -0,0 +1,407 @@ +ir.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+
// The `proc_macro2` crate is a polyfill for advanced functionality of Rust's
+// procedural macros, not all of which have shipped in stable Rust. It's used by
+// the `syn` and `quote` crates to produce a shimmed version of the standard
+// `TokenStream` type. So internally that's the type we have to use for the
+// implementation of our macro. The actual front-end for the macro takes this
+// shimmed `TokenStream` type and converts it to the built-in `TokenStream` type
+// required by the Rust macro system.
+use proc_macro2::TokenStream;
+use quote::quote;
+use syn::{Attribute, Ident, LitStr, Visibility};
+
+// These seem to be leaked implementation details of the `quote` macro that have
+// to be imported by users. You can ignore them; they simply pacify the compiler.
+#[allow(unused_imports)]
+use quote::{pounded_var_names, quote_each_token, quote_spanned};
+
+/// The intermediate representation (IR) of a struct type defined by the `layout!`
+/// macro, which contains the flattened directory entries, organized into three
+/// categories:
+///
+/// - Directories
+/// - Executable files
+/// - Other files
+pub(crate) struct Ir {
+    pub(crate) name: Ident,
+    pub(crate) attrs: Vec<Attribute>,
+    pub(crate) visibility: Visibility,
+    pub(crate) dirs: Vec<Entry>,
+    pub(crate) files: Vec<Entry>,
+    pub(crate) exes: Vec<Entry>,
+}
+
+impl Ir {
+    fn dir_names(&self) -> impl Iterator<Item = &Ident> {
+        self.dirs.iter().map(|entry| &entry.name)
+    }
+
+    fn file_names(&self) -> impl Iterator<Item = &Ident> {
+        self.files.iter().map(|entry| &entry.name)
+    }
+
+    fn exe_names(&self) -> impl Iterator<Item = &Ident> {
+        self.exes.iter().map(|entry| &entry.name)
+    }
+
+    fn field_names(&self) -> impl Iterator<Item = &Ident> {
+        let dir_names = self.dir_names();
+        let file_names = self.file_names();
+        let exe_names = self.exe_names();
+        dir_names.chain(file_names).chain(exe_names)
+    }
+
+    fn to_struct_decl(&self) -> TokenStream {
+        let name = &self.name;
+
+        let attrs = self.attrs.iter();
+        let visibility = self.visibility.clone();
+
+        let field_names = self.field_names().map(|field_name| {
+            // Use the field name's span for good duplicate-field-name error messages.
+            quote_spanned! {field_name.span()=>
+                #field_name : ::std::path::PathBuf ,
+            }
+        });
+
+        quote! {
+            #(#attrs)* #visibility struct #name {
+                #(#field_names)*
+                root: ::std::path::PathBuf,
+            }
+        }
+    }
+
+    fn to_create_method(&self) -> TokenStream {
+        let name = &self.name;
+        let dir_names = self.dir_names();
+
+        quote! {
+            impl #name {
+                /// Creates all subdirectories in this directory layout.
+                pub fn create(&self) -> ::std::io::Result<()> {
+                    #(::std::fs::create_dir_all(self.#dir_names())?;)*
+                    ::std::result::Result::Ok(())
+                }
+            }
+        }
+    }
+
+    fn to_item_methods(&self) -> TokenStream {
+        let name = &self.name;
+
+        let methods = self.field_names().map(|field_name| {
+            // Markdown-formatted field name for the doc comment.
+            let markdown_field_name = format!("`{}`", field_name);
+            let markdown_field_name = LitStr::new(&markdown_field_name, field_name.span());
+
+            // Use the field name's span for good duplicate-method-name error messages.
+            quote_spanned! {field_name.span()=>
+                #[doc = "Returns the "]
+                #[doc = #markdown_field_name]
+                #[doc = " path."]
+                pub fn #field_name(&self) -> &::std::path::Path { &self.#field_name }
+            }
+        });
+
+        quote! {
+            impl #name {
+                #(#methods)*
+
+                 /// Returns the root path for this directory layout.
+                pub fn root(&self) -> &::std::path::Path { &self.root }
+            }
+        }
+    }
+
+    fn to_ctor(&self) -> TokenStream {
+        let name = &self.name;
+        let root = Ident::new("root", self.name.span());
+
+        let dir_names = self.dir_names();
+        let dir_inits = self.dirs.iter().map(|entry| entry.to_normal_init(&root));
+
+        let file_names = self.file_names();
+        let file_inits = self.files.iter().map(|entry| entry.to_normal_init(&root));
+
+        let exe_names = self.exe_names();
+        let exe_inits = self.exes.iter().map(|entry| entry.to_exe_init(&root));
+
+        let all_names = dir_names.chain(file_names).chain(exe_names);
+        let all_inits = dir_inits.chain(file_inits).chain(exe_inits);
+
+        let markdown_struct_name = format!("`{}`", name);
+        let markdown_struct_name = LitStr::new(&markdown_struct_name, name.span());
+
+        quote! {
+            impl #name {
+                #[doc = "Constructs a new instance of the "]
+                #[doc = #markdown_struct_name]
+                #[doc = " layout, rooted at `root`."]
+                pub fn new(#root: ::std::path::PathBuf) -> Self {
+                    Self {
+                        #(#all_names: #all_inits),* ,
+                        #root: #root
+                    }
+                }
+            }
+        }
+    }
+
+    pub(crate) fn codegen(&self) -> TokenStream {
+        let struct_decl = self.to_struct_decl();
+        let ctor = self.to_ctor();
+        let item_methods = self.to_item_methods();
+        let create_method = self.to_create_method();
+
+        quote! {
+            #struct_decl
+            #ctor
+            #item_methods
+            #create_method
+        }
+    }
+}
+
+pub(crate) struct Entry {
+    pub(crate) name: Ident,
+    pub(crate) context: Vec<LitStr>,
+    pub(crate) filename: LitStr,
+}
+
+impl Entry {
+    fn to_normal_init(&self, root: &Ident) -> TokenStream {
+        let name = &self.name;
+        let path_items = self.context.iter();
+        let name_replicated = self.context.iter().map(|_| name);
+        let filename = &self.filename;
+
+        quote! {
+            {
+                let mut #name = #root.clone();
+                #(#name_replicated.push(#path_items);)*
+                #name.push(#filename);
+                #name
+            }
+        }
+    }
+
+    fn to_exe_init(&self, root: &Ident) -> TokenStream {
+        let name = &self.name;
+        let path_items = self.context.iter();
+        let name_replicated = self.context.iter().map(|_| name);
+        let filename = &self.filename;
+
+        quote! {
+            {
+                let mut #name = #root.clone();
+                #(#name_replicated.push(#path_items);)*
+                #name.push(::std::format!("{}{}", #filename, ::std::env::consts::EXE_SUFFIX));
+                #name
+            }
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_layout_macro/lib.rs.html b/main/src/volta_layout_macro/lib.rs.html new file mode 100644 index 000000000..372607a90 --- /dev/null +++ b/main/src/volta_layout_macro/lib.rs.html @@ -0,0 +1,117 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
#![recursion_limit = "128"]
+
+extern crate proc_macro;
+
+mod ast;
+mod ir;
+
+use crate::ast::Ast;
+use proc_macro::TokenStream;
+use syn::parse_macro_input;
+
+/// A macro for defining Volta directory layout hierarchies.
+///
+/// The syntax of `layout!` takes the form:
+///
+/// ```text,no_run
+/// layout! {
+///     LayoutStruct*
+/// }
+/// ```
+///
+/// The syntax of a `LayoutStruct` takes the form:
+///
+/// ```text,no_run
+/// Attribute* Visibility "struct" Ident Directory
+/// ```
+///
+/// The syntax of a `Directory` takes the form:
+///
+/// ```text,no_run
+/// {
+///     (FieldPrefix)FieldContents*
+/// }
+/// ```
+///
+/// The syntax of a `FieldPrefix` takes the form:
+///
+/// ```text,no_run
+/// LitStr ":" Ident
+/// ```
+///
+/// The syntax of a `FieldContents` is either:
+///
+/// ```text,no_run
+/// ";"
+/// ```
+///
+/// or:
+///
+/// ```text,no_run
+/// Directory
+/// ```
+#[proc_macro]
+pub fn layout(input: TokenStream) -> TokenStream {
+    let ast = parse_macro_input!(input as Ast);
+    let expanded = ast.compile();
+    TokenStream::from(expanded)
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/empty.rs.html b/main/src/volta_migrate/empty.rs.html new file mode 100644 index 000000000..b283152ba --- /dev/null +++ b/main/src/volta_migrate/empty.rs.html @@ -0,0 +1,31 @@ +empty.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
use std::path::PathBuf;
+
+/// Represents an Empty (or uninitialized) Volta layout, one that has never been used by any prior version
+///
+/// This is the easiest to migrate from, as we simply need to create the current layout within the .volta
+/// directory
+pub struct Empty {
+    pub home: PathBuf,
+}
+
+impl Empty {
+    pub fn new(home: PathBuf) -> Self {
+        Empty { home }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/lib.rs.html b/main/src/volta_migrate/lib.rs.html new file mode 100644 index 000000000..6545f0605 --- /dev/null +++ b/main/src/volta_migrate/lib.rs.html @@ -0,0 +1,359 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+
//! Provides types for modeling the current state of the Volta directory and for migrating between versions
+//!
+//! A new layout should be represented by its own struct (as in the existing v0 or v1 modules)
+//! Migrations between types should be represented by `TryFrom` implementations between the layout types
+//! (see v1.rs for examples)
+//!
+//! NOTE: Since the layout file is written once the migration is complete, all migration implementations
+//! need to be aware that they may be partially applied (if something fails in the process) and should be
+//! able to re-start gracefully from an interrupted migration
+
+use std::path::Path;
+
+mod empty;
+mod v0;
+mod v1;
+mod v2;
+mod v3;
+mod v4;
+
+use v0::V0;
+use v1::V1;
+use v2::V2;
+use v3::V3;
+use v4::V4;
+
+use log::{debug, info};
+use volta_core::error::Fallible;
+use volta_core::layout::volta_home;
+#[cfg(unix)]
+use volta_core::layout::volta_install;
+use volta_core::shim::regenerate_shims_for_dir;
+use volta_core::sync::VoltaLock;
+
+/// Represents the state of the Volta directory at every point in the migration process
+///
+/// Migrations should be applied sequentially, migrating from V0 to V1 to ... as needed, cycling
+/// through the possible MigrationState values.
+enum MigrationState {
+    Empty(empty::Empty),
+    V0(Box<V0>),
+    V1(Box<V1>),
+    V2(Box<V2>),
+    V3(Box<V3>),
+    V4(Box<V4>),
+}
+
+/// Macro to simplify the boilerplate associated with detecting a tagged state.
+///
+/// Should be passed a series of tuples, each of which contains (in this order):
+///
+/// * The layout version (module name from `volta_layout` crate, e.g. `v1`)
+/// * The `MigrationState` variant name (e.g. `V1`)
+/// * The migration object itself (e.g. `V1` from the v1 module in _this_ crate)
+///
+/// The tuples should be in reverse chronological order, so that the newest is first, e.g.:
+///
+/// detect_tagged!((v3, V3, V3), (v2, V2, V2), (v1, V1, V1));
+macro_rules! detect_tagged {
+    ($(($layout:ident, $variant:ident, $migration:ident)),*) => {
+        impl MigrationState {
+            fn detect_tagged_state(home: &::std::path::Path) -> Option<Self> {
+                None
+                $(
+                    .or_else(|| detect::$layout(home))
+                )*
+            }
+        }
+
+        mod detect {
+            $(
+                pub(super) fn $layout(home: &::std::path::Path) -> Option<super::MigrationState> {
+                    let volta_home = volta_layout::$layout::VoltaHome::new(home.to_owned());
+                    if volta_home.layout_file().exists() {
+                        Some(super::MigrationState::$variant(Box::new(super::$migration::new(home.to_owned()))))
+                    } else {
+                        None
+                    }
+                }
+            )*
+        }
+    }
+}
+
+detect_tagged!((v4, V4, V4), (v3, V3, V3), (v2, V2, V2), (v1, V1, V1));
+
+impl MigrationState {
+    fn current() -> Fallible<Self> {
+        // First look for a tagged version (V1+). If that can't be found, then go through the triage
+        // for detecting a legacy version
+
+        let home = volta_home()?;
+
+        match MigrationState::detect_tagged_state(home.root()) {
+            Some(state) => Ok(state),
+            None => MigrationState::detect_legacy_state(home.root()),
+        }
+    }
+
+    #[allow(clippy::unnecessary_wraps)] // Needs to be Fallible for Unix
+    fn detect_legacy_state(home: &Path) -> Fallible<Self> {
+        /*
+        Triage for determining the legacy layout version:
+        - Does Volta Home exist?
+            - If yes (Windows) then V0
+            - If yes (Unix) then check if Volta Install is outside shim_dir?
+                - If yes, then V0
+                - If no, then check if $VOLTA_HOME/load.sh exists? If yes then V0
+        - Else Empty
+
+        The extra logic on Unix is necessary because Unix installs can be either inside or outside $VOLTA_HOME
+        If it is inside, then the directory necessarily must exist, so we can't use that as a determination.
+        If it is outside (and for Windows which is always outside), then if $VOLTA_HOME exists, it must be from a
+        previous, V0 installation.
+        */
+
+        let volta_home = home.to_owned();
+
+        if volta_home.exists() {
+            #[cfg(windows)]
+            return Ok(MigrationState::V0(Box::new(V0::new(volta_home))));
+
+            #[cfg(unix)]
+            {
+                let install = volta_install()?;
+                if install.root().starts_with(&volta_home) {
+                    // Installed inside $VOLTA_HOME, so need to look for `load.sh` as a marker
+                    if volta_home.join("load.sh").exists() {
+                        return Ok(MigrationState::V0(Box::new(V0::new(volta_home))));
+                    }
+                } else {
+                    // Installed outside of $VOLTA_HOME, so it must exist from a previous V0 install
+                    return Ok(MigrationState::V0(Box::new(V0::new(volta_home))));
+                }
+            }
+        }
+
+        Ok(MigrationState::Empty(empty::Empty::new(volta_home)))
+    }
+}
+
+pub fn run_migration() -> Fallible<()> {
+    // Acquire an exclusive lock on the Volta directory, to ensure that no other migrations are running.
+    // If this fails, however, we still need to run the migration
+    match VoltaLock::acquire() {
+        Ok(_lock) => {
+            // The lock was acquired, so we can be confident that no other migrations are running
+            detect_and_migrate()
+        }
+        Err(_) => {
+            debug!("Unable to acquire lock on Volta directory! Running migration anyway.");
+            detect_and_migrate()
+        }
+    }
+}
+
+fn detect_and_migrate() -> Fallible<()> {
+    info!("Updating your Volta directory. This may take a few moments...");
+    let mut state = MigrationState::current()?;
+
+    // To keep the complexity of writing a new migration from continuously increasing, each new
+    // layout version only needs to implement a migration from 2 states: Empty and the previously
+    // latest version. We then apply the migrations sequentially here: V0 -> V1 -> ... -> VX
+    loop {
+        state = match state {
+            MigrationState::Empty(e) => MigrationState::V3(Box::new(e.try_into()?)),
+            MigrationState::V0(zero) => MigrationState::V1(Box::new((*zero).try_into()?)),
+            MigrationState::V1(one) => MigrationState::V2(Box::new((*one).try_into()?)),
+            MigrationState::V2(two) => MigrationState::V3(Box::new((*two).try_into()?)),
+            MigrationState::V3(three) => MigrationState::V4(Box::new((*three).try_into()?)),
+            MigrationState::V4(_) => {
+                break;
+            }
+        };
+    }
+
+    regenerate_shims_for_dir(volta_home()?.shim_dir())?;
+
+    Ok(())
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/v0.rs.html b/main/src/volta_migrate/v0.rs.html new file mode 100644 index 000000000..073041998 --- /dev/null +++ b/main/src/volta_migrate/v0.rs.html @@ -0,0 +1,39 @@ +v0.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+
use std::path::PathBuf;
+
+use volta_layout::v0::VoltaHome;
+
+/// Represents a V0 Volta layout (from before v0.7.0)
+///
+/// This needs some migration work to move up to V1, so we keep a reference to the V0 layout
+/// struct to allow for easy comparison between versions
+pub struct V0 {
+    pub home: VoltaHome,
+}
+
+impl V0 {
+    pub fn new(home: PathBuf) -> Self {
+        V0 {
+            home: VoltaHome::new(home),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/v1.rs.html b/main/src/volta_migrate/v1.rs.html new file mode 100644 index 000000000..c155a47da --- /dev/null +++ b/main/src/volta_migrate/v1.rs.html @@ -0,0 +1,197 @@ +v1.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+
#[cfg(unix)]
+use std::fs::remove_file;
+use std::fs::File;
+use std::path::PathBuf;
+
+use super::empty::Empty;
+use super::v0::V0;
+use log::debug;
+use volta_core::error::{Context, ErrorKind, Fallible, VoltaError};
+#[cfg(unix)]
+use volta_core::fs::{read_dir_eager, remove_file_if_exists};
+use volta_layout::v1;
+
+/// Represents a V1 Volta Layout (used by Volta v0.7.0 - v0.7.2)
+///
+/// Holds a reference to the V1 layout struct to support potential future migrations
+pub struct V1 {
+    pub home: v1::VoltaHome,
+}
+
+impl V1 {
+    pub fn new(home: PathBuf) -> Self {
+        V1 {
+            home: v1::VoltaHome::new(home),
+        }
+    }
+
+    /// Write the layout file to mark migration to V1 as complete
+    ///
+    /// Should only be called once all other migration steps are finished, so that we don't
+    /// accidentally mark an incomplete migration as completed
+    fn complete_migration(home: v1::VoltaHome) -> Fallible<Self> {
+        debug!("Writing layout marker file");
+        File::create(home.layout_file()).with_context(|| ErrorKind::CreateLayoutFileError {
+            file: home.layout_file().to_owned(),
+        })?;
+
+        Ok(V1 { home })
+    }
+}
+
+impl TryFrom<Empty> for V1 {
+    type Error = VoltaError;
+
+    fn try_from(old: Empty) -> Fallible<V1> {
+        debug!("New Volta installation detected, creating fresh layout");
+
+        let home = v1::VoltaHome::new(old.home);
+        home.create().with_context(|| ErrorKind::CreateDirError {
+            dir: home.root().to_owned(),
+        })?;
+
+        V1::complete_migration(home)
+    }
+}
+
+impl TryFrom<V0> for V1 {
+    type Error = VoltaError;
+
+    fn try_from(old: V0) -> Fallible<V1> {
+        debug!("Existing Volta installation detected, migrating from V0 layout");
+
+        let new_home = v1::VoltaHome::new(old.home.root().to_owned());
+        new_home
+            .create()
+            .with_context(|| ErrorKind::CreateDirError {
+                dir: new_home.root().to_owned(),
+            })?;
+
+        #[cfg(unix)]
+        {
+            debug!("Removing unnecessary 'load.*' files");
+            let root_contents =
+                read_dir_eager(new_home.root()).with_context(|| ErrorKind::ReadDirError {
+                    dir: new_home.root().to_owned(),
+                })?;
+            for (entry, _) in root_contents {
+                let path = entry.path();
+                if let Some(stem) = path.file_stem() {
+                    if stem == "load" && path.is_file() {
+                        remove_file(&path)
+                            .with_context(|| ErrorKind::DeleteFileError { file: path })?;
+                    }
+                }
+            }
+
+            debug!("Removing old Volta binaries");
+
+            let old_volta_bin = new_home.root().join("volta");
+            remove_file_if_exists(old_volta_bin)?;
+
+            let old_shim_bin = new_home.root().join("shim");
+            remove_file_if_exists(old_shim_bin)?;
+        }
+
+        V1::complete_migration(new_home)
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/v2.rs.html b/main/src/volta_migrate/v2.rs.html new file mode 100644 index 000000000..d5bbf71f8 --- /dev/null +++ b/main/src/volta_migrate/v2.rs.html @@ -0,0 +1,369 @@ +v2.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+
use std::fs::{read_to_string, write, File};
+use std::io;
+use std::path::{Path, PathBuf};
+
+use super::empty::Empty;
+use super::v1::V1;
+use log::debug;
+use node_semver::Version;
+use tempfile::tempdir_in;
+use volta_core::error::{Context, ErrorKind, Fallible, VoltaError};
+use volta_core::fs::{read_dir_eager, remove_dir_if_exists, remove_file_if_exists, rename};
+use volta_core::tool::load_default_npm_version;
+use volta_core::toolchain::serial::Platform;
+use volta_core::version::parse_version;
+use volta_layout::{v1, v2};
+
+/// Represents a V2 Volta Layout (used by Volta v0.7.3 and above)
+///
+/// Holds a reference to the V2 layout struct to support potential future migrations
+pub struct V2 {
+    pub home: v2::VoltaHome,
+}
+
+impl V2 {
+    pub fn new(home: PathBuf) -> Self {
+        V2 {
+            home: v2::VoltaHome::new(home),
+        }
+    }
+
+    /// Write the layout file to mark migration to V2 as complete
+    ///
+    /// Should only be called once all other migration steps are finished, so that we don't
+    /// accidentally mark an incomplete migration as completed
+    fn complete_migration(home: v2::VoltaHome) -> Fallible<Self> {
+        debug!("Writing layout marker file");
+        File::create(home.layout_file()).with_context(|| ErrorKind::CreateLayoutFileError {
+            file: home.layout_file().to_owned(),
+        })?;
+
+        Ok(V2 { home })
+    }
+}
+
+impl TryFrom<Empty> for V2 {
+    type Error = VoltaError;
+
+    fn try_from(old: Empty) -> Fallible<V2> {
+        debug!("New Volta installation detected, creating fresh layout");
+
+        let home = v2::VoltaHome::new(old.home);
+        home.create().with_context(|| ErrorKind::CreateDirError {
+            dir: home.root().to_owned(),
+        })?;
+
+        V2::complete_migration(home)
+    }
+}
+
+impl TryFrom<V1> for V2 {
+    type Error = VoltaError;
+
+    fn try_from(old: V1) -> Fallible<V2> {
+        debug!("Migrating from V1 layout");
+
+        let new_home = v2::VoltaHome::new(old.home.root().to_owned());
+        new_home
+            .create()
+            .with_context(|| ErrorKind::CreateDirError {
+                dir: new_home.root().to_owned(),
+            })?;
+
+        // Perform the core of the migration
+        clear_default_npm(old.home.default_platform_file())?;
+        shift_node_images(&old.home, &new_home)?;
+
+        // Complete the migration, writing the V2 layout file
+        let layout = V2::complete_migration(new_home)?;
+
+        // Remove the V1 layout file, since we're now on V2 (do this after writing the V2 so that we know the migration succeeded)
+        let old_layout_file = old.home.layout_file();
+        remove_file_if_exists(old_layout_file)?;
+        Ok(layout)
+    }
+}
+
+/// Clear npm from the default `platform.json` file if it is set to the same value as that bundled with Node
+///
+/// This will ensure that we don't treat the default npm from a prior version of Volta as a "custom" npm that
+/// the user explicitly requested
+fn clear_default_npm(platform_file: &Path) -> Fallible<()> {
+    let platform_json = match read_to_string(platform_file) {
+        Ok(json) => json,
+        Err(error) => {
+            if error.kind() == io::ErrorKind::NotFound {
+                return Ok(());
+            } else {
+                return Err(VoltaError::from_source(
+                    error,
+                    ErrorKind::ReadPlatformError {
+                        file: platform_file.to_path_buf(),
+                    },
+                ));
+            }
+        }
+    };
+    let mut existing_platform = Platform::try_from(platform_json)?;
+
+    if let Some(ref mut node_version) = &mut existing_platform.node {
+        if let Some(npm) = &node_version.npm {
+            if let Ok(default_npm) = load_default_npm_version(&node_version.runtime) {
+                if *npm == default_npm {
+                    node_version.npm = None;
+                    write(platform_file, existing_platform.into_json()?).with_context(|| {
+                        ErrorKind::WritePlatformError {
+                            file: platform_file.to_owned(),
+                        }
+                    })?;
+                }
+            }
+        }
+    }
+
+    Ok(())
+}
+
+/// Move all Node images up one directory, removing the default npm version directory
+///
+/// In the V1 layout, we kept all node images in /<node_version>/<npm_version>/, however we will be
+/// storing custom npm versions in a separate image directory, so there is no need to maintain the
+/// bundled npm version in the file structure any more. This also will make it slightly easier to access
+/// the Node image, as we no longer will need to look up the bundled npm version every time.
+fn shift_node_images(old_home: &v1::VoltaHome, new_home: &v2::VoltaHome) -> Fallible<()> {
+    let temp_dir =
+        tempdir_in(new_home.tmp_dir()).with_context(|| ErrorKind::CreateTempDirError {
+            in_dir: new_home.tmp_dir().to_owned(),
+        })?;
+    let node_installs = read_dir_eager(old_home.node_image_root_dir())
+        .with_context(|| ErrorKind::ReadDirError {
+            dir: old_home.node_image_root_dir().to_owned(),
+        })?
+        .filter_map(|(entry, metadata)| {
+            if metadata.is_dir() {
+                parse_version(entry.file_name().to_string_lossy()).ok()
+            } else {
+                None
+            }
+        });
+
+    for node_version in node_installs {
+        remove_npm_version_from_node_image_dir(old_home, new_home, node_version, temp_dir.path())?;
+    }
+
+    Ok(())
+}
+
+/// Move a single node image up a directory, if it currently has the npm version in its path
+fn remove_npm_version_from_node_image_dir(
+    old_home: &v1::VoltaHome,
+    new_home: &v2::VoltaHome,
+    node_version: Version,
+    temp_dir: &Path,
+) -> Fallible<()> {
+    let node_string = node_version.to_string();
+    let npm_version = load_default_npm_version(&node_version)?;
+    let old_install = old_home.node_image_dir(&node_string, &npm_version.to_string());
+
+    if old_install.exists() {
+        let temp_image = temp_dir.join(&node_string);
+        let new_install = new_home.node_image_dir(&node_string);
+        rename(&old_install, &temp_image).with_context(|| ErrorKind::SetupToolImageError {
+            tool: "Node".into(),
+            version: node_string.clone(),
+            dir: temp_image.clone(),
+        })?;
+        remove_dir_if_exists(&new_install)?;
+        rename(&temp_image, &new_install).with_context(|| ErrorKind::SetupToolImageError {
+            tool: "Node".into(),
+            version: node_string,
+            dir: temp_image,
+        })?;
+    }
+    Ok(())
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/v3.rs.html b/main/src/volta_migrate/v3.rs.html new file mode 100644 index 000000000..1c903d27f --- /dev/null +++ b/main/src/volta_migrate/v3.rs.html @@ -0,0 +1,335 @@ +v3.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+
use std::fs::File;
+use std::path::{Path, PathBuf};
+
+use crate::empty::Empty;
+use crate::v2::V2;
+use log::{debug, warn};
+use volta_core::error::{Context, ErrorKind, Fallible, VoltaError};
+use volta_core::fs::{remove_dir_if_exists, remove_file_if_exists};
+use volta_core::platform::PlatformSpec;
+use volta_core::session::Session;
+use volta_core::tool::{Package, PackageConfig};
+use volta_core::version::VersionSpec;
+use volta_layout::{v2, v3};
+use walkdir::WalkDir;
+
+mod config;
+
+use config::LegacyPackageConfig;
+
+/// Represents a V3 Volta layout (used by Volta v0.9.0 and above)
+///
+/// Holds a reference to the V3 layout struct to support future migrations
+pub struct V3 {
+    pub home: v3::VoltaHome,
+}
+
+impl V3 {
+    pub fn new(home: PathBuf) -> Self {
+        V3 {
+            home: v3::VoltaHome::new(home),
+        }
+    }
+
+    /// Write the layout file to mark migration to V2 as complete
+    ///
+    /// Should only be called once all other migration steps are finished, so that we don't
+    /// accidentally mark an incomplete migration as completed
+    fn complete_migration(home: v3::VoltaHome) -> Fallible<Self> {
+        debug!("Writing layout marker file");
+        File::create(home.layout_file()).with_context(|| ErrorKind::CreateLayoutFileError {
+            file: home.layout_file().to_owned(),
+        })?;
+
+        Ok(V3 { home })
+    }
+}
+
+impl TryFrom<Empty> for V3 {
+    type Error = VoltaError;
+
+    fn try_from(old: Empty) -> Fallible<Self> {
+        debug!("New Volta installation detected, creating fresh layout");
+
+        let home = v3::VoltaHome::new(old.home);
+        home.create().with_context(|| ErrorKind::CreateDirError {
+            dir: home.root().to_owned(),
+        })?;
+
+        V3::complete_migration(home)
+    }
+}
+
+impl TryFrom<V2> for V3 {
+    type Error = VoltaError;
+
+    fn try_from(old: V2) -> Fallible<Self> {
+        debug!("Migrating from V2 layout");
+
+        let new_home = v3::VoltaHome::new(old.home.root().to_owned());
+        new_home
+            .create()
+            .with_context(|| ErrorKind::CreateDirError {
+                dir: new_home.root().to_owned(),
+            })?;
+
+        // Migrate installed packages to the new workflow
+        migrate_packages(&old.home)?;
+
+        // Remove the package inventory directory, as we no longer cache package tarballs
+        remove_dir_if_exists(old.home.package_inventory_dir())?;
+
+        // Complete the migration, writing the V3 layout file
+        let layout = V3::complete_migration(new_home)?;
+
+        // Remove the V2 layout file, since we're now on V3 (do this after writing the V3 file so that we know the migration succeeded)
+        remove_file_if_exists(old.home.layout_file())?;
+
+        Ok(layout)
+    }
+}
+
+fn migrate_packages(old_home: &v2::VoltaHome) -> Fallible<()> {
+    let packages = get_installed_packages(old_home);
+    let mut session = Session::init();
+
+    for package in packages {
+        migrate_single_package(package, &mut session)?;
+    }
+
+    Ok(())
+}
+
+/// Determine a list of all installed packages that are using the legacy package config
+fn get_installed_packages(old_home: &v2::VoltaHome) -> Vec<LegacyPackageConfig> {
+    WalkDir::new(old_home.default_package_dir())
+        .max_depth(2)
+        .into_iter()
+        .filter_map(|res| match res {
+            Ok(entry) => {
+                if entry.file_type().is_file() {
+                    let config = LegacyPackageConfig::from_file(entry.path());
+
+                    // If unable to parse the config file and this isn't an already-migrated
+                    // package, then show debug information and a warning for the user.
+                    if config.is_none() && !is_migrated_config(entry.path()) {
+                        debug!("Unable to parse config file: {}", entry.path().display());
+                        if let Some(name) = entry.path().file_stem() {
+                            let name = name.to_string_lossy();
+                            warn!(
+                                "Could not migrate {}. Please run `volta install {0}` to migrate the package manually.",
+                                name
+                            );
+                        }
+                    }
+
+                    config
+                } else {
+                    None
+                }
+            }
+            Err(error) => {
+                debug!("Error reading directory entry: {}", error);
+                None
+            }
+        })
+        .collect()
+}
+
+/// Determine if a package has already been migrated by attempting to read the V3 PackageConfig
+fn is_migrated_config(config_path: &Path) -> bool {
+    PackageConfig::from_file(config_path).is_ok()
+}
+
+/// Migrate a single package to the new workflow
+///
+/// Note: This relies on the package install logic in `volta_core`. If that logic changes, then
+/// the end result may not be a valid V3 layout any more, and this migration will need to be
+/// updated. Specifically, the invariants we rely on are:
+///
+/// - Package image directory is in the same location
+/// - Package config files are in the same location and the same format
+/// - Binary config files are in the same location and the same format
+///
+/// If any of those are violated, this migration may be invalid and need to be reworked / scrapped
+fn migrate_single_package(config: LegacyPackageConfig, session: &mut Session) -> Fallible<()> {
+    let tool = Package::new(config.name, VersionSpec::Exact(config.version))?;
+
+    let platform: PlatformSpec = config.platform.into();
+    let image = platform.as_binary().checkout(session)?;
+
+    // Run the global install command
+    tool.run_install(&image)?;
+    // Overwrite the config files and image directory
+    tool.complete_install(&image)?;
+
+    Ok(())
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/v3/config.rs.html b/main/src/volta_migrate/v3/config.rs.html new file mode 100644 index 000000000..0cf9ce2ef --- /dev/null +++ b/main/src/volta_migrate/v3/config.rs.html @@ -0,0 +1,101 @@ +config.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+
use std::fs::File;
+use std::path::Path;
+
+use node_semver::Version;
+use volta_core::platform::PlatformSpec;
+use volta_core::version::{option_version_serde, version_serde};
+
+#[derive(serde::Deserialize)]
+pub struct LegacyPackageConfig {
+    pub name: String,
+    #[serde(with = "version_serde")]
+    pub version: Version,
+    pub platform: LegacyPlatform,
+    pub bins: Vec<String>,
+}
+
+#[derive(serde::Deserialize)]
+pub struct LegacyPlatform {
+    pub node: NodeVersion,
+    #[serde(with = "option_version_serde")]
+    pub yarn: Option<Version>,
+}
+
+#[derive(serde::Deserialize)]
+pub struct NodeVersion {
+    #[serde(with = "version_serde")]
+    pub runtime: Version,
+    #[serde(with = "option_version_serde")]
+    pub npm: Option<Version>,
+}
+
+impl LegacyPackageConfig {
+    pub fn from_file(config_file: &Path) -> Option<Self> {
+        let file = File::open(config_file).ok()?;
+
+        serde_json::from_reader(file).ok()
+    }
+}
+
+impl From<LegacyPlatform> for PlatformSpec {
+    fn from(config_platform: LegacyPlatform) -> Self {
+        PlatformSpec {
+            node: config_platform.node.runtime,
+            npm: config_platform.node.npm,
+            // LegacyPlatform (layout.v2) doesn't have a pnpm field
+            pnpm: None,
+            yarn: config_platform.yarn,
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/v4.rs.html b/main/src/volta_migrate/v4.rs.html new file mode 100644 index 000000000..15274bd2b --- /dev/null +++ b/main/src/volta_migrate/v4.rs.html @@ -0,0 +1,295 @@ +v4.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+
use std::fs::File;
+use std::path::PathBuf;
+
+use super::empty::Empty;
+use super::v3::V3;
+use log::debug;
+use volta_core::error::{Context, ErrorKind, Fallible, VoltaError};
+#[cfg(windows)]
+use volta_core::fs::read_dir_eager;
+use volta_core::fs::remove_file_if_exists;
+use volta_layout::v4;
+
+/// Represents a V4 Volta Layout (used by Volta v2.0.0 and above)
+///
+/// Holds a reference to the V4 layout struct to support potential future migrations
+pub struct V4 {
+    pub home: v4::VoltaHome,
+}
+
+impl V4 {
+    pub fn new(home: PathBuf) -> Self {
+        V4 {
+            home: v4::VoltaHome::new(home),
+        }
+    }
+
+    /// Write the layout file to mark migration to V4 as complete
+    ///
+    /// Should only be called once all other migration steps are finished, so that we don't
+    /// accidentally mark an incomplete migration as completed
+    fn complete_migration(home: v4::VoltaHome) -> Fallible<Self> {
+        debug!("Writing layout marker file");
+        File::create(home.layout_file()).with_context(|| ErrorKind::CreateLayoutFileError {
+            file: home.layout_file().to_owned(),
+        })?;
+
+        Ok(V4 { home })
+    }
+}
+
+impl TryFrom<Empty> for V4 {
+    type Error = VoltaError;
+
+    fn try_from(old: Empty) -> Fallible<V4> {
+        debug!("New Volta installation detected, creating fresh layout");
+
+        let home = v4::VoltaHome::new(old.home);
+        home.create().with_context(|| ErrorKind::CreateDirError {
+            dir: home.root().to_owned(),
+        })?;
+
+        V4::complete_migration(home)
+    }
+}
+
+impl TryFrom<V3> for V4 {
+    type Error = VoltaError;
+
+    fn try_from(old: V3) -> Fallible<V4> {
+        debug!("Migrating from V3 layout");
+
+        let new_home = v4::VoltaHome::new(old.home.root().to_owned());
+        new_home
+            .create()
+            .with_context(|| ErrorKind::CreateDirError {
+                dir: new_home.root().to_owned(),
+            })?;
+
+        // Perform the core of the migration
+        #[cfg(windows)]
+        {
+            migrate_shims(&new_home)?;
+            migrate_shared_directory(&new_home)?;
+        }
+
+        // Complete the migration, writing the V4 layout file
+        let layout = V4::complete_migration(new_home)?;
+
+        // Remove the V3 layout file, since we're now on V4 (do this after writing the V4 so that we know the migration succeeded)
+        let old_layout_file = old.home.layout_file();
+        remove_file_if_exists(old_layout_file)?;
+        Ok(layout)
+    }
+}
+
+/// Migrate Windows shims to use the new non-symlink approach. Previously, shims were created in
+/// the same way as on Unix: With symlinks to the `volta-shim` executable. Now, we use scripts that
+/// call `volta run` to execute the underlying tool. This allows us to avoid needing developer
+/// mode, making Volta more broadly usable for Windows devs.
+///
+/// To migrate the shims, we read the shim directory looking for symlinks, remove those, and then
+/// file stem (name without extension) to generate new shims.
+#[cfg(windows)]
+fn migrate_shims(new_home: &v4::VoltaHome) -> Fallible<()> {
+    use std::ffi::OsStr;
+
+    let entries = read_dir_eager(new_home.shim_dir()).with_context(|| ErrorKind::ReadDirError {
+        dir: new_home.shim_dir().to_owned(),
+    })?;
+
+    for (entry, metadata) in entries {
+        if metadata.is_symlink() {
+            let path = entry.path();
+            remove_file_if_exists(&path)?;
+
+            if let Some(shim_name) = path.file_stem().and_then(OsStr::to_str) {
+                volta_core::shim::create(shim_name)?;
+            }
+        }
+    }
+
+    Ok(())
+}
+
+/// Migrate Windows shared directory to use junctions rather than directory symlinks. Similar to
+/// the shims, we previously used symlinks to create the shared global package directory, which
+/// requires developer mode. By using junctions, we can avoid that requirement entirely.
+///
+/// To migrate the directories, we read the shim directory, determine the target of each symlink,
+/// delete the link, and then create a junction (using volta_core::fs::symlink_dir which delegates
+/// to `junction` internally)
+#[cfg(windows)]
+fn migrate_shared_directory(new_home: &v4::VoltaHome) -> Fallible<()> {
+    use std::fs::read_link;
+    use volta_core::fs::{remove_dir_if_exists, symlink_dir};
+
+    let entries =
+        read_dir_eager(new_home.shared_lib_root()).with_context(|| ErrorKind::ReadDirError {
+            dir: new_home.shared_lib_root().to_owned(),
+        })?;
+
+    for (entry, metadata) in entries {
+        if metadata.is_symlink() {
+            let path = entry.path();
+            let source = read_link(&path).with_context(|| ErrorKind::ReadDirError {
+                dir: new_home.shared_lib_root().to_owned(),
+            })?;
+
+            remove_dir_if_exists(&path)?;
+            symlink_dir(source, path).with_context(|| ErrorKind::CreateSharedLinkError {
+                name: entry.file_name().to_string_lossy().to_string(),
+            })?;
+        }
+    }
+
+    Ok(())
+}
+
\ No newline at end of file diff --git a/main/src/volta_migrate/volta-migrate.rs.html b/main/src/volta_migrate/volta-migrate.rs.html new file mode 100644 index 000000000..a2a46d61a --- /dev/null +++ b/main/src/volta_migrate/volta-migrate.rs.html @@ -0,0 +1,53 @@ +volta-migrate.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+
use volta_core::error::{report_error, ExitCode};
+use volta_core::layout::volta_home;
+use volta_core::log::{LogContext, LogVerbosity, Logger};
+use volta_migrate::run_migration;
+
+pub fn main() {
+    Logger::init(LogContext::Migration, LogVerbosity::Default)
+        .expect("Only a single Logger should be initialized");
+
+    // In order to migrate the existing Volta directory while avoiding unconditional changes to the user's system,
+    // the Homebrew formula runs volta-migrate with `--no-create` flag in the post-install phase.
+    let no_create = matches!(std::env::args_os().nth(1), Some(flag) if flag == "--no-create");
+    if no_create && volta_home().map_or(true, |home| !home.root().exists()) {
+        ExitCode::Success.exit();
+    }
+
+    let exit_code = match run_migration() {
+        Ok(()) => ExitCode::Success,
+        Err(err) => {
+            report_error(env!("CARGO_PKG_VERSION"), &err);
+            err.exit_code()
+        }
+    };
+
+    exit_code.exit();
+}
+
\ No newline at end of file diff --git a/main/src/volta_shim/common.rs.html b/main/src/volta_shim/common.rs.html new file mode 100644 index 000000000..6692e244d --- /dev/null +++ b/main/src/volta_shim/common.rs.html @@ -0,0 +1,89 @@ +common.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
use std::process::{Command, ExitStatus};
+
+use volta_core::error::{Context, ErrorKind, VoltaError};
+use volta_core::layout::{volta_home, volta_install};
+
+pub enum Error {
+    Volta(VoltaError),
+    Tool(i32),
+}
+
+pub fn ensure_layout() -> Result<(), Error> {
+    let home = volta_home().map_err(Error::Volta)?;
+
+    if !home.layout_file().exists() {
+        let install = volta_install().map_err(Error::Volta)?;
+        Command::new(install.migrate_executable())
+            .env("VOLTA_LOGLEVEL", format!("{}", log::max_level()))
+            .status()
+            .with_context(|| ErrorKind::CouldNotStartMigration)
+            .into_result()?;
+    }
+
+    Ok(())
+}
+
+pub trait IntoResult<T> {
+    fn into_result(self) -> Result<T, Error>;
+}
+
+impl IntoResult<()> for Result<ExitStatus, VoltaError> {
+    fn into_result(self) -> Result<(), Error> {
+        match self {
+            Ok(status) => {
+                if status.success() {
+                    Ok(())
+                } else {
+                    let code = status.code().unwrap_or(1);
+                    Err(Error::Tool(code))
+                }
+            }
+            Err(err) => Err(Error::Volta(err)),
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/src/volta_shim/volta-shim.rs.html b/main/src/volta_shim/volta-shim.rs.html new file mode 100644 index 000000000..ba1145cd8 --- /dev/null +++ b/main/src/volta_shim/volta-shim.rs.html @@ -0,0 +1,71 @@ +volta-shim.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+
mod common;
+
+use common::{ensure_layout, Error, IntoResult};
+use volta_core::error::{report_error, ExitCode};
+use volta_core::log::{LogContext, LogVerbosity, Logger};
+use volta_core::run::execute_shim;
+use volta_core::session::{ActivityKind, Session};
+use volta_core::signal::setup_signal_handler;
+
+pub fn main() {
+    Logger::init(LogContext::Shim, LogVerbosity::Default)
+        .expect("Only a single Logger should be initialized");
+    setup_signal_handler();
+
+    let mut session = Session::init();
+    session.add_event_start(ActivityKind::Tool);
+
+    let result = ensure_layout().and_then(|()| execute_shim(&mut session).into_result());
+    match result {
+        Ok(()) => {
+            session.add_event_end(ActivityKind::Tool, ExitCode::Success);
+            session.exit(ExitCode::Success);
+        }
+        Err(Error::Tool(code)) => {
+            session.add_event_tool_end(ActivityKind::Tool, code);
+            session.exit_tool(code);
+        }
+        Err(Error::Volta(err)) => {
+            report_error(env!("CARGO_PKG_VERSION"), &err);
+            session.add_event_error(ActivityKind::Tool, &err);
+            session.add_event_end(ActivityKind::Tool, err.exit_code());
+            session.exit(ExitCode::ExecutionFailure);
+        }
+    }
+}
+
\ No newline at end of file diff --git a/main/static.files/COPYRIGHT-23e9bde6c69aea69.txt b/main/static.files/COPYRIGHT-23e9bde6c69aea69.txt new file mode 100644 index 000000000..1447df792 --- /dev/null +++ b/main/static.files/COPYRIGHT-23e9bde6c69aea69.txt @@ -0,0 +1,50 @@ +# REUSE-IgnoreStart + +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/main/static.files/FiraSans-LICENSE-db4b642586e02d97.txt b/main/static.files/FiraSans-LICENSE-db4b642586e02d97.txt new file mode 100644 index 000000000..d7e9c149b --- /dev/null +++ b/main/static.files/FiraSans-LICENSE-db4b642586e02d97.txt @@ -0,0 +1,98 @@ +// REUSE-IgnoreStart + +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/main/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 b/main/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 new file mode 100644 index 000000000..7a1e5fc54 Binary files /dev/null and b/main/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 differ diff --git a/main/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 b/main/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 new file mode 100644 index 000000000..e766e06cc Binary files /dev/null and b/main/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 differ diff --git a/main/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt b/main/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt new file mode 100644 index 000000000..16fe87b06 --- /dev/null +++ b/main/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/main/static.files/LICENSE-MIT-65090b722b3f6c56.txt b/main/static.files/LICENSE-MIT-65090b722b3f6c56.txt new file mode 100644 index 000000000..31aa79387 --- /dev/null +++ b/main/static.files/LICENSE-MIT-65090b722b3f6c56.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/main/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 b/main/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 new file mode 100644 index 000000000..1866ad4bc Binary files /dev/null and b/main/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 differ diff --git a/main/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt b/main/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt new file mode 100644 index 000000000..4b3edc29e --- /dev/null +++ b/main/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt @@ -0,0 +1,103 @@ +// REUSE-IgnoreStart + +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/main/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 b/main/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 new file mode 100644 index 000000000..462c34efc Binary files /dev/null and b/main/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 differ diff --git a/main/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt b/main/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt new file mode 100644 index 000000000..0d2941e14 --- /dev/null +++ b/main/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt @@ -0,0 +1,97 @@ +// REUSE-IgnoreStart + +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/main/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 b/main/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 new file mode 100644 index 000000000..10b558e0b Binary files /dev/null and b/main/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 differ diff --git a/main/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 b/main/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 new file mode 100644 index 000000000..5ec64eef0 Binary files /dev/null and b/main/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 differ diff --git a/main/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/main/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 000000000..181a07f63 Binary files /dev/null and b/main/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/main/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/main/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 000000000..2ae08a7be Binary files /dev/null and b/main/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/main/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md b/main/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md new file mode 100644 index 000000000..175fa4f47 --- /dev/null +++ b/main/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md @@ -0,0 +1,98 @@ + + +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/main/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/main/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 000000000..0263fc304 Binary files /dev/null and b/main/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/main/static.files/clipboard-7571035ce49a181d.svg b/main/static.files/clipboard-7571035ce49a181d.svg new file mode 100644 index 000000000..8adbd9963 --- /dev/null +++ b/main/static.files/clipboard-7571035ce49a181d.svg @@ -0,0 +1 @@ + diff --git a/main/static.files/favicon-16x16-8b506e7a72182f1c.png b/main/static.files/favicon-16x16-8b506e7a72182f1c.png new file mode 100644 index 000000000..ea4b45cae Binary files /dev/null and b/main/static.files/favicon-16x16-8b506e7a72182f1c.png differ diff --git a/main/static.files/favicon-2c020d218678b618.svg b/main/static.files/favicon-2c020d218678b618.svg new file mode 100644 index 000000000..8b34b5119 --- /dev/null +++ b/main/static.files/favicon-2c020d218678b618.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/main/static.files/favicon-32x32-422f7d1d52889060.png b/main/static.files/favicon-32x32-422f7d1d52889060.png new file mode 100644 index 000000000..69b8613ce Binary files /dev/null and b/main/static.files/favicon-32x32-422f7d1d52889060.png differ diff --git a/main/static.files/main-9dd44ab47b99a0fb.js b/main/static.files/main-9dd44ab47b99a0fb.js new file mode 100644 index 000000000..cfb9a38fc --- /dev/null +++ b/main/static.files/main-9dd44ab47b99a0fb.js @@ -0,0 +1,12 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function elemIsInParent(elem,parent){while(elem&&elem!==document.body){if(elem===parent){return true}elem=elem.parentElement}return false}function blurHandler(event,parentElem,hideCallback){if(!elemIsInParent(document.activeElement,parentElem)&&!elemIsInParent(event.relatedTarget,parentElem)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileTopbar=document.querySelector(".mobile-topbar");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileTopbar){const mobileTitle=document.createElement("h2");mobileTitle.className="location";if(hasClass(document.body,"crate")){mobileTitle.innerText=`Crate ${window.currentCrate}`}else if(locationTitle){mobileTitle.innerHTML=locationTitle.innerHTML}mobileTopbar.appendChild(mobileTitle)}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadScript(getVar("static-root-path")+getVar("settings-js"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css")}}},0)};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},removeQueryParameters:()=>{document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash)}},hideResults:()=>{switchDisplayedElement(null);searchState.removeQueryParameters()},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search)},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId)}}if(savedHash.startsWith("impl-")){const splitAt=savedHash.indexOf("/");if(splitAt!==-1){const implId=savedHash.slice(0,splitAt);const assocId=savedHash.slice(splitAt+1);const implElem=document.getElementById(implId);if(implElem&&implElem.parentElement.tagName==="SUMMARY"&&implElem.parentElement.parentElement.tagName==="DETAILS"){onEachLazy(implElem.parentElement.parentElement.querySelectorAll(`[id^="${assocId}"]`),item=>{const numbered=/([^-]+)-([0-9]+)/.exec(item.id);if(item.id===assocId||(numbered&&numbered[1]===assocId)){openParentDetails(item);item.scrollIntoView();setTimeout(()=>{window.location.replace("#"+item.id)},0)}})}}}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();searchState.hideResults();ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const modpath=hasClass(document.body,"mod")?"../":"";const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=`${modpath}${name}/index.html`}else{path=`${modpath}${shortty}.${name}.html`}let current_page=document.location.href.toString();if(current_page.endsWith("/")){current_page+="index.html"}const link=document.createElement("a");link.href=path;if(link.href===current_page){link.className="current"}link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Aliases");block("union","unions","Unions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("opaque","opaque-types","Opaque Types");block("attr","attributes","Attribute Macros");block("derive","derives","Derive Macros");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","));for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}window.register_type_impls=imp=>{if(!imp||!imp[window.currentCrate]){return}window.pending_type_impls=null;const idMap=new Map();let implementations=document.getElementById("implementations-list");let trait_implementations=document.getElementById("trait-implementations-list");let trait_implementations_header=document.getElementById("trait-implementations");const script=document.querySelector("script[data-self-path]");const selfPath=script?script.getAttribute("data-self-path"):null;const mainContent=document.querySelector("#main-content");const sidebarSection=document.querySelector(".sidebar section");let methods=document.querySelector(".sidebar .block.method");let associatedTypes=document.querySelector(".sidebar .block.associatedtype");let associatedConstants=document.querySelector(".sidebar .block.associatedconstant");let sidebarTraitList=document.querySelector(".sidebar .block.trait-implementation");for(const impList of imp[window.currentCrate]){const types=impList.slice(2);const text=impList[0];const isTrait=impList[1]!==0;const traitName=impList[1];if(types.indexOf(selfPath)===-1){continue}let outputList=isTrait?trait_implementations:implementations;if(outputList===null){const outputListName=isTrait?"Trait Implementations":"Implementations";const outputListId=isTrait?"trait-implementations-list":"implementations-list";const outputListHeaderId=isTrait?"trait-implementations":"implementations";const outputListHeader=document.createElement("h2");outputListHeader.id=outputListHeaderId;outputListHeader.innerText=outputListName;outputList=document.createElement("div");outputList.id=outputListId;if(isTrait){const link=document.createElement("a");link.href=`#${outputListHeaderId}`;link.innerText="Trait Implementations";const h=document.createElement("h3");h.appendChild(link);trait_implementations=outputList;trait_implementations_header=outputListHeader;sidebarSection.appendChild(h);sidebarTraitList=document.createElement("ul");sidebarTraitList.className="block trait-implementation";sidebarSection.appendChild(sidebarTraitList);mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}else{implementations=outputList;if(trait_implementations){mainContent.insertBefore(outputListHeader,trait_implementations_header);mainContent.insertBefore(outputList,trait_implementations_header)}else{const mainContent=document.querySelector("#main-content");mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}}}const template=document.createElement("template");template.innerHTML=text;onEachLazy(template.content.querySelectorAll("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});onEachLazy(template.content.querySelectorAll("[id]"),el=>{let i=0;if(idMap.has(el.id)){i=idMap.get(el.id)}else if(document.getElementById(el.id)){i=1;while(document.getElementById(`${el.id}-${2 * i}`)){i=2*i}while(document.getElementById(`${el.id}-${i}`)){i+=1}}if(i!==0){const oldHref=`#${el.id}`;const newHref=`#${el.id}-${i}`;el.id=`${el.id}-${i}`;onEachLazy(template.content.querySelectorAll("a[href]"),link=>{if(link.getAttribute("href")===oldHref){link.href=newHref}})}idMap.set(el.id,i+1)});const templateAssocItems=template.content.querySelectorAll("section.tymethod, "+"section.method, section.associatedtype, section.associatedconstant");if(isTrait){const li=document.createElement("li");const a=document.createElement("a");a.href=`#${template.content.querySelector(".impl").id}`;a.textContent=traitName;li.appendChild(a);sidebarTraitList.append(li)}else{onEachLazy(templateAssocItems,item=>{let block=hasClass(item,"associatedtype")?associatedTypes:(hasClass(item,"associatedconstant")?associatedConstants:(methods));if(!block){const blockTitle=hasClass(item,"associatedtype")?"Associated Types":(hasClass(item,"associatedconstant")?"Associated Constants":("Methods"));const blockClass=hasClass(item,"associatedtype")?"associatedtype":(hasClass(item,"associatedconstant")?"associatedconstant":("method"));const blockHeader=document.createElement("h3");const blockLink=document.createElement("a");blockLink.href="#implementations";blockLink.innerText=blockTitle;blockHeader.appendChild(blockLink);block=document.createElement("ul");block.className=`block ${blockClass}`;const insertionReference=methods||sidebarTraitList;if(insertionReference){const insertionReferenceH=insertionReference.previousElementSibling;sidebarSection.insertBefore(blockHeader,insertionReferenceH);sidebarSection.insertBefore(block,insertionReferenceH)}else{sidebarSection.appendChild(blockHeader);sidebarSection.appendChild(block)}if(hasClass(item,"associatedtype")){associatedTypes=block}else if(hasClass(item,"associatedconstant")){associatedConstants=block}else{methods=block}}const li=document.createElement("li");const a=document.createElement("a");a.innerText=item.id.split("-")[0].split(".")[1];a.href=`#${item.id}`;li.appendChild(a);block.appendChild(li)})}outputList.appendChild(template.content)}for(const list of[methods,associatedTypes,associatedConstants,sidebarTraitList]){if(!list){continue}const newChildren=Array.prototype.slice.call(list.children);newChildren.sort((a,b)=>{const aI=a.innerText;const bI=b.innerText;return aIbI?1:0});list.replaceChildren(...newChildren)}};if(window.pending_type_impls){window.register_type_impls(window.pending_type_impls)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";if(window.rootPath!=="./"&&crate===window.currentCrate){link.className="current"}link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}})}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
"}else{if(e.getAttribute("title")!==null){e.setAttribute("data-title",e.getAttribute("title"));e.removeAttribute("title")}if(e.getAttribute("data-title")!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("data-title")));wrapper.appendChild(titleContent)}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px")}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}clearTooltipHoverTimeout(e)};wrapper.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,e)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out")}}}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element)}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false)}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS)}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)&&!elemIsInParent(document.activeElement,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)&&!elemIsInParent(event.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=()=>{e.TOOLTIP_FORCE_VISIBLE=e.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!e.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(e);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointermove=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!elemIsInParent(ev.relatedTarget,window.CURRENT_TOOLTIP_ELEMENT)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out")}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");const channel=getVar("channel");book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=[`For a full list of all search features, take a look here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for functions that accept or return \ + slices and \ + arrays by writing \ + square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=switchFocus=>{hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=()=>{onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){let reset_button_timeout=null;const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/main/static.files/normalize-76eba96aa4d2e634.css b/main/static.files/normalize-76eba96aa4d2e634.css new file mode 100644 index 000000000..469959f13 --- /dev/null +++ b/main/static.files/normalize-76eba96aa4d2e634.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/main/static.files/noscript-5d8b3c7633ad77ba.css b/main/static.files/noscript-5d8b3c7633ad77ba.css new file mode 100644 index 000000000..8c63ef065 --- /dev/null +++ b/main/static.files/noscript-5d8b3c7633ad77ba.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);}@media (prefers-color-scheme:dark){:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);}} \ No newline at end of file diff --git a/main/static.files/rust-logo-151179464ae7ed46.svg b/main/static.files/rust-logo-151179464ae7ed46.svg new file mode 100644 index 000000000..62424d8ff --- /dev/null +++ b/main/static.files/rust-logo-151179464ae7ed46.svg @@ -0,0 +1,61 @@ + + + diff --git a/main/static.files/rustdoc-9ee3a5e31a2afa3e.css b/main/static.files/rustdoc-9ee3a5e31a2afa3e.css new file mode 100644 index 000000000..8749d0eb1 --- /dev/null +++ b/main/static.files/rustdoc-9ee3a5e31a2afa3e.css @@ -0,0 +1,10 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.src,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.small-section-header a,#src-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p,.docblock>.warning{margin:0 0 .75em 0;}p:last-child,.docblock>.warning:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.src main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.src .content pre{padding:20px;}.rustdoc.src .example-wrap pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.sub-logo-container,.logo-container{line-height:0;display:block;}.sub-logo-container{margin-right:32px;}.sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 200px;overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;}.rustdoc.src .sidebar{flex-basis:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;z-index:1;}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar-toggle,#src-sidebar{background-color:var(--sidebar-background-color);}#src-sidebar-toggle>button:hover,#src-sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.src .sidebar>*:not(#src-sidebar-toggle){visibility:hidden;}.src-sidebar-expanded .src .sidebar{overflow-y:auto;flex-basis:300px;}.src-sidebar-expanded .src .sidebar>*:not(#src-sidebar-toggle){visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.logo-container>img{height:48px;width:48px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-left:-0.25rem;}.sidebar h2{overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>.version,.sidebar>h2{padding-left:24px;}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar .current a,.sidebar-crate a.logo-container:hover+h2 a,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.sidebar-crate{display:flex;align-items:center;justify-content:center;margin:14px 32px 1rem;row-gap:10px;column-gap:32px;flex-wrap:wrap;}.sidebar-crate h2{flex-grow:1;margin:0 -8px;align-self:start;}.sidebar-crate .logo-container{margin:0 -16px 0 -16px;text-align:center;}.sidebar-crate h2 a{display:block;margin:0 calc(-24px + 0.25rem) 0 -0.5rem;padding:calc((16px - 0.57rem ) / 2 ) 0.25rem;padding-left:0.5rem;}.sidebar-crate h2 .version{display:block;font-weight:normal;font-size:1rem;overflow-wrap:break-word;margin-top:calc((-16px + 0.57rem ) / 2 );}.sidebar-crate+.version{margin-top:-1rem;margin-bottom:1rem;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.rustdoc:not(.src) .example-wrap pre{overflow:auto hidden;}.rustdoc .example-wrap pre.example-line-numbers,.rustdoc .example-wrap pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.src .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.method .where,.fn .where,.where.fmt-newline{display:block;white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.src nav.sub{margin:0 0 15px 0;}.small-section-header{display:block;position:relative;}.small-section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.small-section-header>.anchor{left:-15px;padding-right:8px;}h2.small-section-header>.anchor{padding-right:6px;}.main-heading a:hover,.example-wrap .rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block a.current{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:2;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;flex:3;}.search-results .result-name .alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.search-results .result-name .path>*{display:inline;}.popover{position:absolute;top:100%;right:0;z-index:2;margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{min-height:36px;display:flex;padding:3px;margin-bottom:5px;align-items:center;vertical-align:text-bottom;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;vertical-align:baseline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji{font-size:1.25rem;margin-right:0.3rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.src .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}.content .docblock .warning{border-left:2px solid var(--warning-border-color);padding:14px;position:relative;overflow-x:visible !important;}.content .docblock .warning::before{color:var(--warning-border-color);content:"ⓘ";position:absolute;left:-25px;top:5px;font-weight:bold;font-size:1.25rem;}a.test-arrow{visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap:hover .test-arrow{visibility:visible;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;font-variant-numeric:tabular-nums;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar-toggle{position:sticky;top:0;left:0;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:stretch;align-items:stretch;z-index:10;}#src-sidebar{width:100%;overflow:auto;}#src-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid var(--border-color);margin-bottom:6px;}#src-sidebar div.files>a:hover,details.dir-entry summary:hover,#src-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--src-sidebar-background-hover);}#src-sidebar div.files>a.selected{background-color:var(--src-sidebar-background-selected);}#src-sidebar-toggle>button{font-size:inherit;font-weight:bold;background:none;color:inherit;text-align:center;border:none;outline:none;flex:1 1;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;display:flex;}#settings-menu>a,#help-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus{border-color:var(--settings-button-border-focus);}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:34px;margin-left:10px;padding:0;padding-left:2px;border:0;width:33px;}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}@media (max-width:850px){#search-tabs .count{display:block;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.src main,.rustdoc.src .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.src-sidebar-expanded .src .sidebar,.rustdoc:not(.src) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;}.mobile-topbar h2 a{display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;color:var(--main-color);}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#src-sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;border:1px solid;border-left:0;}.src-sidebar-expanded #src-sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#copy-path,#help-button{display:none;}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.src-sidebar-expanded .src .sidebar{max-width:100vw;width:100vw;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.src nav.sub{margin:0;padding:var(--nav-sub-mobile-padding);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}}@media print{nav.sidebar,nav.sub,.out-of-band,a.src,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}.sub-logo-container>img{height:35px;width:35px;margin-bottom:var(--nav-sub-mobile-padding);}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;}:root[data-theme="light"]{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);}:root[data-theme="dark"]{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);}:root[data-theme="ayu"]{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--src-sidebar-background-selected:#14191f;--src-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);}:root[data-theme="ayu"] h1,:root[data-theme="ayu"] h2,:root[data-theme="ayu"] h3,:root[data-theme="ayu"] h4,:where(:root[data-theme="ayu"]) h1 a,:root[data-theme="ayu"] .sidebar h2 a,:root[data-theme="ayu"] .sidebar h3 a,:root[data-theme="ayu"] #source-sidebar>.title{color:#fff;}:root[data-theme="ayu"] .docblock code{color:#ffb454;}:root[data-theme="ayu"] .docblock a>code{color:#39AFD7 !important;}:root[data-theme="ayu"] .code-header,:root[data-theme="ayu"] .docblock pre>code,:root[data-theme="ayu"] pre,:root[data-theme="ayu"] pre>code,:root[data-theme="ayu"] .item-info code,:root[data-theme="ayu"] .rustdoc.source .example-wrap{color:#e6e1cf;}:root[data-theme="ayu"] .sidebar .current,:root[data-theme="ayu"] .sidebar a:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:hover,:root[data-theme="ayu"] details.dir-entry summary:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:focus,:root[data-theme="ayu"] details.dir-entry summary:focus,:root[data-theme="ayu"] #src-sidebar div.files>a.selected{color:#ffb44c;}:root[data-theme="ayu"] .sidebar-elems .location{color:#ff7733;}:root[data-theme="ayu"] .src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}:root[data-theme="ayu"] .search-results a:hover,:root[data-theme="ayu"] .search-results a:focus{color:#fff !important;background-color:#3c3c3c;}:root[data-theme="ayu"] .search-results a{color:#0096cf;}:root[data-theme="ayu"] .search-results a div.desc{color:#c5c5c5;}:root[data-theme="ayu"] .result-name .primitive>i,:root[data-theme="ayu"] .result-name .keyword>i{color:#788797;}:root[data-theme="ayu"] #search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}:root[data-theme="ayu"] #search-tabs>button:not(.selected){border:none;background-color:transparent !important;}:root[data-theme="ayu"] #search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}:root[data-theme="ayu"] #settings-menu>a img{filter:invert(100);} \ No newline at end of file diff --git a/main/static.files/scrape-examples-ef1e698c1d417c0c.js b/main/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 000000000..ba830e374 --- /dev/null +++ b/main/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/main/static.files/search-8fbf244ebcf71464.js b/main/static.files/search-8fbf244ebcf71464.js new file mode 100644 index 000000000..168023b4b --- /dev/null +++ b/main/static.files/search-8fbf244ebcf71464.js @@ -0,0 +1,5 @@ +"use strict";if(!Array.prototype.toSpliced){Array.prototype.toSpliced=function(){const me=this.slice();Array.prototype.splice.apply(me,arguments);return me}}(function(){const itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword","existential","attr","derive","traitalias","generic",];const longItemTypes=["module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","primitive type","assoc type","constant","assoc const","union","foreign type","keyword","existential type","attribute macro","derive macro","trait alias",];const TY_PRIMITIVE=itemTypes.indexOf("primitive");const TY_KEYWORD=itemTypes.indexOf("keyword");const TY_GENERIC=itemTypes.indexOf("generic");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden")}else{addClass(correctionsElem[0],"hidden")}}else if(nb!==0){printTab(0)}}const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1)}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1)}if(b.length===0){return minDist}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1)}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1)},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit)}function initSearch(rawSearchIndex){const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;let searchIndex;let currentResults;let typeNameIdMap;const ALIASES=new Map();let typeNameIdOfArray;let typeNameIdOfSlice;let typeNameIdOfArrayOrSlice;function buildTypeMapIndex(name){if(name===""||name===null){return null}if(typeNameIdMap.has(name)){return typeNameIdMap.get(name)}else{const id=typeNameIdMap.size;typeNameIdMap.set(name,id);return id}}function isWhitespace(c){return" \t\n\r".indexOf(c)!==-1}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1}function isEndCharacter(c){return",>-]".indexOf(c)!==-1}function isStopCharacter(c){return isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","}function isPathSeparator(c){return c===":"||isWhitespace(c)}function prevIs(parserState,lookingFor){let pos=parserState.pos;while(pos>0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true}else if(!isWhitespace(c)){break}pos-=1}return false}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">")}function skipWhitespace(parserState){while(parserState.pos0){throw["Cannot have more than one element if you use quotes"]}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",]}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",]}return{name:"never",id:null,fullPath:["never"],pathWithoutLast:[],pathLast:"never",generics:[],typeFilter:"primitive",}}if(path.startsWith("::")){throw["Paths cannot start with ","::"]}else if(path.endsWith("::")){throw["Paths cannot end with ","::"]}else if(path.includes("::::")){throw["Unexpected ","::::"]}else if(path.includes(" ::")){throw["Unexpected "," ::"]}else if(path.includes(":: ")){throw["Unexpected ",":: "]}const pathSegments=path.split(/::|\s+/);if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"]}else{throw["Unexpected ",parserState.userQuery[parserState.pos]]}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"]}pathSegments[i]="never"}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}return{name:name.trim(),id:null,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast:pathSegments[pathSegments.length-1],generics:generics,typeFilter,}}function getIdentEndPosition(parserState){const start=parserState.pos;let end=parserState.pos;let foundExclamation=-1;while(parserState.pos=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(isStringElem){skipWhitespace(parserState)}if(start>=end&&generics.length===0){return}elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let start=parserState.pos;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;let extra="";if(endChar===">"){extra="<"}else if(endChar==="]"){extra="["}else if(endChar===""){extra="->"}else{extra=endChar}while(parserState.pos"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(endChar!==""){throw["Expected ",","," or ",endChar,...extra,", found ",c,]}throw["Expected ",",",...extra,", found ",c,]}const posBefore=parserState.pos;start=parserState.pos;getNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra]}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra]}parserState.pos+=1;parserState.typeFilter=oldTypeFilter}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();for(const c in query){if(!isIdentCharacter(query[c])){throw["Unexpected ",query[c]," in type filter (before ",":",")",]}}}function parseInput(query,parserState){let foundStopChar=true;let start=parserState.pos;while(parserState.pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}throw["Unexpected ",c]}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}else if(query.elems.length===0){throw["Expected type filter before ",":"]}else if(query.literalSearch){throw["Cannot use quotes on type filter"]}const typeFilterElem=query.elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.name;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;foundStopChar=true;continue}else if(isWhitespace(c)){skipWhitespace(parserState);continue}if(!foundStopChar){let extra="";if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,]}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,]}const before=query.elems.length;start=parserState.pos;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),elems:[],returned:[],foundElems:0,totalElems:0,literalSearch:false,error:null,correction:null,proposeCorrectionFrom:null,proposeCorrectionTo:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){function convertTypeFilterOnElem(elem){if(elem.typeFilter!==null){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant"}elem.typeFilter=itemTypeFromName(typeFilter)}else{elem.typeFilter=NO_TYPE_FILTER}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2)}}userQuery=userQuery.trim();const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);for(const elem of query.elems){convertTypeFilterOnElem(elem)}for(const elem of query.returned){convertTypeFilterOnElem(elem)}}catch(err){query=newParsedQuery(userQuery);query.error=err;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;query.totalElems=parserState.totalElems;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();function transformResults(results){const duplicates=new Set();const out=[];for(const result of results){if(result.id!==-1){const obj=searchIndex[result.id];obj.dist=result.dist;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates.has(obj.fullPath)){continue}duplicates.add(obj.fullPath);obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){if(results.size===0){return[]}const userQuery=parsedQuery.userQuery;const result_list=[];for(const result of results.values()){result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};result_list.push(result)}result_list.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_dist;b=bbb.path_dist;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.dist);b=(bbb.dist);if(a!==b){return a-b}a=aaa.item.deprecated;b=bbb.item.deprecated;if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}if((aaa.item.ty===TY_PRIMITIVE&&bbb.item.ty!==TY_KEYWORD)||(aaa.item.ty===TY_KEYWORD&&bbb.item.ty!==TY_PRIMITIVE)){return-1}if((bbb.item.ty===TY_PRIMITIVE&&aaa.item.ty!==TY_PRIMITIVE)||(bbb.item.ty===TY_KEYWORD&&aaa.item.ty!==TY_KEYWORD)){return 1}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of result_list){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(result_list)}function checkGenerics(fnType,queryElem,whereClause,mgensInout){return unifyFunctionTypes(fnType.generics,queryElem.generics,whereClause,mgensInout,mgens=>{if(mgensInout){for(const[fid,qid]of mgens.entries()){mgensInout.set(fid,qid)}}return true})}function unifyFunctionTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb){let mgens=new Map(mgensIn);if(queryElems.length===0){return!solutionCb||solutionCb(mgens)}if(!fnTypesIn||fnTypesIn.length===0){return false}const ql=queryElems.length;let fl=fnTypesIn.length;let fnTypes=fnTypesIn.slice();const backtracking=[];let i=0;let j=0;const backtrack=()=>{while(backtracking.length!==0){const{fnTypesScratch,mgensScratch,queryElemsOffset,fnTypesOffset,unbox,}=backtracking.pop();mgens=new Map(mgensScratch);const fnType=fnTypesScratch[fnTypesOffset];const queryElem=queryElems[queryElemsOffset];if(unbox){if(fnType.id<0){if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){continue}mgens.set(fnType.id,0)}const generics=fnType.id<0?whereClause[(-fnType.id)-1]:fnType.generics;fnTypes=fnTypesScratch.toSpliced(fnTypesOffset,1,...generics);fl=fnTypes.length;i=queryElemsOffset-1}else{if(fnType.id<0){if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){continue}mgens.set(fnType.id,queryElem.id)}fnTypes=fnTypesScratch.slice();fl=fnTypes.length;const tmp=fnTypes[queryElemsOffset];fnTypes[queryElemsOffset]=fnTypes[fnTypesOffset];fnTypes[fnTypesOffset]=tmp;i=queryElemsOffset}return true}return false};for(i=0;i!==ql;++i){const queryElem=queryElems[i];const matchCandidates=[];let fnTypesScratch=null;let mgensScratch=null;for(j=i;j!==fl;++j){const fnType=fnTypes[j];if(unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgens)){if(!fnTypesScratch){fnTypesScratch=fnTypes.slice()}unifyFunctionTypes(fnType.generics,queryElem.generics,whereClause,mgens,mgensScratch=>{matchCandidates.push({fnTypesScratch,mgensScratch,queryElemsOffset:i,fnTypesOffset:j,unbox:false,});return false})}if(unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens)){if(!fnTypesScratch){fnTypesScratch=fnTypes.slice()}if(!mgensScratch){mgensScratch=new Map(mgens)}backtracking.push({fnTypesScratch,mgensScratch,queryElemsOffset:i,fnTypesOffset:j,unbox:true,})}}if(matchCandidates.length===0){if(backtrack()){continue}else{return false}}const{fnTypesOffset:candidate,mgensScratch:mgensNew}=matchCandidates.pop();if(fnTypes[candidate].id<0&&queryElems[i].id<0){mgens.set(fnTypes[candidate].id,queryElems[i].id)}for(const[fid,qid]of mgensNew){mgens.set(fid,qid)}const tmp=fnTypes[candidate];fnTypes[candidate]=fnTypes[i];fnTypes[i]=tmp;for(const otherCandidate of matchCandidates){backtracking.push(otherCandidate)}while(i===(ql-1)&&solutionCb&&!solutionCb(mgens)){if(!backtrack()){return false}}}return true}function unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgens){if(!typePassesFilter(queryElem.typeFilter,fnType.ty)){return false}if(fnType.id<0&&queryElem.id<0){if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){return false}for(const[fid,qid]of mgens.entries()){if(fnType.id!==fid&&queryElem.id===qid){return false}if(fnType.id===fid&&queryElem.id!==qid){return false}}}else{if(queryElem.id===typeNameIdOfArrayOrSlice&&(fnType.id===typeNameIdOfSlice||fnType.id===typeNameIdOfArray)){}else if(fnType.id!==queryElem.id){return false}if(fnType.generics.length===0&&queryElem.generics.length!==0){return false}const queryElemPathLength=queryElem.pathWithoutLast.length;if(queryElemPathLength>0){const fnTypePath=fnType.path!==undefined&&fnType.path!==null?fnType.path.split("::"):[];if(queryElemPathLength>fnTypePath.length){return false}let i=0;for(const path of fnTypePath){if(path===queryElem.pathWithoutLast[i]){i+=1;if(i>=queryElemPathLength){break}}}if(i=0){if(!whereClause){return false}if(mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){return false}return checkIfInList(whereClause[(-fnType.id)-1],queryElem,whereClause)}else if(fnType.generics&&fnType.generics.length>0){return checkIfInList(fnType.generics,queryElem,whereClause)}return false}function checkIfInList(list,elem,whereClause){for(const entry of list){if(checkType(entry,elem,whereClause)){return true}}return false}function checkType(row,elem,whereClause){if(row.id===null){return row.generics.length>0?checkIfInList(row.generics,elem,whereClause):false}if(row.id<0&&elem.id>=0){const gid=(-row.id)-1;return checkIfInList(whereClause[gid],elem,whereClause)}if(row.id<0&&elem.id<0){return true}const matchesExact=row.id===elem.id;const matchesArrayOrSlice=elem.id===typeNameIdOfArrayOrSlice&&(row.id===typeNameIdOfSlice||row.id===typeNameIdOfArray);if((matchesExact||matchesArrayOrSlice)&&typePassesFilter(elem.typeFilter,row.ty)){if(elem.generics.length>0){return checkGenerics(row,elem,whereClause,new Map())}return true}return checkIfInList(row.generics,elem,whereClause)}function checkPath(contains,ty,maxEditDistance){if(contains.length===0){return 0}let ret_dist=maxEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;if(clength>length){return maxEditDistance+1}for(let i=0;ilength){break}let dist_total=0;let aborted=false;for(let x=0;xmaxEditDistance){aborted=true;break}dist_total+=dist}if(!aborted){ret_dist=Math.min(ret_dist,Math.round(dist_total/clength))}}return ret_dist}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,deprecated:item.deprecated,implDisambiguator:item.implDisambiguator,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES.has(filterCrates)&&ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{for(const[crate,crateAliasesIndex]of ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}}}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){const inBounds=dist<=maxEditDistance||index!==-1;if(dist===0||(!parsedQuery.literalSearch&&inBounds)){if(results.has(fullId)){const result=results.get(fullId);if(result.dontValidate||result.dist<=dist){return}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,})}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxEditDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let index=-1,path_dist=0;const fullId=row.id;const searchWord=searchWords[pos];const in_args=row.type&&row.type.inputs&&checkIfInList(row.type.inputs,elem,row.type.where_clause);if(in_args){addIntoResults(results_in_args,fullId,pos,-1,0,0,maxEditDistance)}const returned=row.type&&row.type.output&&checkIfInList(row.type.output,elem,row.type.where_clause);if(returned){addIntoResults(results_returned,fullId,pos,-1,0,0,maxEditDistance)}if(!typePassesFilter(elem.typeFilter,row.ty)){return}const row_index=row.normalizedName.indexOf(elem.pathLast);const word_index=searchWord.indexOf(elem.pathLast);if(row_index===-1){index=word_index}else if(word_index===-1){index=row_index}else if(word_index1){path_dist=checkPath(elem.pathWithoutLast,row,maxEditDistance);if(path_dist>maxEditDistance){return}}if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,index,0,path_dist)}return}const dist=editDistance(searchWord,elem.pathLast,maxEditDistance);if(index===-1&&dist+path_dist>maxEditDistance){return}addIntoResults(results_others,fullId,pos,index,dist,path_dist,maxEditDistance)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)||!row.type){return}if(!unifyFunctionTypes(row.type.inputs,parsedQuery.elems,row.type.where_clause,null,mgens=>{return unifyFunctionTypes(row.type.output,parsedQuery.returned,row.type.where_clause,mgens)})){return}addIntoResults(results,row.id,pos,0,0,0,Number.MAX_VALUE)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;let queryLen=0;for(const elem of parsedQuery.elems){queryLen+=elem.name.length}for(const elem of parsedQuery.returned){queryLen+=elem.name.length}const maxEditDistance=Math.floor(queryLen/3);const genericSymbols=new Map();function convertNameToId(elem){if(typeNameIdMap.has(elem.pathLast)){elem.id=typeNameIdMap.get(elem.pathLast)}else if(!parsedQuery.literalSearch){let match=null;let matchDist=maxEditDistance+1;let matchName="";for(const[name,id]of typeNameIdMap){const dist=editDistance(name,elem.pathLast,maxEditDistance);if(dist<=matchDist&&dist<=maxEditDistance){if(dist===matchDist&&matchName>name){continue}match=id;matchDist=dist;matchName=name}}if(match!==null){parsedQuery.correction=matchName}elem.id=match}if((elem.id===null&&parsedQuery.totalElems>1&&elem.typeFilter===-1&&elem.generics.length===0)||elem.typeFilter===TY_GENERIC){if(genericSymbols.has(elem.name)){elem.id=genericSymbols.get(elem.name)}else{elem.id=-(genericSymbols.size+1);genericSymbols.set(elem.name,elem.id)}if(elem.typeFilter===-1&&elem.name.length>=3){const maxPartDistance=Math.floor(elem.name.length/3);let matchDist=maxPartDistance+1;let matchName="";for(const name of typeNameIdMap.keys()){const dist=editDistance(name,elem.name,maxPartDistance);if(dist<=matchDist&&dist<=maxPartDistance){if(dist===matchDist&&matchName>name){continue}matchDist=dist;matchName=name}}if(matchName!==""){parsedQuery.proposeCorrectionFrom=elem.name;parsedQuery.proposeCorrectionTo=matchName}}elem.typeFilter=TY_GENERIC}if(elem.generics.length>0&&elem.typeFilter===TY_GENERIC){parsedQuery.error=["Generic type parameter ",elem.name," does not accept generic parameters",]}for(const elem2 of elem.generics){convertNameToId(elem2)}}for(const elem of parsedQuery.elems){convertNameToId(elem)}for(const elem of parsedQuery.returned){convertNameToId(elem)}if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||editDistance(name,key,maxEditDistance)<=maxEditDistance)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor=type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}if(item.implDisambiguator!==null){anchor=item.implDisambiguator+"/"+anchor}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html#"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){let extraClass="";if(display===true){extraClass=" active"}const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";length+=1;const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";resultName.insertAdjacentHTML("beforeend",`${typeName}`);link.appendChild(resultName);let alias=" ";if(item.is_alias){alias=`
\ +${item.alias} - see \ +
`}resultName.insertAdjacentHTML("beforeend",`
${alias}\ +${item.displayPath}${name}\ +
`);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){const fmtNbElems=nbElems<10?`\u{2007}(${nbElems})\u{2007}\u{2007}`:nbElems<100?`\u{2007}(${nbElems})\u{2007}`:`\u{2007}(${nbElems})`;if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

"+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

`}if(results.query.proposeCorrectionFrom!==null){const orig=results.query.proposeCorrectionFrom;const targ=results.query.proposeCorrectionTo;output+="

"+`Type "${orig}" not found and used as generic parameter. `+`Consider searching for "${targ}" instead.

`}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url)}else{history.replaceState(null,"",url)}}function search(e,forced){if(e){e.preventDefault()}const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";updateSearchHistory(buildUrl(query.original,filterCrates));showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){return types.map(type=>buildItemSearchType(type,lowercasePaths))}function buildItemSearchType(type,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;let pathIndex,generics;if(typeof type==="number"){pathIndex=type;generics=[]}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths)}if(pathIndex<0){return{id:pathIndex,ty:TY_GENERIC,path:null,generics,}}if(pathIndex===0){return{id:null,ty:null,path:null,generics,}}const item=lowercasePaths[pathIndex-1];return{id:buildTypeMapIndex(item.name),ty:item.ty,path:item.path,generics,}}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){inputs=[buildItemSearchType(functionSearchType[INPUTS_DATA],lowercasePaths)]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){output=[buildItemSearchType(functionSearchType[OUTPUT_DATA],lowercasePaths)]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}const where_clause=[];const l=functionSearchType.length;for(let i=2;i2){path=itemPaths.has(elem[2])?itemPaths.get(elem[2]):lastPath;lastPath=path}lowercasePaths.push({ty:ty,name:name.toLowerCase(),path:path});paths[i]={ty:ty,name:name,path:path}}lastPath="";len=itemTypes.length;for(let i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),deprecated:deprecatedItems.has(i),implDisambiguator:implDisambiguator.has(i)?implDisambiguator.get(i):null,};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){const currentCrateAliases=new Map();ALIASES.set(crate,currentCrateAliases);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}let currentNameAliases;if(currentCrateAliases.has(alias_name)){currentNameAliases=currentCrateAliases.get(alias_name)}else{currentNameAliases=[];currentCrateAliases.set(alias_name,currentNameAliases)}for(const local_alias of aliases[alias_name]){currentNameAliases.push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;search(e)}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null))}currentResults=null;search(undefined,true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/main/static.files/settings-74424d7eec62a23e.js b/main/static.files/settings-74424d7eec62a23e.js new file mode 100644 index 000000000..3014f75c5 --- /dev/null +++ b/main/static.files/settings-74424d7eec62a23e.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference"}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
+
`}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display=""}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=event=>{event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=event=>{if(elemIsInParent(event.target,settingsMenu)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/main/static.files/src-script-3280b574d94e47b4.js b/main/static.files/src-script-3280b574d94e47b4.js new file mode 100644 index 000000000..9ea88921e --- /dev/null +++ b/main/static.files/src-script-3280b574d94e47b4.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth"){addClass(document.documentElement,"src-sidebar-expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{removeClass(document.documentElement,"src-sidebar-expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="src-sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSrcSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="src-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(srcIndex).forEach(key=>{srcIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(srcIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSrcLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSrcLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSrcLines(match)}});onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSrcHighlight)});highlightSrcLines();window.createSrcSidebar=createSrcSidebar})() \ No newline at end of file diff --git a/main/static.files/storage-fec3eaa3851e447d.js b/main/static.files/storage-fec3eaa3851e447d.js new file mode 100644 index 000000000..a687118f3 --- /dev/null +++ b/main/static.files/storage-fec3eaa3851e447d.js @@ -0,0 +1 @@ +"use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return current}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className)}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className)}}function onEach(arr,func,reversed){if(arr&&arr.length>0){if(reversed){for(let i=arr.length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(const elem of arr){if(func(elem)){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}const getVar=(function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.attributes["data-"+name].value:null});function switchTheme(newThemeName,saveTheme){if(saveTheme){updateLocalStorage("theme",newThemeName)}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null}}else{const newHref=getVar("root-path")+newThemeName+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=document.getElementById("themeStyle")}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme)}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true)}else{switchTheme(getSettingValue("theme"),false)}}mql.addEventListener("change",updateTheme);return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded")}window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0)}}) \ No newline at end of file diff --git a/main/static.files/wheel-7b819b6101059cd0.svg b/main/static.files/wheel-7b819b6101059cd0.svg new file mode 100644 index 000000000..83c07f63d --- /dev/null +++ b/main/static.files/wheel-7b819b6101059cd0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/main/test_support/all.html b/main/test_support/all.html new file mode 100644 index 000000000..0426a2104 --- /dev/null +++ b/main/test_support/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/main/test_support/index.html b/main/test_support/index.html new file mode 100644 index 000000000..76320966c --- /dev/null +++ b/main/test_support/index.html @@ -0,0 +1,3 @@ +test_support - Rust

Crate test_support

source ·
Expand description

Utilities to use with acceptance tests in Volta.

+

Modules

Macros

\ No newline at end of file diff --git a/main/test_support/macro.ok_or_panic!.html b/main/test_support/macro.ok_or_panic!.html new file mode 100644 index 000000000..a4845b34e --- /dev/null +++ b/main/test_support/macro.ok_or_panic!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.ok_or_panic.html...

+ + + \ No newline at end of file diff --git a/main/test_support/macro.ok_or_panic.html b/main/test_support/macro.ok_or_panic.html new file mode 100644 index 000000000..78f90ef83 --- /dev/null +++ b/main/test_support/macro.ok_or_panic.html @@ -0,0 +1,3 @@ +ok_or_panic in test_support - Rust
macro_rules! ok_or_panic {
+    { $e:expr } => { ... };
+}
\ No newline at end of file diff --git a/main/test_support/matchers/enum.MatchKind.html b/main/test_support/matchers/enum.MatchKind.html new file mode 100644 index 000000000..1c0bed9f0 --- /dev/null +++ b/main/test_support/matchers/enum.MatchKind.html @@ -0,0 +1,24 @@ +MatchKind in test_support::matchers - Rust
enum MatchKind {
+    Exact,
+    Partial,
+    PartialN(usize),
+    NotPresent,
+    Unordered,
+}

Variants§

§

Exact

§

Partial

§

PartialN(usize)

§

NotPresent

§

Unordered

Trait Implementations§

source§

impl Clone for MatchKind

source§

fn clone(&self) -> MatchKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MatchKind

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for MatchKind

source§

fn eq(&self, other: &MatchKind) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Copy for MatchKind

source§

impl Eq for MatchKind

source§

impl StructuralEq for MatchKind

source§

impl StructuralPartialEq for MatchKind

Auto Trait Implementations§

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
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
\ No newline at end of file diff --git a/main/test_support/matchers/fn.execs.html b/main/test_support/matchers/fn.execs.html new file mode 100644 index 000000000..eb8209ee5 --- /dev/null +++ b/main/test_support/matchers/fn.execs.html @@ -0,0 +1 @@ +execs in test_support::matchers - Rust

Function test_support::matchers::execs

source ·
pub fn execs() -> Execs
\ No newline at end of file diff --git a/main/test_support/matchers/fn.find_mismatch.html b/main/test_support/matchers/fn.find_mismatch.html new file mode 100644 index 000000000..4b0eacb97 --- /dev/null +++ b/main/test_support/matchers/fn.find_mismatch.html @@ -0,0 +1,4 @@ +find_mismatch in test_support::matchers - Rust
fn find_mismatch<'a>(
+    expected: &'a Value,
+    actual: &'a Value
+) -> Option<(&'a Value, &'a Value)>
\ No newline at end of file diff --git a/main/test_support/matchers/fn.lines_match.html b/main/test_support/matchers/fn.lines_match.html new file mode 100644 index 000000000..236321ec7 --- /dev/null +++ b/main/test_support/matchers/fn.lines_match.html @@ -0,0 +1,11 @@ +lines_match in test_support::matchers - Rust
pub fn lines_match(expected: &str, actual: &str) -> bool
Expand description

Compare a line with an expected pattern.

+
    +
  • Use [..] as a wildcard to match 0 or more characters on the same line +(similar to .* in a regex).
  • +
  • Use [EXE] to optionally add .exe on Windows (empty string on other +platforms).
  • +
  • There is a wide range of macros (such as [COMPILING] or [WARNING]) +to match cargo’s “status” output and allows you to ignore the alignment. +See substitute_macros for a complete list of macros.
  • +
+
\ No newline at end of file diff --git a/main/test_support/matchers/fn.substitute_macros.html b/main/test_support/matchers/fn.substitute_macros.html new file mode 100644 index 000000000..65615b30b --- /dev/null +++ b/main/test_support/matchers/fn.substitute_macros.html @@ -0,0 +1 @@ +substitute_macros in test_support::matchers - Rust
fn substitute_macros(input: &str) -> String
\ No newline at end of file diff --git a/main/test_support/matchers/fn.zip_all.html b/main/test_support/matchers/fn.zip_all.html new file mode 100644 index 000000000..289bd6c87 --- /dev/null +++ b/main/test_support/matchers/fn.zip_all.html @@ -0,0 +1,4 @@ +zip_all in test_support::matchers - Rust

Function test_support::matchers::zip_all

source ·
fn zip_all<T, I1: Iterator<Item = T>, I2: Iterator<Item = T>>(
+    a: I1,
+    b: I2
+) -> ZipAll<I1, I2> 
\ No newline at end of file diff --git a/main/test_support/matchers/index.html b/main/test_support/matchers/index.html new file mode 100644 index 000000000..2299b3a50 --- /dev/null +++ b/main/test_support/matchers/index.html @@ -0,0 +1 @@ +test_support::matchers - Rust

Module test_support::matchers

source ·

Structs

Enums

Functions

\ No newline at end of file diff --git a/main/test_support/matchers/sidebar-items.js b/main/test_support/matchers/sidebar-items.js new file mode 100644 index 000000000..fcd3daea2 --- /dev/null +++ b/main/test_support/matchers/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["MatchKind"],"fn":["execs","find_mismatch","lines_match","substitute_macros","zip_all"],"struct":["Execs","ZipAll"]}; \ No newline at end of file diff --git a/main/test_support/matchers/struct.Execs.html b/main/test_support/matchers/struct.Execs.html new file mode 100644 index 000000000..d4b2085e3 --- /dev/null +++ b/main/test_support/matchers/struct.Execs.html @@ -0,0 +1,97 @@ +Execs in test_support::matchers - Rust
pub struct Execs {
+    expect_stdout: Option<String>,
+    expect_stderr: Option<String>,
+    expect_exit_code: Option<i32>,
+    expect_stdout_contains: Vec<String>,
+    expect_stderr_contains: Vec<String>,
+    expect_either_contains: Vec<String>,
+    expect_stdout_contains_n: Vec<(String, usize)>,
+    expect_stdout_not_contains: Vec<String>,
+    expect_stderr_not_contains: Vec<String>,
+    expect_stderr_unordered: Vec<String>,
+    expect_neither_contains: Vec<String>,
+    expect_json: Option<Vec<Value>>,
+}

Fields§

§expect_stdout: Option<String>§expect_stderr: Option<String>§expect_exit_code: Option<i32>§expect_stdout_contains: Vec<String>§expect_stderr_contains: Vec<String>§expect_either_contains: Vec<String>§expect_stdout_contains_n: Vec<(String, usize)>§expect_stdout_not_contains: Vec<String>§expect_stderr_not_contains: Vec<String>§expect_stderr_unordered: Vec<String>§expect_neither_contains: Vec<String>§expect_json: Option<Vec<Value>>

Implementations§

source§

impl Execs

source

pub fn with_stdout<S: ToString>(self, expected: S) -> Execs

Verify that stdout is equal to the given lines. +See lines_match for supported patterns.

+
source

pub fn with_stderr<S: ToString>(self, expected: S) -> Execs

Verify that stderr is equal to the given lines. +See lines_match for supported patterns.

+
source

fn _with_stderr(&mut self, expected: &dyn ToString)

source

pub fn with_status(self, expected: i32) -> Execs

Verify the exit code from the process.

+
source

pub fn with_stdout_contains<S: ToString>(self, expected: S) -> Execs

Verify that stdout contains the given contiguous lines somewhere in +its output. +See lines_match for supported patterns.

+
source

pub fn with_stderr_contains<S: ToString>(self, expected: S) -> Execs

Verify that stderr contains the given contiguous lines somewhere in +its output. +See lines_match for supported patterns.

+
source

pub fn with_either_contains<S: ToString>(self, expected: S) -> Execs

Verify that either stdout or stderr contains the given contiguous +lines somewhere in its output. +See lines_match for supported patterns.

+
source

pub fn with_stdout_contains_n<S: ToString>( + self, + expected: S, + number: usize +) -> Execs

Verify that stdout contains the given contiguous lines somewhere in +its output, and should be repeated number times. +See lines_match for supported patterns.

+
source

pub fn with_stdout_does_not_contain<S: ToString>(self, expected: S) -> Execs

Verify that stdout does not contain the given contiguous lines. +See lines_match for supported patterns. +See note on with_stderr_does_not_contain.

+
source

pub fn with_stderr_does_not_contain<S: ToString>(self, expected: S) -> Execs

Verify that stderr does not contain the given contiguous lines. +See lines_match for supported patterns.

+

Care should be taken when using this method because there is a +limitless number of possible things that won’t appear. A typo means +your test will pass without verifying the correct behavior. If +possible, write the test first so that it fails, and then implement +your fix/feature to make it pass.

+
source

pub fn with_stderr_unordered<S: ToString>(self, expected: S) -> Execs

Verify that all of the stderr output is equal to the given lines, +ignoring the order of the lines. +See lines_match for supported patterns. +This is useful when checking the output of cargo build -v since +the order of the output is not always deterministic. +Recommend use with_stderr_contains instead unless you really want to +check every line of output.

+

Be careful when using patterns such as [..], because you may end up +with multiple lines that might match, and this is not smart enough to +do anything like longest-match. For example, avoid something like: +[RUNNING] rustc [..] [RUNNING] rustc –crate-name foo [..] +This will randomly fail if the other crate name is bar, and the +order changes.

+
source

pub fn with_json(self, expected: &str) -> Execs

Verify the JSON output matches the given JSON. +Typically used when testing cargo commands that emit JSON. +Each separate JSON object should be separated by a blank line. +Example: +assert_that( +p.cargo(“metadata”), +execs().with_json(r#“ +{“example”: “abc”} +{“example”: “def”} +“#) +); +Objects should match in the order given. +The order of arrays is ignored. +Strings support patterns described in lines_match. +Use {...} to match any object.

+
source

fn match_output(&self, actual: &Output) -> MatchResult

source

fn match_status(&self, actual: &Output) -> MatchResult

source

fn match_stdout(&self, actual: &Output) -> MatchResult

source

fn match_stderr(&self, actual: &Output) -> MatchResult

source

fn match_std( + &self, + expected: Option<&String>, + actual: &[u8], + description: &str, + extra: &[u8], + kind: MatchKind +) -> MatchResult

source

fn match_json(&self, expected: &Value, line: &str) -> MatchResult

source

fn diff_lines<'a>( + &self, + actual: Lines<'a>, + expected: Lines<'a>, + partial: bool +) -> Vec<String>

Trait Implementations§

source§

impl Clone for Execs

source§

fn clone(&self) -> Execs

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Execs

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for Execs

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> Matcher<&'a mut ProcessBuilder> for Execs

source§

fn matches(&self, process: &'a mut ProcessBuilder) -> MatchResult

source§

impl Matcher<Output> for Execs

source§

fn matches(&self, output: Output) -> MatchResult

source§

impl Matcher<ProcessBuilder> for Execs

source§

fn matches(&self, process: ProcessBuilder) -> MatchResult

Auto Trait Implementations§

§

impl RefUnwindSafe for Execs

§

impl Send for Execs

§

impl Sync for Execs

§

impl Unpin for Execs

§

impl UnwindSafe for Execs

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> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
\ No newline at end of file diff --git a/main/test_support/matchers/struct.ZipAll.html b/main/test_support/matchers/struct.ZipAll.html new file mode 100644 index 000000000..487487652 --- /dev/null +++ b/main/test_support/matchers/struct.ZipAll.html @@ -0,0 +1,202 @@ +ZipAll in test_support::matchers - Rust
struct ZipAll<I1: Iterator, I2: Iterator> {
+    first: I1,
+    second: I2,
+}

Fields§

§first: I1§second: I2

Trait Implementations§

source§

impl<T, I1: Iterator<Item = T>, I2: Iterator<Item = T>> Iterator for ZipAll<I1, I2>

§

type Item = (Option<T>, Option<T>)

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<(Option<T>, Option<T>)>

Advances the iterator and returns the next value. Read more
source§

fn next_chunk<const N: usize>( + &mut self +) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · source§

fn count(self) -> usizewhere + Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · source§

fn last(self) -> Option<Self::Item>where + Self: Sized,

Consumes the iterator, returning the last element. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>where + Self: Sized,

Creates an iterator starting at the same point, but stepping by +the given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where + Self: Sized, + U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where + Self: Sized, + G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator +between adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each +element. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)where + Self: Sized, + F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element +should be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>where + Self: Sized,

Creates an iterator which gives the current iteration count as well as +the next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>where + Self: Sized,

Creates an iterator which can use the peek and peek_mut methods +to look at the next element of the iterator without consuming it. See +their documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where + Self: Sized, + P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>where + Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>where + Self: Sized,

Creates an iterator that yields the first n elements, or fewer +if the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where + Self: Sized, + F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but +unlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where + Self: Sized, + U: IntoIterator, + F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>where + Self: Sized, + F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over +self and returns an iterator over the outputs of f. Like slice::windows(), +the windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>where + Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>where + Self: Sized, + F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere + Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> Bwhere + B: FromIterator<Self::Item>, + Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere + E: Extend<Self::Item>, + Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)where + Self: Sized, + B: Default + Extend<Self::Item>, + F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> boolwhere + Self: Sized, + P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, +such that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try<Output = B>,

An iterator method that applies a function as long as it returns +successfully, producing a single, final value. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> Rwhere + Self: Sized, + F: FnMut(Self::Item) -> R, + R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the +iterator, stopping at the first error and returning that error. Read more
1.0.0 · source§

fn fold<B, F>(self, init: B, f: F) -> Bwhere + Self: Sized, + F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, +returning the final result. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing +operation. Read more
source§

fn try_reduce<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere + Self: Sized, + F: FnMut(Self::Item, Self::Item) -> R, + R: Try<Output = Self::Item>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the +closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where + Self: Sized, + P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>where + Self: Sized, + F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns +the first non-none result. Read more
source§

fn try_find<F, R>( + &mut self, + f: F +) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere + Self: Sized, + F: FnMut(&Self::Item) -> R, + R: Try<Output = bool>, + <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns +the first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>where + Self: Sized, + P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the +specified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the +specified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where + B: Ord, + Self: Sized, + F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the +specified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the +specified comparison function. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where + FromA: Default + Extend<A>, + FromB: Default + Extend<B>, + Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>where + T: 'a + Copy, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>where + T: 'a + Clone, + Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where + Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> Swhere + Self: Sized, + S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> Pwhere + Self: Sized, + P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>where + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Lexicographically compares the PartialOrd elements of +this Iterator with those of another. The comparison works like short-circuit +evaluation, returning a result without comparing the remaining elements. +As soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those +of another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are equal to those of +another. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere + Self: Sized, + I: IntoIterator, + F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of +another with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialEq<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are not equal to those of +another. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +less or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> boolwhere + I: IntoIterator, + Self::Item: PartialOrd<<I as IntoIterator>::Item>, + Self: Sized,

Determines if the elements of this Iterator are lexicographically +greater than or equal to those of another. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> boolwhere + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere + Self: Sized, + F: FnMut(Self::Item) -> K, + K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction +function. Read more

Auto Trait Implementations§

§

impl<I1, I2> RefUnwindSafe for ZipAll<I1, I2>where + I1: RefUnwindSafe, + I2: RefUnwindSafe,

§

impl<I1, I2> Send for ZipAll<I1, I2>where + I1: Send, + I2: Send,

§

impl<I1, I2> Sync for ZipAll<I1, I2>where + I1: Sync, + I2: Sync,

§

impl<I1, I2> Unpin for ZipAll<I1, I2>where + I1: Unpin, + I2: Unpin,

§

impl<I1, I2> UnwindSafe for ZipAll<I1, I2>where + I1: UnwindSafe, + I2: UnwindSafe,

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<I> IntoIterator for Iwhere + I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. 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.
\ No newline at end of file diff --git a/main/test_support/paths/constant.TASK_ID.html b/main/test_support/paths/constant.TASK_ID.html new file mode 100644 index 000000000..f5f747453 --- /dev/null +++ b/main/test_support/paths/constant.TASK_ID.html @@ -0,0 +1 @@ +TASK_ID in test_support::paths - Rust

Constant test_support::paths::TASK_ID

source ·
const TASK_ID: LocalKey<usize>;
\ No newline at end of file diff --git a/main/test_support/paths/enum.Remove.html b/main/test_support/paths/enum.Remove.html new file mode 100644 index 000000000..da58c9d0b --- /dev/null +++ b/main/test_support/paths/enum.Remove.html @@ -0,0 +1,14 @@ +Remove in test_support::paths - Rust
enum Remove {
+    File,
+    Dir,
+}

Variants§

§

File

§

Dir

Implementations§

source§

impl Remove

source

fn to_str(&self) -> &'static str

source

fn at(&self, path: &Path)

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/test_support/paths/fn.global_root.html b/main/test_support/paths/fn.global_root.html new file mode 100644 index 000000000..74416bcfd --- /dev/null +++ b/main/test_support/paths/fn.global_root.html @@ -0,0 +1 @@ +global_root in test_support::paths - Rust
fn global_root() -> PathBuf
\ No newline at end of file diff --git a/main/test_support/paths/fn.home.html b/main/test_support/paths/fn.home.html new file mode 100644 index 000000000..cd6d21da4 --- /dev/null +++ b/main/test_support/paths/fn.home.html @@ -0,0 +1 @@ +home in test_support::paths - Rust

Function test_support::paths::home

source ·
pub fn home() -> PathBuf
\ No newline at end of file diff --git a/main/test_support/paths/fn.init.html b/main/test_support/paths/fn.init.html new file mode 100644 index 000000000..532e96be9 --- /dev/null +++ b/main/test_support/paths/fn.init.html @@ -0,0 +1 @@ +init in test_support::paths - Rust

Function test_support::paths::init

source ·
fn init()
\ No newline at end of file diff --git a/main/test_support/paths/fn.root.html b/main/test_support/paths/fn.root.html new file mode 100644 index 000000000..78bfb8519 --- /dev/null +++ b/main/test_support/paths/fn.root.html @@ -0,0 +1 @@ +root in test_support::paths - Rust

Function test_support::paths::root

source ·
pub fn root() -> PathBuf
\ No newline at end of file diff --git a/main/test_support/paths/index.html b/main/test_support/paths/index.html new file mode 100644 index 000000000..77b040747 --- /dev/null +++ b/main/test_support/paths/index.html @@ -0,0 +1 @@ +test_support::paths - Rust
\ No newline at end of file diff --git a/main/test_support/paths/sidebar-items.js b/main/test_support/paths/sidebar-items.js new file mode 100644 index 000000000..12ddf5776 --- /dev/null +++ b/main/test_support/paths/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["TASK_ID"],"enum":["Remove"],"fn":["global_root","home","init","root"],"static":["NEXT_ID","SMOKE_TEST_DIR"],"trait":["PathExt"]}; \ No newline at end of file diff --git a/main/test_support/paths/static.NEXT_ID.html b/main/test_support/paths/static.NEXT_ID.html new file mode 100644 index 000000000..7ec97988e --- /dev/null +++ b/main/test_support/paths/static.NEXT_ID.html @@ -0,0 +1 @@ +NEXT_ID in test_support::paths - Rust

Static test_support::paths::NEXT_ID

source ·
static NEXT_ID: AtomicUsize
\ No newline at end of file diff --git a/main/test_support/paths/static.SMOKE_TEST_DIR.html b/main/test_support/paths/static.SMOKE_TEST_DIR.html new file mode 100644 index 000000000..2e1e51633 --- /dev/null +++ b/main/test_support/paths/static.SMOKE_TEST_DIR.html @@ -0,0 +1 @@ +SMOKE_TEST_DIR in test_support::paths - Rust
static SMOKE_TEST_DIR: &str
\ No newline at end of file diff --git a/main/test_support/paths/trait.PathExt.html b/main/test_support/paths/trait.PathExt.html new file mode 100644 index 000000000..bbbd3d740 --- /dev/null +++ b/main/test_support/paths/trait.PathExt.html @@ -0,0 +1,8 @@ +PathExt in test_support::paths - Rust
pub trait PathExt {
+    // Required methods
+    fn rm(&self);
+    fn rm_rf(&self);
+    fn rm_contents(&self);
+    fn ensure_empty(&self);
+    fn mkdir_p(&self);
+}

Required Methods§

source

fn rm(&self)

source

fn rm_rf(&self)

source

fn rm_contents(&self)

source

fn ensure_empty(&self)

source

fn mkdir_p(&self)

Implementations on Foreign Types§

source§

impl PathExt for Path

Implementors§

\ No newline at end of file diff --git a/main/test_support/process/fn.process.html b/main/test_support/process/fn.process.html new file mode 100644 index 000000000..c90a91fec --- /dev/null +++ b/main/test_support/process/fn.process.html @@ -0,0 +1,2 @@ +process in test_support::process - Rust

Function test_support::process::process

source ·
pub fn process<T: AsRef<OsStr>>(cmd: T) -> ProcessBuilder
Expand description

A helper function to create a ProcessBuilder.

+
\ No newline at end of file diff --git a/main/test_support/process/fn.process_error.html b/main/test_support/process/fn.process_error.html new file mode 100644 index 000000000..c7560af8b --- /dev/null +++ b/main/test_support/process/fn.process_error.html @@ -0,0 +1,5 @@ +process_error in test_support::process - Rust
pub fn process_error(
+    msg: &str,
+    status: Option<ExitStatus>,
+    output: Option<&Output>
+) -> ProcessError
\ No newline at end of file diff --git a/main/test_support/process/index.html b/main/test_support/process/index.html new file mode 100644 index 000000000..3760c4710 --- /dev/null +++ b/main/test_support/process/index.html @@ -0,0 +1 @@ +test_support::process - Rust

Module test_support::process

source ·

Structs

Functions

\ No newline at end of file diff --git a/main/test_support/process/sidebar-items.js b/main/test_support/process/sidebar-items.js new file mode 100644 index 000000000..773d866d4 --- /dev/null +++ b/main/test_support/process/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["process","process_error"],"struct":["ProcessBuilder","ProcessError"]}; \ No newline at end of file diff --git a/main/test_support/process/struct.ProcessBuilder.html b/main/test_support/process/struct.ProcessBuilder.html new file mode 100644 index 000000000..cee2e8733 --- /dev/null +++ b/main/test_support/process/struct.ProcessBuilder.html @@ -0,0 +1,43 @@ +ProcessBuilder in test_support::process - Rust
pub struct ProcessBuilder {
+    program: OsString,
+    args: Vec<OsString>,
+    env: HashMap<String, Option<OsString>>,
+    cwd: Option<OsString>,
+}
Expand description

A builder object for an external process, similar to std::process::Command.

+

Fields§

§program: OsString

The program to execute.

+
§args: Vec<OsString>

A list of arguments to pass to the program.

+
§env: HashMap<String, Option<OsString>>

Any environment variables that should be set for the program.

+
§cwd: Option<OsString>

Which directory to run the program from.

+

Implementations§

source§

impl ProcessBuilder

source

pub fn program<T: AsRef<OsStr>>(&mut self, program: T) -> &mut ProcessBuilder

(chainable) Set the executable for the process.

+
source

pub fn arg<T: AsRef<OsStr>>(&mut self, arg: T) -> &mut ProcessBuilder

(chainable) Add an arg to the args list.

+
source

pub fn args<T: AsRef<OsStr>>(&mut self, arguments: &[T]) -> &mut ProcessBuilder

(chainable) Add many args to the args list.

+
source

pub fn args_replace<T: AsRef<OsStr>>( + &mut self, + arguments: &[T] +) -> &mut ProcessBuilder

(chainable) Replace args with new args list

+
source

pub fn cwd<T: AsRef<OsStr>>(&mut self, path: T) -> &mut ProcessBuilder

(chainable) Set the current working directory of the process

+
source

pub fn env<T: AsRef<OsStr>>(&mut self, key: &str, val: T) -> &mut ProcessBuilder

(chainable) Set an environment variable for the process.

+
source

pub fn env_remove(&mut self, key: &str) -> &mut ProcessBuilder

(chainable) Unset an environment variable for the process.

+
source

pub fn get_program(&self) -> &OsString

Get the executable name.

+
source

pub fn get_args(&self) -> &[OsString]

Get the program arguments

+
source

pub fn get_cwd(&self) -> Option<&Path>

Get the current working directory for the process

+
source

pub fn get_env(&self, var: &str) -> Option<OsString>

Get an environment variable as the process will see it (will inherit from environment +unless explicitally unset).

+
source

pub fn get_envs(&self) -> &HashMap<String, Option<OsString>>

Get all environment variables explicitly set or unset for the process (not inherited +vars).

+
source

pub fn exec(&self) -> Result<(), ProcessError>

Run the process, waiting for completion, and mapping non-success exit codes to an error.

+
source

pub fn exec_with_output(&self) -> Result<Output, ProcessError>

Execute the process, returning the stdio output, or an error if non-zero exit status.

+
source

pub fn build_command(&self) -> Command

Converts ProcessBuilder into a std::process::Command

+

Trait Implementations§

source§

impl Clone for ProcessBuilder

source§

fn clone(&self) -> ProcessBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ProcessBuilder

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ProcessBuilder

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> Matcher<&'a mut ProcessBuilder> for Execs

source§

fn matches(&self, process: &'a mut ProcessBuilder) -> MatchResult

source§

impl Matcher<ProcessBuilder> for Execs

source§

fn matches(&self, process: ProcessBuilder) -> MatchResult

Auto Trait Implementations§

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> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
\ No newline at end of file diff --git a/main/test_support/process/struct.ProcessError.html b/main/test_support/process/struct.ProcessError.html new file mode 100644 index 000000000..940af5462 --- /dev/null +++ b/main/test_support/process/struct.ProcessError.html @@ -0,0 +1,16 @@ +ProcessError in test_support::process - Rust
pub struct ProcessError {
+    pub desc: String,
+    pub exit: Option<ExitStatus>,
+    pub output: Option<Output>,
+}

Fields§

§desc: String§exit: Option<ExitStatus>§output: Option<Output>

Trait Implementations§

source§

impl Debug for ProcessError

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ProcessError

source§

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

Formats the value using the given formatter. Read more
source§

impl Error for ProcessError

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more

Auto Trait Implementations§

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.
\ No newline at end of file diff --git a/main/test_support/sidebar-items.js b/main/test_support/sidebar-items.js new file mode 100644 index 000000000..d5378ca61 --- /dev/null +++ b/main/test_support/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"macro":["ok_or_panic"],"mod":["matchers","paths","process"]}; \ No newline at end of file diff --git a/main/trait.impl/archive/trait.Archive.js b/main/trait.impl/archive/trait.Archive.js new file mode 100644 index 000000000..72a9ddd1e --- /dev/null +++ b/main/trait.impl/archive/trait.Archive.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"archive":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/clap_builder/derive/trait.Args.js b/main/trait.impl/clap_builder/derive/trait.Args.js new file mode 100644 index 000000000..ee41717b3 --- /dev/null +++ b/main/trait.impl/clap_builder/derive/trait.Args.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[["impl Args for Which"],["impl Args for Pin"],["impl Args for Completions"],["impl Args for Setup"],["impl Args for Volta"],["impl Args for Fetch"],["impl Args for Install"],["impl Args for Uninstall"],["impl Args for Use"],["impl Args for Run"],["impl Args for List"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/clap_builder/derive/trait.CommandFactory.js b/main/trait.impl/clap_builder/derive/trait.CommandFactory.js new file mode 100644 index 000000000..da067d8e6 --- /dev/null +++ b/main/trait.impl/clap_builder/derive/trait.CommandFactory.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[["impl CommandFactory for Volta"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/clap_builder/derive/trait.FromArgMatches.js b/main/trait.impl/clap_builder/derive/trait.FromArgMatches.js new file mode 100644 index 000000000..0a4de4608 --- /dev/null +++ b/main/trait.impl/clap_builder/derive/trait.FromArgMatches.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[["impl FromArgMatches for Install"],["impl FromArgMatches for Use"],["impl FromArgMatches for Setup"],["impl FromArgMatches for Pin"],["impl FromArgMatches for Which"],["impl FromArgMatches for Volta"],["impl FromArgMatches for List"],["impl FromArgMatches for Uninstall"],["impl FromArgMatches for Completions"],["impl FromArgMatches for Run"],["impl FromArgMatches for Fetch"],["impl FromArgMatches for Subcommand"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/clap_builder/derive/trait.Parser.js b/main/trait.impl/clap_builder/derive/trait.Parser.js new file mode 100644 index 000000000..fdfd7c9bb --- /dev/null +++ b/main/trait.impl/clap_builder/derive/trait.Parser.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[["impl Parser for Volta"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/clap_builder/derive/trait.Subcommand.js b/main/trait.impl/clap_builder/derive/trait.Subcommand.js new file mode 100644 index 000000000..99dd77da9 --- /dev/null +++ b/main/trait.impl/clap_builder/derive/trait.Subcommand.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[["impl Subcommand for Subcommand"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/clap_builder/derive/trait.ValueEnum.js b/main/trait.impl/clap_builder/derive/trait.ValueEnum.js new file mode 100644 index 000000000..d60fd3ab5 --- /dev/null +++ b/main/trait.impl/clap_builder/derive/trait.ValueEnum.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[["impl ValueEnum for Format"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/clone/trait.Clone.js b/main/trait.impl/core/clone/trait.Clone.js new file mode 100644 index 000000000..487fa7118 --- /dev/null +++ b/main/trait.impl/core/clone/trait.Clone.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"archive":[["impl Clone for Origin"]], +"test_support":[["impl Clone for Execs"],["impl Clone for ProcessBuilder"],["impl Clone for MatchKind"]], +"volta":[["impl Clone for PackageManagerKind"],["impl Clone for Node"],["impl Clone for Source"],["impl Clone for PackageManager"],["impl Clone for Subcommand"],["impl Clone for Format"]], +"volta_core":[["impl Clone for Source"],["impl<T: Clone> Clone for InheritOption<T>"],["impl Clone for PlatformSpec"],["impl Clone for ActivityKind"],["impl Clone for RawDistInfo"],["impl Clone for NeedsScope"],["impl<T> Clone for Sourced<T>where\n T: Clone,"],["impl Clone for NodeVersion"],["impl Clone for PackageManager"],["impl Clone for ExitCode"],["impl Clone for Platform"],["impl Clone for CliPlatform"],["impl Clone for LogVerbosity"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/cmp/trait.Eq.js b/main/trait.impl/core/cmp/trait.Eq.js new file mode 100644 index 000000000..fc7cf35d1 --- /dev/null +++ b/main/trait.impl/core/cmp/trait.Eq.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"test_support":[["impl Eq for MatchKind"]], +"validate_npm_package_name":[["impl Eq for Validity"]], +"volta":[["impl Eq for PackageManagerKind"]], +"volta_core":[["impl Eq for RegistryFormat"],["impl Eq for Publish"],["impl Eq for PackageManager"],["impl Eq for ErrorEnv"],["impl Eq for Platform"],["impl Eq for PackageConfig"],["impl Eq for ShimResult"],["impl Eq for MetadataHook"],["impl Eq for ActivityKind"],["impl Eq for PlatformSpec"],["impl Eq for NodeVersion"],["impl Eq for DistroHook"],["impl Eq for YarnIndexHook"],["impl Eq for EventKind"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/cmp/trait.Ord.js b/main/trait.impl/core/cmp/trait.Ord.js new file mode 100644 index 000000000..a74363a57 --- /dev/null +++ b/main/trait.impl/core/cmp/trait.Ord.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"volta":[["impl Ord for PackageManagerKind"]], +"volta_core":[["impl Ord for PackageConfig"],["impl Ord for PackageManager"],["impl Ord for PlatformSpec"],["impl Ord for ActivityKind"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/cmp/trait.PartialEq.js b/main/trait.impl/core/cmp/trait.PartialEq.js new file mode 100644 index 000000000..ec1abf547 --- /dev/null +++ b/main/trait.impl/core/cmp/trait.PartialEq.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"test_support":[["impl PartialEq for MatchKind"]], +"validate_npm_package_name":[["impl PartialEq for Validity"]], +"volta":[["impl PartialEq for PackageManagerKind"],["impl PartialEq for Source"]], +"volta_core":[["impl PartialEq for PackageManager"],["impl PartialEq for RegistryFormat"],["impl PartialEq for ActivityKind"],["impl PartialEq for Platform"],["impl PartialEq for NodeVersion"],["impl PartialEq for Publish"],["impl PartialEq for DistroHook"],["impl PartialEq for ShimResult"],["impl PartialEq for PlatformSpec"],["impl PartialEq for EventKind"],["impl PartialEq for PackageConfig"],["impl PartialEq for MetadataHook"],["impl PartialEq for ErrorEnv"],["impl PartialEq for NeedsScope"],["impl PartialEq for YarnIndexHook"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/cmp/trait.PartialOrd.js b/main/trait.impl/core/cmp/trait.PartialOrd.js new file mode 100644 index 000000000..175673433 --- /dev/null +++ b/main/trait.impl/core/cmp/trait.PartialOrd.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"volta":[["impl PartialOrd for PackageManagerKind"]], +"volta_core":[["impl PartialOrd for PackageConfig"],["impl PartialOrd for PackageManager"],["impl PartialOrd for ActivityKind"],["impl PartialOrd for PlatformSpec"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/convert/trait.From.js b/main/trait.impl/core/convert/trait.From.js new file mode 100644 index 000000000..24947e8ba --- /dev/null +++ b/main/trait.impl/core/convert/trait.From.js @@ -0,0 +1,5 @@ +(function() {var implementors = { +"archive":[["impl From<Error> for ArchiveError"],["impl From<ZipError> for ArchiveError"],["impl From<Error> for ArchiveError"]], +"volta_core":[["impl From<PackageUpgradeCommand> for Executor"],["impl From<RawYarnIndex> for YarnIndex"],["impl From<UninstallCommand> for Executor"],["impl From<RawPackageMetadata> for PackageIndex"],["impl From<RawNodeIndex> for NodeIndex"],["impl From<ErrorKind> for VoltaError"],["impl From<PackageInstallCommand> for Executor"],["impl From<InternalInstallCommand> for Executor"],["impl From<CliPlatform> for Option<Platform>"],["impl<T> From<InheritOption<T>> for Option<T>"],["impl From<PackageLinkCommand> for Executor"],["impl From<Vec<Executor>> for Executor"],["impl From<Platform> for Option<PlatformSpec>"],["impl From<bool> for NeedsScope"],["impl From<ToolCommand> for Executor"]], +"volta_migrate":[["impl From<LegacyPlatform> for PlatformSpec"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/convert/trait.TryFrom.js b/main/trait.impl/core/convert/trait.TryFrom.js new file mode 100644 index 000000000..cc244140b --- /dev/null +++ b/main/trait.impl/core/convert/trait.TryFrom.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"volta_core":[["impl TryFrom<RawPublishHook> for Publish"],["impl TryFrom<RawEventHooks> for EventHooks"],["impl TryFrom<PartialPlatform> for PlatformSpec"],["impl TryFrom<String> for Platform"]], +"volta_migrate":[["impl TryFrom<V2> for V3"],["impl TryFrom<Empty> for V2"],["impl TryFrom<V1> for V2"],["impl TryFrom<V3> for V4"],["impl TryFrom<V0> for V1"],["impl TryFrom<Empty> for V3"],["impl TryFrom<Empty> for V1"],["impl TryFrom<Empty> for V4"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/default/trait.Default.js b/main/trait.impl/core/default/trait.Default.js new file mode 100644 index 000000000..6d09065f9 --- /dev/null +++ b/main/trait.impl/core/default/trait.Default.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[["impl Default for VersionSpec"],["impl Default for ToolchainSpec"],["impl<T> Default for InheritOption<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/error/trait.Error.js b/main/trait.impl/core/error/trait.Error.js new file mode 100644 index 000000000..885c85081 --- /dev/null +++ b/main/trait.impl/core/error/trait.Error.js @@ -0,0 +1,5 @@ +(function() {var implementors = { +"archive":[["impl Error for ArchiveError"]], +"test_support":[["impl Error for ProcessError"]], +"volta_core":[["impl Error for VoltaError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/fmt/trait.Debug.js b/main/trait.impl/core/fmt/trait.Debug.js new file mode 100644 index 000000000..6c7c355a1 --- /dev/null +++ b/main/trait.impl/core/fmt/trait.Debug.js @@ -0,0 +1,7 @@ +(function() {var implementors = { +"archive":[["impl Debug for ArchiveError"]], +"test_support":[["impl Debug for Execs"],["impl Debug for ProcessError"],["impl Debug for MatchKind"],["impl Debug for ProcessBuilder"]], +"validate_npm_package_name":[["impl Debug for Validity"]], +"volta":[["impl Debug for Run"],["impl Debug for Source"],["impl Debug for Completions"]], +"volta_core":[["impl Debug for Publish"],["impl Debug for MetadataHook"],["impl Debug for NodeVersion"],["impl Debug for Spec"],["impl Debug for NodeEntry"],["impl Debug for ErrorEnv"],["impl Debug for RegistryFormat"],["impl Debug for ErrorKind"],["impl Debug for PackageDetails"],["impl Debug for VersionSpec"],["impl Debug for EventKind"],["impl Debug for NodeVersion"],["impl Debug for RawDistInfo"],["impl Debug for RawPackageVersionInfo"],["impl Debug for DistroHook"],["impl Debug for Inner"],["impl Debug for ExitCode"],["impl Debug for Platform"],["impl Debug for RawPackageMetadata"],["impl Debug for LogVerbosity"],["impl Debug for PackageManager"],["impl Debug for YarnIndexHook"],["impl Debug for VersionTag"],["impl Debug for VoltaError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/fmt/trait.Display.js b/main/trait.impl/core/fmt/trait.Display.js new file mode 100644 index 000000000..838dd5f8b --- /dev/null +++ b/main/trait.impl/core/fmt/trait.Display.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"archive":[["impl Display for ArchiveError"]], +"test_support":[["impl Display for Execs"],["impl Display for ProcessBuilder"],["impl Display for ProcessError"]], +"volta":[["impl Display for Source"],["impl Display for PackageManagerKind"]], +"volta_core":[["impl Display for ErrorKind"],["impl Display for VersionSpec"],["impl Display for NodeVersion"],["impl Display for Node"],["impl Display for VersionTag"],["impl Display for Package"],["impl Display for Yarn"],["impl Display for ManifestKey"],["impl Display for BundledNpm"],["impl Display for Pnpm"],["impl Display for Source"],["impl Display for ActivityKind"],["impl Display for Npm"],["impl Display for Spec"],["impl Display for VoltaError"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/iter/traits/iterator/trait.Iterator.js b/main/trait.impl/core/iter/traits/iterator/trait.Iterator.js new file mode 100644 index 000000000..0a261f5f8 --- /dev/null +++ b/main/trait.impl/core/iter/traits/iterator/trait.Iterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"test_support":[["impl<T, I1: Iterator<Item = T>, I2: Iterator<Item = T>> Iterator for ZipAll<I1, I2>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.Copy.js b/main/trait.impl/core/marker/trait.Copy.js new file mode 100644 index 000000000..b27b59600 --- /dev/null +++ b/main/trait.impl/core/marker/trait.Copy.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"archive":[["impl Copy for Origin"]], +"test_support":[["impl Copy for MatchKind"]], +"volta":[["impl Copy for PackageManagerKind"],["impl Copy for Format"]], +"volta_core":[["impl Copy for Source"],["impl Copy for LogVerbosity"],["impl Copy for PackageManager"],["impl Copy for NeedsScope"],["impl Copy for ActivityKind"],["impl Copy for ExitCode"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.Freeze.js b/main/trait.impl/core/marker/trait.Freeze.js new file mode 100644 index 000000000..a7a49c64d --- /dev/null +++ b/main/trait.impl/core/marker/trait.Freeze.js @@ -0,0 +1,12 @@ +(function() {var implementors = { +"archive":[["impl Freeze for Tarball",1,["archive::tarball::Tarball"]],["impl Freeze for Zip",1,["archive::zip::Zip"]],["impl Freeze for ArchiveError",1,["archive::ArchiveError"]],["impl Freeze for Origin",1,["archive::Origin"]]], +"progress_read":[["impl<R, T, F> Freeze for ProgressRead<R, T, F>where\n F: Freeze,\n R: Freeze,\n T: Freeze,",1,["progress_read::ProgressRead"]]], +"test_support":[["impl Freeze for Execs",1,["test_support::matchers::Execs"]],["impl Freeze for MatchKind",1,["test_support::matchers::MatchKind"]],["impl<I1, I2> Freeze for ZipAll<I1, I2>where\n I1: Freeze,\n I2: Freeze,",1,["test_support::matchers::ZipAll"]],["impl Freeze for Remove",1,["test_support::paths::Remove"]],["impl Freeze for ProcessBuilder",1,["test_support::process::ProcessBuilder"]],["impl Freeze for ProcessError",1,["test_support::process::ProcessError"]]], +"validate_npm_package_name":[["impl Freeze for Validity",1,["validate_npm_package_name::Validity"]]], +"volta":[["impl Freeze for Completions",1,["volta::command::completions::Completions"]],["impl Freeze for Fetch",1,["volta::command::fetch::Fetch"]],["impl Freeze for Install",1,["volta::command::install::Install"]],["impl Freeze for Toolchain",1,["volta::command::list::toolchain::Toolchain"]],["impl Freeze for Lookup",1,["volta::command::list::toolchain::Lookup"]],["impl Freeze for Format",1,["volta::command::list::Format"]],["impl Freeze for Source",1,["volta::command::list::Source"]],["impl Freeze for PackageDetails",1,["volta::command::list::PackageDetails"]],["impl Freeze for Package",1,["volta::command::list::Package"]],["impl Freeze for Node",1,["volta::command::list::Node"]],["impl Freeze for PackageManagerKind",1,["volta::command::list::PackageManagerKind"]],["impl Freeze for PackageManager",1,["volta::command::list::PackageManager"]],["impl Freeze for Filter",1,["volta::command::list::Filter"]],["impl Freeze for List",1,["volta::command::list::List"]],["impl Freeze for Subcommand",1,["volta::command::list::Subcommand"]],["impl Freeze for Pin",1,["volta::command::pin::Pin"]],["impl Freeze for Run",1,["volta::command::run::Run"]],["impl Freeze for Setup",1,["volta::command::setup::Setup"]],["impl Freeze for Uninstall",1,["volta::command::uninstall::Uninstall"]],["impl Freeze for Use",1,["volta::command::use::Use"]],["impl Freeze for Which",1,["volta::command::which::Which"]],["impl Freeze for Volta",1,["volta::cli::Volta"]],["impl Freeze for Subcommand",1,["volta::cli::Subcommand"]],["impl Freeze for Error",1,["volta::common::Error"]]], +"volta_core":[["impl Freeze for ErrorKind",1,["volta_core::error::kind::ErrorKind"]],["impl Freeze for VoltaError",1,["volta_core::error::VoltaError"]],["impl Freeze for Inner",1,["volta_core::error::Inner"]],["impl Freeze for ExitCode",1,["volta_core::error::ExitCode"]],["impl Freeze for Event",1,["volta_core::event::Event"]],["impl Freeze for ErrorEnv",1,["volta_core::event::ErrorEnv"]],["impl Freeze for EventKind",1,["volta_core::event::EventKind"]],["impl Freeze for EventLog",1,["volta_core::event::EventLog"]],["impl Freeze for RawResolveHook",1,["volta_core::hook::serial::RawResolveHook"]],["impl Freeze for RawIndexHook",1,["volta_core::hook::serial::RawIndexHook"]],["impl Freeze for RawPublishHook",1,["volta_core::hook::serial::RawPublishHook"]],["impl Freeze for RawHookConfig",1,["volta_core::hook::serial::RawHookConfig"]],["impl Freeze for RawEventHooks",1,["volta_core::hook::serial::RawEventHooks"]],["impl<T> Freeze for RawToolHooks<T>",1,["volta_core::hook::serial::RawToolHooks"]],["impl Freeze for RawYarnHooks",1,["volta_core::hook::serial::RawYarnHooks"]],["impl Freeze for DistroHook",1,["volta_core::hook::tool::DistroHook"]],["impl Freeze for MetadataHook",1,["volta_core::hook::tool::MetadataHook"]],["impl Freeze for YarnIndexHook",1,["volta_core::hook::tool::YarnIndexHook"]],["impl Freeze for Publish",1,["volta_core::hook::Publish"]],["impl !Freeze for LazyHookConfig",1,["volta_core::hook::LazyHookConfig"]],["impl Freeze for HookConfig",1,["volta_core::hook::HookConfig"]],["impl<T> Freeze for ToolHooks<T>",1,["volta_core::hook::ToolHooks"]],["impl Freeze for YarnHooks",1,["volta_core::hook::YarnHooks"]],["impl Freeze for RegistryFormat",1,["volta_core::hook::RegistryFormat"]],["impl Freeze for EventHooks",1,["volta_core::hook::EventHooks"]],["impl Freeze for LogContext",1,["volta_core::log::LogContext"]],["impl Freeze for LogVerbosity",1,["volta_core::log::LogVerbosity"]],["impl Freeze for Logger",1,["volta_core::log::Logger"]],["impl Freeze for Image",1,["volta_core::platform::image::Image"]],["impl Freeze for System",1,["volta_core::platform::system::System"]],["impl Freeze for Source",1,["volta_core::platform::Source"]],["impl<T> Freeze for Sourced<T>where\n T: Freeze,",1,["volta_core::platform::Sourced"]],["impl<T> Freeze for InheritOption<T>where\n T: Freeze,",1,["volta_core::platform::InheritOption"]],["impl Freeze for PlatformSpec",1,["volta_core::platform::PlatformSpec"]],["impl Freeze for CliPlatform",1,["volta_core::platform::CliPlatform"]],["impl Freeze for Platform",1,["volta_core::platform::Platform"]],["impl Freeze for Manifest",1,["volta_core::project::serial::Manifest"]],["impl Freeze for ManifestKey",1,["volta_core::project::serial::ManifestKey"]],["impl Freeze for RawManifest",1,["volta_core::project::serial::RawManifest"]],["impl Freeze for ToolchainSpec",1,["volta_core::project::serial::ToolchainSpec"]],["impl !Freeze for LazyProject",1,["volta_core::project::LazyProject"]],["impl Freeze for Project",1,["volta_core::project::Project"]],["impl Freeze for PartialPlatform",1,["volta_core::project::PartialPlatform"]],["impl Freeze for DefaultBinary",1,["volta_core::run::binary::DefaultBinary"]],["impl Freeze for Executor",1,["volta_core::run::executor::Executor"]],["impl Freeze for ToolCommand",1,["volta_core::run::executor::ToolCommand"]],["impl Freeze for ToolKind",1,["volta_core::run::executor::ToolKind"]],["impl Freeze for PackageInstallCommand",1,["volta_core::run::executor::PackageInstallCommand"]],["impl Freeze for PackageLinkCommand",1,["volta_core::run::executor::PackageLinkCommand"]],["impl Freeze for PackageUpgradeCommand",1,["volta_core::run::executor::PackageUpgradeCommand"]],["impl Freeze for InternalInstallCommand",1,["volta_core::run::executor::InternalInstallCommand"]],["impl Freeze for UninstallCommand",1,["volta_core::run::executor::UninstallCommand"]],["impl<'a> Freeze for CommandArg<'a>",1,["volta_core::run::parser::CommandArg"]],["impl<'a> Freeze for GlobalCommand<'a>",1,["volta_core::run::parser::GlobalCommand"]],["impl<'a> Freeze for InstallArgs<'a>",1,["volta_core::run::parser::InstallArgs"]],["impl<'a> Freeze for UninstallArgs<'a>",1,["volta_core::run::parser::UninstallArgs"]],["impl<'a> Freeze for UpgradeArgs<'a>",1,["volta_core::run::parser::UpgradeArgs"]],["impl<'a> Freeze for InterceptedCommand<'a>",1,["volta_core::run::parser::InterceptedCommand"]],["impl<'a> Freeze for LinkArgs<'a>",1,["volta_core::run::parser::LinkArgs"]],["impl Freeze for ActivityKind",1,["volta_core::session::ActivityKind"]],["impl !Freeze for Session",1,["volta_core::session::Session"]],["impl Freeze for ShimResult",1,["volta_core::shim::ShimResult"]],["impl Freeze for LockState",1,["volta_core::sync::LockState"]],["impl Freeze for VoltaLock",1,["volta_core::sync::VoltaLock"]],["impl Freeze for Manifest",1,["volta_core::tool::node::fetch::Manifest"]],["impl Freeze for NodeIndex",1,["volta_core::tool::node::metadata::NodeIndex"]],["impl Freeze for NodeEntry",1,["volta_core::tool::node::metadata::NodeEntry"]],["impl Freeze for RawNodeIndex",1,["volta_core::tool::node::metadata::RawNodeIndex"]],["impl Freeze for RawNodeEntry",1,["volta_core::tool::node::metadata::RawNodeEntry"]],["impl Freeze for NodeVersion",1,["volta_core::tool::node::NodeVersion"]],["impl Freeze for Node",1,["volta_core::tool::node::Node"]],["impl Freeze for Npm",1,["volta_core::tool::npm::Npm"]],["impl Freeze for BundledNpm",1,["volta_core::tool::npm::BundledNpm"]],["impl Freeze for PackageManager",1,["volta_core::tool::package::manager::PackageManager"]],["impl Freeze for BinMapVisitor",1,["volta_core::tool::package::metadata::serde_bins::BinMapVisitor"]],["impl Freeze for PackageConfig",1,["volta_core::tool::package::metadata::PackageConfig"]],["impl Freeze for BinConfig",1,["volta_core::tool::package::metadata::BinConfig"]],["impl Freeze for RawPlatformSpec",1,["volta_core::tool::package::metadata::RawPlatformSpec"]],["impl Freeze for PackageManifest",1,["volta_core::tool::package::metadata::PackageManifest"]],["impl Freeze for GlobalYarnManifest",1,["volta_core::tool::package::metadata::GlobalYarnManifest"]],["impl Freeze for Package",1,["volta_core::tool::package::Package"]],["impl Freeze for DirectInstall",1,["volta_core::tool::package::DirectInstall"]],["impl Freeze for InPlaceUpgrade",1,["volta_core::tool::package::InPlaceUpgrade"]],["impl Freeze for NeedsScope",1,["volta_core::tool::package::NeedsScope"]],["impl Freeze for Pnpm",1,["volta_core::tool::pnpm::Pnpm"]],["impl Freeze for PackageDetails",1,["volta_core::tool::registry::PackageDetails"]],["impl Freeze for PackageIndex",1,["volta_core::tool::registry::PackageIndex"]],["impl Freeze for RawPackageMetadata",1,["volta_core::tool::registry::RawPackageMetadata"]],["impl Freeze for RawPackageVersionInfo",1,["volta_core::tool::registry::RawPackageVersionInfo"]],["impl Freeze for RawDistInfo",1,["volta_core::tool::registry::RawDistInfo"]],["impl Freeze for YarnIndex",1,["volta_core::tool::yarn::metadata::YarnIndex"]],["impl Freeze for RawYarnIndex",1,["volta_core::tool::yarn::metadata::RawYarnIndex"]],["impl Freeze for RawYarnEntry",1,["volta_core::tool::yarn::metadata::RawYarnEntry"]],["impl Freeze for RawYarnAsset",1,["volta_core::tool::yarn::metadata::RawYarnAsset"]],["impl Freeze for Yarn",1,["volta_core::tool::yarn::Yarn"]],["impl Freeze for Spec",1,["volta_core::tool::Spec"]],["impl Freeze for FetchStatus",1,["volta_core::tool::FetchStatus"]],["impl Freeze for NodeVersion",1,["volta_core::toolchain::serial::NodeVersion"]],["impl Freeze for Platform",1,["volta_core::toolchain::serial::Platform"]],["impl !Freeze for LazyToolchain",1,["volta_core::toolchain::LazyToolchain"]],["impl Freeze for Toolchain",1,["volta_core::toolchain::Toolchain"]],["impl Freeze for VersionVisitor",1,["volta_core::version::version_serde::VersionVisitor"]],["impl Freeze for Wrapper",1,["volta_core::version::hashmap_version_serde::Wrapper"]],["impl Freeze for VersionSpec",1,["volta_core::version::VersionSpec"]],["impl Freeze for VersionTag",1,["volta_core::version::VersionTag"]]], +"volta_layout":[["impl Freeze for VoltaInstall",1,["volta_layout::v0::VoltaInstall"]],["impl Freeze for VoltaHome",1,["volta_layout::v0::VoltaHome"]],["impl Freeze for VoltaInstall",1,["volta_layout::v1::VoltaInstall"]],["impl Freeze for VoltaHome",1,["volta_layout::v1::VoltaHome"]],["impl Freeze for VoltaHome",1,["volta_layout::v2::VoltaHome"]],["impl Freeze for VoltaHome",1,["volta_layout::v3::VoltaHome"]],["impl Freeze for VoltaHome",1,["volta_layout::v4::VoltaHome"]]], +"volta_layout_macro":[["impl Freeze for Ast",1,["volta_layout_macro::ast::Ast"]],["impl Freeze for LayoutStruct",1,["volta_layout_macro::ast::LayoutStruct"]],["impl Freeze for Directory",1,["volta_layout_macro::ast::Directory"]],["impl Freeze for EntryKind",1,["volta_layout_macro::ast::EntryKind"]],["impl Freeze for FieldPrefix",1,["volta_layout_macro::ast::FieldPrefix"]],["impl Freeze for FieldContents",1,["volta_layout_macro::ast::FieldContents"]],["impl Freeze for Ir",1,["volta_layout_macro::ir::Ir"]],["impl Freeze for Entry",1,["volta_layout_macro::ir::Entry"]]], +"volta_migrate":[["impl Freeze for Empty",1,["volta_migrate::empty::Empty"]],["impl Freeze for V0",1,["volta_migrate::v0::V0"]],["impl Freeze for V1",1,["volta_migrate::v1::V1"]],["impl Freeze for V2",1,["volta_migrate::v2::V2"]],["impl Freeze for LegacyPackageConfig",1,["volta_migrate::v3::config::LegacyPackageConfig"]],["impl Freeze for LegacyPlatform",1,["volta_migrate::v3::config::LegacyPlatform"]],["impl Freeze for NodeVersion",1,["volta_migrate::v3::config::NodeVersion"]],["impl Freeze for V3",1,["volta_migrate::v3::V3"]],["impl Freeze for V4",1,["volta_migrate::v4::V4"]],["impl Freeze for MigrationState",1,["volta_migrate::MigrationState"]]], +"volta_shim":[["impl Freeze for Error",1,["volta_shim::common::Error"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.Send.js b/main/trait.impl/core/marker/trait.Send.js new file mode 100644 index 000000000..0dc2491dd --- /dev/null +++ b/main/trait.impl/core/marker/trait.Send.js @@ -0,0 +1,12 @@ +(function() {var implementors = { +"archive":[["impl !Send for Tarball",1,["archive::tarball::Tarball"]],["impl !Send for Zip",1,["archive::zip::Zip"]],["impl Send for ArchiveError",1,["archive::ArchiveError"]],["impl Send for Origin",1,["archive::Origin"]]], +"progress_read":[["impl<R, T, F> Send for ProgressRead<R, T, F>where\n F: Send,\n R: Send,\n T: Send,",1,["progress_read::ProgressRead"]]], +"test_support":[["impl Send for Execs",1,["test_support::matchers::Execs"]],["impl Send for MatchKind",1,["test_support::matchers::MatchKind"]],["impl<I1, I2> Send for ZipAll<I1, I2>where\n I1: Send,\n I2: Send,",1,["test_support::matchers::ZipAll"]],["impl Send for Remove",1,["test_support::paths::Remove"]],["impl Send for ProcessBuilder",1,["test_support::process::ProcessBuilder"]],["impl Send for ProcessError",1,["test_support::process::ProcessError"]]], +"validate_npm_package_name":[["impl Send for Validity",1,["validate_npm_package_name::Validity"]]], +"volta":[["impl Send for Completions",1,["volta::command::completions::Completions"]],["impl Send for Fetch",1,["volta::command::fetch::Fetch"]],["impl Send for Install",1,["volta::command::install::Install"]],["impl Send for Toolchain",1,["volta::command::list::toolchain::Toolchain"]],["impl Send for Lookup",1,["volta::command::list::toolchain::Lookup"]],["impl Send for Format",1,["volta::command::list::Format"]],["impl Send for Source",1,["volta::command::list::Source"]],["impl Send for PackageDetails",1,["volta::command::list::PackageDetails"]],["impl Send for Package",1,["volta::command::list::Package"]],["impl Send for Node",1,["volta::command::list::Node"]],["impl Send for PackageManagerKind",1,["volta::command::list::PackageManagerKind"]],["impl Send for PackageManager",1,["volta::command::list::PackageManager"]],["impl Send for Filter",1,["volta::command::list::Filter"]],["impl Send for List",1,["volta::command::list::List"]],["impl Send for Subcommand",1,["volta::command::list::Subcommand"]],["impl Send for Pin",1,["volta::command::pin::Pin"]],["impl Send for Run",1,["volta::command::run::Run"]],["impl Send for Setup",1,["volta::command::setup::Setup"]],["impl Send for Uninstall",1,["volta::command::uninstall::Uninstall"]],["impl Send for Use",1,["volta::command::use::Use"]],["impl Send for Which",1,["volta::command::which::Which"]],["impl Send for Volta",1,["volta::cli::Volta"]],["impl Send for Subcommand",1,["volta::cli::Subcommand"]],["impl !Send for Error",1,["volta::common::Error"]]], +"volta_core":[["impl Send for ErrorKind",1,["volta_core::error::kind::ErrorKind"]],["impl !Send for VoltaError",1,["volta_core::error::VoltaError"]],["impl !Send for Inner",1,["volta_core::error::Inner"]],["impl Send for ExitCode",1,["volta_core::error::ExitCode"]],["impl Send for Event",1,["volta_core::event::Event"]],["impl Send for ErrorEnv",1,["volta_core::event::ErrorEnv"]],["impl Send for EventKind",1,["volta_core::event::EventKind"]],["impl Send for EventLog",1,["volta_core::event::EventLog"]],["impl Send for RawResolveHook",1,["volta_core::hook::serial::RawResolveHook"]],["impl Send for RawIndexHook",1,["volta_core::hook::serial::RawIndexHook"]],["impl Send for RawPublishHook",1,["volta_core::hook::serial::RawPublishHook"]],["impl Send for RawHookConfig",1,["volta_core::hook::serial::RawHookConfig"]],["impl Send for RawEventHooks",1,["volta_core::hook::serial::RawEventHooks"]],["impl<T> Send for RawToolHooks<T>where\n T: Send,",1,["volta_core::hook::serial::RawToolHooks"]],["impl Send for RawYarnHooks",1,["volta_core::hook::serial::RawYarnHooks"]],["impl Send for DistroHook",1,["volta_core::hook::tool::DistroHook"]],["impl Send for MetadataHook",1,["volta_core::hook::tool::MetadataHook"]],["impl Send for YarnIndexHook",1,["volta_core::hook::tool::YarnIndexHook"]],["impl Send for Publish",1,["volta_core::hook::Publish"]],["impl Send for LazyHookConfig",1,["volta_core::hook::LazyHookConfig"]],["impl Send for HookConfig",1,["volta_core::hook::HookConfig"]],["impl<T> Send for ToolHooks<T>where\n T: Send,",1,["volta_core::hook::ToolHooks"]],["impl Send for YarnHooks",1,["volta_core::hook::YarnHooks"]],["impl Send for RegistryFormat",1,["volta_core::hook::RegistryFormat"]],["impl Send for EventHooks",1,["volta_core::hook::EventHooks"]],["impl Send for LogContext",1,["volta_core::log::LogContext"]],["impl Send for LogVerbosity",1,["volta_core::log::LogVerbosity"]],["impl Send for Logger",1,["volta_core::log::Logger"]],["impl Send for Image",1,["volta_core::platform::image::Image"]],["impl Send for System",1,["volta_core::platform::system::System"]],["impl Send for Source",1,["volta_core::platform::Source"]],["impl<T> Send for Sourced<T>where\n T: Send,",1,["volta_core::platform::Sourced"]],["impl<T> Send for InheritOption<T>where\n T: Send,",1,["volta_core::platform::InheritOption"]],["impl Send for PlatformSpec",1,["volta_core::platform::PlatformSpec"]],["impl Send for CliPlatform",1,["volta_core::platform::CliPlatform"]],["impl Send for Platform",1,["volta_core::platform::Platform"]],["impl Send for Manifest",1,["volta_core::project::serial::Manifest"]],["impl Send for ManifestKey",1,["volta_core::project::serial::ManifestKey"]],["impl Send for RawManifest",1,["volta_core::project::serial::RawManifest"]],["impl Send for ToolchainSpec",1,["volta_core::project::serial::ToolchainSpec"]],["impl Send for LazyProject",1,["volta_core::project::LazyProject"]],["impl Send for Project",1,["volta_core::project::Project"]],["impl Send for PartialPlatform",1,["volta_core::project::PartialPlatform"]],["impl Send for DefaultBinary",1,["volta_core::run::binary::DefaultBinary"]],["impl Send for Executor",1,["volta_core::run::executor::Executor"]],["impl Send for ToolCommand",1,["volta_core::run::executor::ToolCommand"]],["impl Send for ToolKind",1,["volta_core::run::executor::ToolKind"]],["impl Send for PackageInstallCommand",1,["volta_core::run::executor::PackageInstallCommand"]],["impl Send for PackageLinkCommand",1,["volta_core::run::executor::PackageLinkCommand"]],["impl Send for PackageUpgradeCommand",1,["volta_core::run::executor::PackageUpgradeCommand"]],["impl Send for InternalInstallCommand",1,["volta_core::run::executor::InternalInstallCommand"]],["impl Send for UninstallCommand",1,["volta_core::run::executor::UninstallCommand"]],["impl<'a> Send for CommandArg<'a>",1,["volta_core::run::parser::CommandArg"]],["impl<'a> Send for GlobalCommand<'a>",1,["volta_core::run::parser::GlobalCommand"]],["impl<'a> Send for InstallArgs<'a>",1,["volta_core::run::parser::InstallArgs"]],["impl<'a> Send for UninstallArgs<'a>",1,["volta_core::run::parser::UninstallArgs"]],["impl<'a> Send for UpgradeArgs<'a>",1,["volta_core::run::parser::UpgradeArgs"]],["impl<'a> Send for InterceptedCommand<'a>",1,["volta_core::run::parser::InterceptedCommand"]],["impl<'a> Send for LinkArgs<'a>",1,["volta_core::run::parser::LinkArgs"]],["impl Send for ActivityKind",1,["volta_core::session::ActivityKind"]],["impl Send for Session",1,["volta_core::session::Session"]],["impl Send for ShimResult",1,["volta_core::shim::ShimResult"]],["impl Send for LockState",1,["volta_core::sync::LockState"]],["impl Send for VoltaLock",1,["volta_core::sync::VoltaLock"]],["impl Send for Manifest",1,["volta_core::tool::node::fetch::Manifest"]],["impl Send for NodeIndex",1,["volta_core::tool::node::metadata::NodeIndex"]],["impl Send for NodeEntry",1,["volta_core::tool::node::metadata::NodeEntry"]],["impl Send for RawNodeIndex",1,["volta_core::tool::node::metadata::RawNodeIndex"]],["impl Send for RawNodeEntry",1,["volta_core::tool::node::metadata::RawNodeEntry"]],["impl Send for NodeVersion",1,["volta_core::tool::node::NodeVersion"]],["impl Send for Node",1,["volta_core::tool::node::Node"]],["impl Send for Npm",1,["volta_core::tool::npm::Npm"]],["impl Send for BundledNpm",1,["volta_core::tool::npm::BundledNpm"]],["impl Send for PackageManager",1,["volta_core::tool::package::manager::PackageManager"]],["impl Send for BinMapVisitor",1,["volta_core::tool::package::metadata::serde_bins::BinMapVisitor"]],["impl Send for PackageConfig",1,["volta_core::tool::package::metadata::PackageConfig"]],["impl Send for BinConfig",1,["volta_core::tool::package::metadata::BinConfig"]],["impl Send for RawPlatformSpec",1,["volta_core::tool::package::metadata::RawPlatformSpec"]],["impl Send for PackageManifest",1,["volta_core::tool::package::metadata::PackageManifest"]],["impl Send for GlobalYarnManifest",1,["volta_core::tool::package::metadata::GlobalYarnManifest"]],["impl Send for Package",1,["volta_core::tool::package::Package"]],["impl Send for DirectInstall",1,["volta_core::tool::package::DirectInstall"]],["impl Send for InPlaceUpgrade",1,["volta_core::tool::package::InPlaceUpgrade"]],["impl Send for NeedsScope",1,["volta_core::tool::package::NeedsScope"]],["impl Send for Pnpm",1,["volta_core::tool::pnpm::Pnpm"]],["impl Send for PackageDetails",1,["volta_core::tool::registry::PackageDetails"]],["impl Send for PackageIndex",1,["volta_core::tool::registry::PackageIndex"]],["impl Send for RawPackageMetadata",1,["volta_core::tool::registry::RawPackageMetadata"]],["impl Send for RawPackageVersionInfo",1,["volta_core::tool::registry::RawPackageVersionInfo"]],["impl Send for RawDistInfo",1,["volta_core::tool::registry::RawDistInfo"]],["impl Send for YarnIndex",1,["volta_core::tool::yarn::metadata::YarnIndex"]],["impl Send for RawYarnIndex",1,["volta_core::tool::yarn::metadata::RawYarnIndex"]],["impl Send for RawYarnEntry",1,["volta_core::tool::yarn::metadata::RawYarnEntry"]],["impl Send for RawYarnAsset",1,["volta_core::tool::yarn::metadata::RawYarnAsset"]],["impl Send for Yarn",1,["volta_core::tool::yarn::Yarn"]],["impl Send for Spec",1,["volta_core::tool::Spec"]],["impl Send for FetchStatus",1,["volta_core::tool::FetchStatus"]],["impl Send for NodeVersion",1,["volta_core::toolchain::serial::NodeVersion"]],["impl Send for Platform",1,["volta_core::toolchain::serial::Platform"]],["impl Send for LazyToolchain",1,["volta_core::toolchain::LazyToolchain"]],["impl Send for Toolchain",1,["volta_core::toolchain::Toolchain"]],["impl Send for VersionVisitor",1,["volta_core::version::version_serde::VersionVisitor"]],["impl Send for Wrapper",1,["volta_core::version::hashmap_version_serde::Wrapper"]],["impl Send for VersionSpec",1,["volta_core::version::VersionSpec"]],["impl Send for VersionTag",1,["volta_core::version::VersionTag"]]], +"volta_layout":[["impl Send for VoltaInstall",1,["volta_layout::v0::VoltaInstall"]],["impl Send for VoltaHome",1,["volta_layout::v0::VoltaHome"]],["impl Send for VoltaInstall",1,["volta_layout::v1::VoltaInstall"]],["impl Send for VoltaHome",1,["volta_layout::v1::VoltaHome"]],["impl Send for VoltaHome",1,["volta_layout::v2::VoltaHome"]],["impl Send for VoltaHome",1,["volta_layout::v3::VoltaHome"]],["impl Send for VoltaHome",1,["volta_layout::v4::VoltaHome"]]], +"volta_layout_macro":[["impl !Send for Ast",1,["volta_layout_macro::ast::Ast"]],["impl !Send for LayoutStruct",1,["volta_layout_macro::ast::LayoutStruct"]],["impl !Send for Directory",1,["volta_layout_macro::ast::Directory"]],["impl Send for EntryKind",1,["volta_layout_macro::ast::EntryKind"]],["impl !Send for FieldPrefix",1,["volta_layout_macro::ast::FieldPrefix"]],["impl !Send for FieldContents",1,["volta_layout_macro::ast::FieldContents"]],["impl !Send for Ir",1,["volta_layout_macro::ir::Ir"]],["impl !Send for Entry",1,["volta_layout_macro::ir::Entry"]]], +"volta_migrate":[["impl Send for Empty",1,["volta_migrate::empty::Empty"]],["impl Send for V0",1,["volta_migrate::v0::V0"]],["impl Send for V1",1,["volta_migrate::v1::V1"]],["impl Send for V2",1,["volta_migrate::v2::V2"]],["impl Send for LegacyPackageConfig",1,["volta_migrate::v3::config::LegacyPackageConfig"]],["impl Send for LegacyPlatform",1,["volta_migrate::v3::config::LegacyPlatform"]],["impl Send for NodeVersion",1,["volta_migrate::v3::config::NodeVersion"]],["impl Send for V3",1,["volta_migrate::v3::V3"]],["impl Send for V4",1,["volta_migrate::v4::V4"]],["impl Send for MigrationState",1,["volta_migrate::MigrationState"]]], +"volta_shim":[["impl !Send for Error",1,["volta_shim::common::Error"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.StructuralEq.js b/main/trait.impl/core/marker/trait.StructuralEq.js new file mode 100644 index 000000000..b643b376d --- /dev/null +++ b/main/trait.impl/core/marker/trait.StructuralEq.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"test_support":[["impl StructuralEq for MatchKind"]], +"validate_npm_package_name":[["impl StructuralEq for Validity"]], +"volta":[["impl StructuralEq for PackageManagerKind"]], +"volta_core":[["impl StructuralEq for MetadataHook"],["impl StructuralEq for ErrorEnv"],["impl StructuralEq for YarnIndexHook"],["impl StructuralEq for PlatformSpec"],["impl StructuralEq for ShimResult"],["impl StructuralEq for Publish"],["impl StructuralEq for NodeVersion"],["impl StructuralEq for ActivityKind"],["impl StructuralEq for EventKind"],["impl StructuralEq for Platform"],["impl StructuralEq for RegistryFormat"],["impl StructuralEq for PackageManager"],["impl StructuralEq for PackageConfig"],["impl StructuralEq for DistroHook"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.StructuralPartialEq.js b/main/trait.impl/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 000000000..f450cbe86 --- /dev/null +++ b/main/trait.impl/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,6 @@ +(function() {var implementors = { +"test_support":[["impl StructuralPartialEq for MatchKind"]], +"validate_npm_package_name":[["impl StructuralPartialEq for Validity"]], +"volta":[["impl StructuralPartialEq for PackageManagerKind"],["impl StructuralPartialEq for Source"]], +"volta_core":[["impl StructuralPartialEq for PlatformSpec"],["impl StructuralPartialEq for EventKind"],["impl StructuralPartialEq for ActivityKind"],["impl StructuralPartialEq for ErrorEnv"],["impl StructuralPartialEq for RegistryFormat"],["impl StructuralPartialEq for YarnIndexHook"],["impl StructuralPartialEq for MetadataHook"],["impl StructuralPartialEq for NodeVersion"],["impl StructuralPartialEq for Platform"],["impl StructuralPartialEq for DistroHook"],["impl StructuralPartialEq for NeedsScope"],["impl StructuralPartialEq for ShimResult"],["impl StructuralPartialEq for PackageConfig"],["impl StructuralPartialEq for PackageManager"],["impl StructuralPartialEq for Publish"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.Sync.js b/main/trait.impl/core/marker/trait.Sync.js new file mode 100644 index 000000000..af0289d1f --- /dev/null +++ b/main/trait.impl/core/marker/trait.Sync.js @@ -0,0 +1,12 @@ +(function() {var implementors = { +"archive":[["impl !Sync for Tarball",1,["archive::tarball::Tarball"]],["impl !Sync for Zip",1,["archive::zip::Zip"]],["impl Sync for ArchiveError",1,["archive::ArchiveError"]],["impl Sync for Origin",1,["archive::Origin"]]], +"progress_read":[["impl<R, T, F> Sync for ProgressRead<R, T, F>where\n F: Sync,\n R: Sync,\n T: Sync,",1,["progress_read::ProgressRead"]]], +"test_support":[["impl Sync for Execs",1,["test_support::matchers::Execs"]],["impl Sync for MatchKind",1,["test_support::matchers::MatchKind"]],["impl<I1, I2> Sync for ZipAll<I1, I2>where\n I1: Sync,\n I2: Sync,",1,["test_support::matchers::ZipAll"]],["impl Sync for Remove",1,["test_support::paths::Remove"]],["impl Sync for ProcessBuilder",1,["test_support::process::ProcessBuilder"]],["impl Sync for ProcessError",1,["test_support::process::ProcessError"]]], +"validate_npm_package_name":[["impl Sync for Validity",1,["validate_npm_package_name::Validity"]]], +"volta":[["impl Sync for Completions",1,["volta::command::completions::Completions"]],["impl Sync for Fetch",1,["volta::command::fetch::Fetch"]],["impl Sync for Install",1,["volta::command::install::Install"]],["impl Sync for Toolchain",1,["volta::command::list::toolchain::Toolchain"]],["impl Sync for Lookup",1,["volta::command::list::toolchain::Lookup"]],["impl Sync for Format",1,["volta::command::list::Format"]],["impl Sync for Source",1,["volta::command::list::Source"]],["impl Sync for PackageDetails",1,["volta::command::list::PackageDetails"]],["impl Sync for Package",1,["volta::command::list::Package"]],["impl Sync for Node",1,["volta::command::list::Node"]],["impl Sync for PackageManagerKind",1,["volta::command::list::PackageManagerKind"]],["impl Sync for PackageManager",1,["volta::command::list::PackageManager"]],["impl Sync for Filter",1,["volta::command::list::Filter"]],["impl Sync for List",1,["volta::command::list::List"]],["impl Sync for Subcommand",1,["volta::command::list::Subcommand"]],["impl Sync for Pin",1,["volta::command::pin::Pin"]],["impl Sync for Run",1,["volta::command::run::Run"]],["impl Sync for Setup",1,["volta::command::setup::Setup"]],["impl Sync for Uninstall",1,["volta::command::uninstall::Uninstall"]],["impl Sync for Use",1,["volta::command::use::Use"]],["impl Sync for Which",1,["volta::command::which::Which"]],["impl Sync for Volta",1,["volta::cli::Volta"]],["impl Sync for Subcommand",1,["volta::cli::Subcommand"]],["impl !Sync for Error",1,["volta::common::Error"]]], +"volta_core":[["impl Sync for ErrorKind",1,["volta_core::error::kind::ErrorKind"]],["impl !Sync for VoltaError",1,["volta_core::error::VoltaError"]],["impl !Sync for Inner",1,["volta_core::error::Inner"]],["impl Sync for ExitCode",1,["volta_core::error::ExitCode"]],["impl Sync for Event",1,["volta_core::event::Event"]],["impl Sync for ErrorEnv",1,["volta_core::event::ErrorEnv"]],["impl Sync for EventKind",1,["volta_core::event::EventKind"]],["impl Sync for EventLog",1,["volta_core::event::EventLog"]],["impl Sync for RawResolveHook",1,["volta_core::hook::serial::RawResolveHook"]],["impl Sync for RawIndexHook",1,["volta_core::hook::serial::RawIndexHook"]],["impl Sync for RawPublishHook",1,["volta_core::hook::serial::RawPublishHook"]],["impl Sync for RawHookConfig",1,["volta_core::hook::serial::RawHookConfig"]],["impl Sync for RawEventHooks",1,["volta_core::hook::serial::RawEventHooks"]],["impl<T> Sync for RawToolHooks<T>where\n T: Sync,",1,["volta_core::hook::serial::RawToolHooks"]],["impl Sync for RawYarnHooks",1,["volta_core::hook::serial::RawYarnHooks"]],["impl Sync for DistroHook",1,["volta_core::hook::tool::DistroHook"]],["impl Sync for MetadataHook",1,["volta_core::hook::tool::MetadataHook"]],["impl Sync for YarnIndexHook",1,["volta_core::hook::tool::YarnIndexHook"]],["impl Sync for Publish",1,["volta_core::hook::Publish"]],["impl !Sync for LazyHookConfig",1,["volta_core::hook::LazyHookConfig"]],["impl Sync for HookConfig",1,["volta_core::hook::HookConfig"]],["impl<T> Sync for ToolHooks<T>where\n T: Sync,",1,["volta_core::hook::ToolHooks"]],["impl Sync for YarnHooks",1,["volta_core::hook::YarnHooks"]],["impl Sync for RegistryFormat",1,["volta_core::hook::RegistryFormat"]],["impl Sync for EventHooks",1,["volta_core::hook::EventHooks"]],["impl Sync for LogContext",1,["volta_core::log::LogContext"]],["impl Sync for LogVerbosity",1,["volta_core::log::LogVerbosity"]],["impl Sync for Logger",1,["volta_core::log::Logger"]],["impl Sync for Image",1,["volta_core::platform::image::Image"]],["impl Sync for System",1,["volta_core::platform::system::System"]],["impl Sync for Source",1,["volta_core::platform::Source"]],["impl<T> Sync for Sourced<T>where\n T: Sync,",1,["volta_core::platform::Sourced"]],["impl<T> Sync for InheritOption<T>where\n T: Sync,",1,["volta_core::platform::InheritOption"]],["impl Sync for PlatformSpec",1,["volta_core::platform::PlatformSpec"]],["impl Sync for CliPlatform",1,["volta_core::platform::CliPlatform"]],["impl Sync for Platform",1,["volta_core::platform::Platform"]],["impl Sync for Manifest",1,["volta_core::project::serial::Manifest"]],["impl Sync for ManifestKey",1,["volta_core::project::serial::ManifestKey"]],["impl Sync for RawManifest",1,["volta_core::project::serial::RawManifest"]],["impl Sync for ToolchainSpec",1,["volta_core::project::serial::ToolchainSpec"]],["impl !Sync for LazyProject",1,["volta_core::project::LazyProject"]],["impl Sync for Project",1,["volta_core::project::Project"]],["impl Sync for PartialPlatform",1,["volta_core::project::PartialPlatform"]],["impl Sync for DefaultBinary",1,["volta_core::run::binary::DefaultBinary"]],["impl Sync for Executor",1,["volta_core::run::executor::Executor"]],["impl Sync for ToolCommand",1,["volta_core::run::executor::ToolCommand"]],["impl Sync for ToolKind",1,["volta_core::run::executor::ToolKind"]],["impl Sync for PackageInstallCommand",1,["volta_core::run::executor::PackageInstallCommand"]],["impl Sync for PackageLinkCommand",1,["volta_core::run::executor::PackageLinkCommand"]],["impl Sync for PackageUpgradeCommand",1,["volta_core::run::executor::PackageUpgradeCommand"]],["impl Sync for InternalInstallCommand",1,["volta_core::run::executor::InternalInstallCommand"]],["impl Sync for UninstallCommand",1,["volta_core::run::executor::UninstallCommand"]],["impl<'a> Sync for CommandArg<'a>",1,["volta_core::run::parser::CommandArg"]],["impl<'a> Sync for GlobalCommand<'a>",1,["volta_core::run::parser::GlobalCommand"]],["impl<'a> Sync for InstallArgs<'a>",1,["volta_core::run::parser::InstallArgs"]],["impl<'a> Sync for UninstallArgs<'a>",1,["volta_core::run::parser::UninstallArgs"]],["impl<'a> Sync for UpgradeArgs<'a>",1,["volta_core::run::parser::UpgradeArgs"]],["impl<'a> Sync for InterceptedCommand<'a>",1,["volta_core::run::parser::InterceptedCommand"]],["impl<'a> Sync for LinkArgs<'a>",1,["volta_core::run::parser::LinkArgs"]],["impl Sync for ActivityKind",1,["volta_core::session::ActivityKind"]],["impl !Sync for Session",1,["volta_core::session::Session"]],["impl Sync for ShimResult",1,["volta_core::shim::ShimResult"]],["impl Sync for LockState",1,["volta_core::sync::LockState"]],["impl Sync for VoltaLock",1,["volta_core::sync::VoltaLock"]],["impl Sync for Manifest",1,["volta_core::tool::node::fetch::Manifest"]],["impl Sync for NodeIndex",1,["volta_core::tool::node::metadata::NodeIndex"]],["impl Sync for NodeEntry",1,["volta_core::tool::node::metadata::NodeEntry"]],["impl Sync for RawNodeIndex",1,["volta_core::tool::node::metadata::RawNodeIndex"]],["impl Sync for RawNodeEntry",1,["volta_core::tool::node::metadata::RawNodeEntry"]],["impl Sync for NodeVersion",1,["volta_core::tool::node::NodeVersion"]],["impl Sync for Node",1,["volta_core::tool::node::Node"]],["impl Sync for Npm",1,["volta_core::tool::npm::Npm"]],["impl Sync for BundledNpm",1,["volta_core::tool::npm::BundledNpm"]],["impl Sync for PackageManager",1,["volta_core::tool::package::manager::PackageManager"]],["impl Sync for BinMapVisitor",1,["volta_core::tool::package::metadata::serde_bins::BinMapVisitor"]],["impl Sync for PackageConfig",1,["volta_core::tool::package::metadata::PackageConfig"]],["impl Sync for BinConfig",1,["volta_core::tool::package::metadata::BinConfig"]],["impl Sync for RawPlatformSpec",1,["volta_core::tool::package::metadata::RawPlatformSpec"]],["impl Sync for PackageManifest",1,["volta_core::tool::package::metadata::PackageManifest"]],["impl Sync for GlobalYarnManifest",1,["volta_core::tool::package::metadata::GlobalYarnManifest"]],["impl Sync for Package",1,["volta_core::tool::package::Package"]],["impl Sync for DirectInstall",1,["volta_core::tool::package::DirectInstall"]],["impl Sync for InPlaceUpgrade",1,["volta_core::tool::package::InPlaceUpgrade"]],["impl Sync for NeedsScope",1,["volta_core::tool::package::NeedsScope"]],["impl Sync for Pnpm",1,["volta_core::tool::pnpm::Pnpm"]],["impl Sync for PackageDetails",1,["volta_core::tool::registry::PackageDetails"]],["impl Sync for PackageIndex",1,["volta_core::tool::registry::PackageIndex"]],["impl Sync for RawPackageMetadata",1,["volta_core::tool::registry::RawPackageMetadata"]],["impl Sync for RawPackageVersionInfo",1,["volta_core::tool::registry::RawPackageVersionInfo"]],["impl Sync for RawDistInfo",1,["volta_core::tool::registry::RawDistInfo"]],["impl Sync for YarnIndex",1,["volta_core::tool::yarn::metadata::YarnIndex"]],["impl Sync for RawYarnIndex",1,["volta_core::tool::yarn::metadata::RawYarnIndex"]],["impl Sync for RawYarnEntry",1,["volta_core::tool::yarn::metadata::RawYarnEntry"]],["impl Sync for RawYarnAsset",1,["volta_core::tool::yarn::metadata::RawYarnAsset"]],["impl Sync for Yarn",1,["volta_core::tool::yarn::Yarn"]],["impl Sync for Spec",1,["volta_core::tool::Spec"]],["impl Sync for FetchStatus",1,["volta_core::tool::FetchStatus"]],["impl Sync for NodeVersion",1,["volta_core::toolchain::serial::NodeVersion"]],["impl Sync for Platform",1,["volta_core::toolchain::serial::Platform"]],["impl !Sync for LazyToolchain",1,["volta_core::toolchain::LazyToolchain"]],["impl Sync for Toolchain",1,["volta_core::toolchain::Toolchain"]],["impl Sync for VersionVisitor",1,["volta_core::version::version_serde::VersionVisitor"]],["impl Sync for Wrapper",1,["volta_core::version::hashmap_version_serde::Wrapper"]],["impl Sync for VersionSpec",1,["volta_core::version::VersionSpec"]],["impl Sync for VersionTag",1,["volta_core::version::VersionTag"]]], +"volta_layout":[["impl Sync for VoltaInstall",1,["volta_layout::v0::VoltaInstall"]],["impl Sync for VoltaHome",1,["volta_layout::v0::VoltaHome"]],["impl Sync for VoltaInstall",1,["volta_layout::v1::VoltaInstall"]],["impl Sync for VoltaHome",1,["volta_layout::v1::VoltaHome"]],["impl Sync for VoltaHome",1,["volta_layout::v2::VoltaHome"]],["impl Sync for VoltaHome",1,["volta_layout::v3::VoltaHome"]],["impl Sync for VoltaHome",1,["volta_layout::v4::VoltaHome"]]], +"volta_layout_macro":[["impl !Sync for Ast",1,["volta_layout_macro::ast::Ast"]],["impl !Sync for LayoutStruct",1,["volta_layout_macro::ast::LayoutStruct"]],["impl !Sync for Directory",1,["volta_layout_macro::ast::Directory"]],["impl Sync for EntryKind",1,["volta_layout_macro::ast::EntryKind"]],["impl !Sync for FieldPrefix",1,["volta_layout_macro::ast::FieldPrefix"]],["impl !Sync for FieldContents",1,["volta_layout_macro::ast::FieldContents"]],["impl !Sync for Ir",1,["volta_layout_macro::ir::Ir"]],["impl !Sync for Entry",1,["volta_layout_macro::ir::Entry"]]], +"volta_migrate":[["impl Sync for Empty",1,["volta_migrate::empty::Empty"]],["impl Sync for V0",1,["volta_migrate::v0::V0"]],["impl Sync for V1",1,["volta_migrate::v1::V1"]],["impl Sync for V2",1,["volta_migrate::v2::V2"]],["impl Sync for LegacyPackageConfig",1,["volta_migrate::v3::config::LegacyPackageConfig"]],["impl Sync for LegacyPlatform",1,["volta_migrate::v3::config::LegacyPlatform"]],["impl Sync for NodeVersion",1,["volta_migrate::v3::config::NodeVersion"]],["impl Sync for V3",1,["volta_migrate::v3::V3"]],["impl Sync for V4",1,["volta_migrate::v4::V4"]],["impl Sync for MigrationState",1,["volta_migrate::MigrationState"]]], +"volta_shim":[["impl !Sync for Error",1,["volta_shim::common::Error"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/marker/trait.Unpin.js b/main/trait.impl/core/marker/trait.Unpin.js new file mode 100644 index 000000000..cdab4910a --- /dev/null +++ b/main/trait.impl/core/marker/trait.Unpin.js @@ -0,0 +1,12 @@ +(function() {var implementors = { +"archive":[["impl Unpin for Tarball",1,["archive::tarball::Tarball"]],["impl Unpin for Zip",1,["archive::zip::Zip"]],["impl Unpin for ArchiveError",1,["archive::ArchiveError"]],["impl Unpin for Origin",1,["archive::Origin"]]], +"progress_read":[["impl<R, T, F> Unpin for ProgressRead<R, T, F>where\n F: Unpin,\n R: Unpin,\n T: Unpin,",1,["progress_read::ProgressRead"]]], +"test_support":[["impl Unpin for Execs",1,["test_support::matchers::Execs"]],["impl Unpin for MatchKind",1,["test_support::matchers::MatchKind"]],["impl<I1, I2> Unpin for ZipAll<I1, I2>where\n I1: Unpin,\n I2: Unpin,",1,["test_support::matchers::ZipAll"]],["impl Unpin for Remove",1,["test_support::paths::Remove"]],["impl Unpin for ProcessBuilder",1,["test_support::process::ProcessBuilder"]],["impl Unpin for ProcessError",1,["test_support::process::ProcessError"]]], +"validate_npm_package_name":[["impl Unpin for Validity",1,["validate_npm_package_name::Validity"]]], +"volta":[["impl Unpin for Completions",1,["volta::command::completions::Completions"]],["impl Unpin for Fetch",1,["volta::command::fetch::Fetch"]],["impl Unpin for Install",1,["volta::command::install::Install"]],["impl Unpin for Toolchain",1,["volta::command::list::toolchain::Toolchain"]],["impl Unpin for Lookup",1,["volta::command::list::toolchain::Lookup"]],["impl Unpin for Format",1,["volta::command::list::Format"]],["impl Unpin for Source",1,["volta::command::list::Source"]],["impl Unpin for PackageDetails",1,["volta::command::list::PackageDetails"]],["impl Unpin for Package",1,["volta::command::list::Package"]],["impl Unpin for Node",1,["volta::command::list::Node"]],["impl Unpin for PackageManagerKind",1,["volta::command::list::PackageManagerKind"]],["impl Unpin for PackageManager",1,["volta::command::list::PackageManager"]],["impl Unpin for Filter",1,["volta::command::list::Filter"]],["impl Unpin for List",1,["volta::command::list::List"]],["impl Unpin for Subcommand",1,["volta::command::list::Subcommand"]],["impl Unpin for Pin",1,["volta::command::pin::Pin"]],["impl Unpin for Run",1,["volta::command::run::Run"]],["impl Unpin for Setup",1,["volta::command::setup::Setup"]],["impl Unpin for Uninstall",1,["volta::command::uninstall::Uninstall"]],["impl Unpin for Use",1,["volta::command::use::Use"]],["impl Unpin for Which",1,["volta::command::which::Which"]],["impl Unpin for Volta",1,["volta::cli::Volta"]],["impl Unpin for Subcommand",1,["volta::cli::Subcommand"]],["impl Unpin for Error",1,["volta::common::Error"]]], +"volta_core":[["impl Unpin for ErrorKind",1,["volta_core::error::kind::ErrorKind"]],["impl Unpin for VoltaError",1,["volta_core::error::VoltaError"]],["impl Unpin for Inner",1,["volta_core::error::Inner"]],["impl Unpin for ExitCode",1,["volta_core::error::ExitCode"]],["impl Unpin for Event",1,["volta_core::event::Event"]],["impl Unpin for ErrorEnv",1,["volta_core::event::ErrorEnv"]],["impl Unpin for EventKind",1,["volta_core::event::EventKind"]],["impl Unpin for EventLog",1,["volta_core::event::EventLog"]],["impl Unpin for RawResolveHook",1,["volta_core::hook::serial::RawResolveHook"]],["impl Unpin for RawIndexHook",1,["volta_core::hook::serial::RawIndexHook"]],["impl Unpin for RawPublishHook",1,["volta_core::hook::serial::RawPublishHook"]],["impl Unpin for RawHookConfig",1,["volta_core::hook::serial::RawHookConfig"]],["impl Unpin for RawEventHooks",1,["volta_core::hook::serial::RawEventHooks"]],["impl<T> Unpin for RawToolHooks<T>where\n T: Unpin,",1,["volta_core::hook::serial::RawToolHooks"]],["impl Unpin for RawYarnHooks",1,["volta_core::hook::serial::RawYarnHooks"]],["impl Unpin for DistroHook",1,["volta_core::hook::tool::DistroHook"]],["impl Unpin for MetadataHook",1,["volta_core::hook::tool::MetadataHook"]],["impl Unpin for YarnIndexHook",1,["volta_core::hook::tool::YarnIndexHook"]],["impl Unpin for Publish",1,["volta_core::hook::Publish"]],["impl Unpin for LazyHookConfig",1,["volta_core::hook::LazyHookConfig"]],["impl Unpin for HookConfig",1,["volta_core::hook::HookConfig"]],["impl<T> Unpin for ToolHooks<T>where\n T: Unpin,",1,["volta_core::hook::ToolHooks"]],["impl Unpin for YarnHooks",1,["volta_core::hook::YarnHooks"]],["impl Unpin for RegistryFormat",1,["volta_core::hook::RegistryFormat"]],["impl Unpin for EventHooks",1,["volta_core::hook::EventHooks"]],["impl Unpin for LogContext",1,["volta_core::log::LogContext"]],["impl Unpin for LogVerbosity",1,["volta_core::log::LogVerbosity"]],["impl Unpin for Logger",1,["volta_core::log::Logger"]],["impl Unpin for Image",1,["volta_core::platform::image::Image"]],["impl Unpin for System",1,["volta_core::platform::system::System"]],["impl Unpin for Source",1,["volta_core::platform::Source"]],["impl<T> Unpin for Sourced<T>where\n T: Unpin,",1,["volta_core::platform::Sourced"]],["impl<T> Unpin for InheritOption<T>where\n T: Unpin,",1,["volta_core::platform::InheritOption"]],["impl Unpin for PlatformSpec",1,["volta_core::platform::PlatformSpec"]],["impl Unpin for CliPlatform",1,["volta_core::platform::CliPlatform"]],["impl Unpin for Platform",1,["volta_core::platform::Platform"]],["impl Unpin for Manifest",1,["volta_core::project::serial::Manifest"]],["impl Unpin for ManifestKey",1,["volta_core::project::serial::ManifestKey"]],["impl Unpin for RawManifest",1,["volta_core::project::serial::RawManifest"]],["impl Unpin for ToolchainSpec",1,["volta_core::project::serial::ToolchainSpec"]],["impl Unpin for LazyProject",1,["volta_core::project::LazyProject"]],["impl Unpin for Project",1,["volta_core::project::Project"]],["impl Unpin for PartialPlatform",1,["volta_core::project::PartialPlatform"]],["impl Unpin for DefaultBinary",1,["volta_core::run::binary::DefaultBinary"]],["impl Unpin for Executor",1,["volta_core::run::executor::Executor"]],["impl Unpin for ToolCommand",1,["volta_core::run::executor::ToolCommand"]],["impl Unpin for ToolKind",1,["volta_core::run::executor::ToolKind"]],["impl Unpin for PackageInstallCommand",1,["volta_core::run::executor::PackageInstallCommand"]],["impl Unpin for PackageLinkCommand",1,["volta_core::run::executor::PackageLinkCommand"]],["impl Unpin for PackageUpgradeCommand",1,["volta_core::run::executor::PackageUpgradeCommand"]],["impl Unpin for InternalInstallCommand",1,["volta_core::run::executor::InternalInstallCommand"]],["impl Unpin for UninstallCommand",1,["volta_core::run::executor::UninstallCommand"]],["impl<'a> Unpin for CommandArg<'a>",1,["volta_core::run::parser::CommandArg"]],["impl<'a> Unpin for GlobalCommand<'a>",1,["volta_core::run::parser::GlobalCommand"]],["impl<'a> Unpin for InstallArgs<'a>",1,["volta_core::run::parser::InstallArgs"]],["impl<'a> Unpin for UninstallArgs<'a>",1,["volta_core::run::parser::UninstallArgs"]],["impl<'a> Unpin for UpgradeArgs<'a>",1,["volta_core::run::parser::UpgradeArgs"]],["impl<'a> Unpin for InterceptedCommand<'a>",1,["volta_core::run::parser::InterceptedCommand"]],["impl<'a> Unpin for LinkArgs<'a>",1,["volta_core::run::parser::LinkArgs"]],["impl Unpin for ActivityKind",1,["volta_core::session::ActivityKind"]],["impl Unpin for Session",1,["volta_core::session::Session"]],["impl Unpin for ShimResult",1,["volta_core::shim::ShimResult"]],["impl Unpin for LockState",1,["volta_core::sync::LockState"]],["impl Unpin for VoltaLock",1,["volta_core::sync::VoltaLock"]],["impl Unpin for Manifest",1,["volta_core::tool::node::fetch::Manifest"]],["impl Unpin for NodeIndex",1,["volta_core::tool::node::metadata::NodeIndex"]],["impl Unpin for NodeEntry",1,["volta_core::tool::node::metadata::NodeEntry"]],["impl Unpin for RawNodeIndex",1,["volta_core::tool::node::metadata::RawNodeIndex"]],["impl Unpin for RawNodeEntry",1,["volta_core::tool::node::metadata::RawNodeEntry"]],["impl Unpin for NodeVersion",1,["volta_core::tool::node::NodeVersion"]],["impl Unpin for Node",1,["volta_core::tool::node::Node"]],["impl Unpin for Npm",1,["volta_core::tool::npm::Npm"]],["impl Unpin for BundledNpm",1,["volta_core::tool::npm::BundledNpm"]],["impl Unpin for PackageManager",1,["volta_core::tool::package::manager::PackageManager"]],["impl Unpin for BinMapVisitor",1,["volta_core::tool::package::metadata::serde_bins::BinMapVisitor"]],["impl Unpin for PackageConfig",1,["volta_core::tool::package::metadata::PackageConfig"]],["impl Unpin for BinConfig",1,["volta_core::tool::package::metadata::BinConfig"]],["impl Unpin for RawPlatformSpec",1,["volta_core::tool::package::metadata::RawPlatformSpec"]],["impl Unpin for PackageManifest",1,["volta_core::tool::package::metadata::PackageManifest"]],["impl Unpin for GlobalYarnManifest",1,["volta_core::tool::package::metadata::GlobalYarnManifest"]],["impl Unpin for Package",1,["volta_core::tool::package::Package"]],["impl Unpin for DirectInstall",1,["volta_core::tool::package::DirectInstall"]],["impl Unpin for InPlaceUpgrade",1,["volta_core::tool::package::InPlaceUpgrade"]],["impl Unpin for NeedsScope",1,["volta_core::tool::package::NeedsScope"]],["impl Unpin for Pnpm",1,["volta_core::tool::pnpm::Pnpm"]],["impl Unpin for PackageDetails",1,["volta_core::tool::registry::PackageDetails"]],["impl Unpin for PackageIndex",1,["volta_core::tool::registry::PackageIndex"]],["impl Unpin for RawPackageMetadata",1,["volta_core::tool::registry::RawPackageMetadata"]],["impl Unpin for RawPackageVersionInfo",1,["volta_core::tool::registry::RawPackageVersionInfo"]],["impl Unpin for RawDistInfo",1,["volta_core::tool::registry::RawDistInfo"]],["impl Unpin for YarnIndex",1,["volta_core::tool::yarn::metadata::YarnIndex"]],["impl Unpin for RawYarnIndex",1,["volta_core::tool::yarn::metadata::RawYarnIndex"]],["impl Unpin for RawYarnEntry",1,["volta_core::tool::yarn::metadata::RawYarnEntry"]],["impl Unpin for RawYarnAsset",1,["volta_core::tool::yarn::metadata::RawYarnAsset"]],["impl Unpin for Yarn",1,["volta_core::tool::yarn::Yarn"]],["impl Unpin for Spec",1,["volta_core::tool::Spec"]],["impl Unpin for FetchStatus",1,["volta_core::tool::FetchStatus"]],["impl Unpin for NodeVersion",1,["volta_core::toolchain::serial::NodeVersion"]],["impl Unpin for Platform",1,["volta_core::toolchain::serial::Platform"]],["impl Unpin for LazyToolchain",1,["volta_core::toolchain::LazyToolchain"]],["impl Unpin for Toolchain",1,["volta_core::toolchain::Toolchain"]],["impl Unpin for VersionVisitor",1,["volta_core::version::version_serde::VersionVisitor"]],["impl Unpin for Wrapper",1,["volta_core::version::hashmap_version_serde::Wrapper"]],["impl Unpin for VersionSpec",1,["volta_core::version::VersionSpec"]],["impl Unpin for VersionTag",1,["volta_core::version::VersionTag"]]], +"volta_layout":[["impl Unpin for VoltaInstall",1,["volta_layout::v0::VoltaInstall"]],["impl Unpin for VoltaHome",1,["volta_layout::v0::VoltaHome"]],["impl Unpin for VoltaInstall",1,["volta_layout::v1::VoltaInstall"]],["impl Unpin for VoltaHome",1,["volta_layout::v1::VoltaHome"]],["impl Unpin for VoltaHome",1,["volta_layout::v2::VoltaHome"]],["impl Unpin for VoltaHome",1,["volta_layout::v3::VoltaHome"]],["impl Unpin for VoltaHome",1,["volta_layout::v4::VoltaHome"]]], +"volta_layout_macro":[["impl Unpin for Ast",1,["volta_layout_macro::ast::Ast"]],["impl Unpin for LayoutStruct",1,["volta_layout_macro::ast::LayoutStruct"]],["impl Unpin for Directory",1,["volta_layout_macro::ast::Directory"]],["impl Unpin for EntryKind",1,["volta_layout_macro::ast::EntryKind"]],["impl Unpin for FieldPrefix",1,["volta_layout_macro::ast::FieldPrefix"]],["impl Unpin for FieldContents",1,["volta_layout_macro::ast::FieldContents"]],["impl Unpin for Ir",1,["volta_layout_macro::ir::Ir"]],["impl Unpin for Entry",1,["volta_layout_macro::ir::Entry"]]], +"volta_migrate":[["impl Unpin for Empty",1,["volta_migrate::empty::Empty"]],["impl Unpin for V0",1,["volta_migrate::v0::V0"]],["impl Unpin for V1",1,["volta_migrate::v1::V1"]],["impl Unpin for V2",1,["volta_migrate::v2::V2"]],["impl Unpin for LegacyPackageConfig",1,["volta_migrate::v3::config::LegacyPackageConfig"]],["impl Unpin for LegacyPlatform",1,["volta_migrate::v3::config::LegacyPlatform"]],["impl Unpin for NodeVersion",1,["volta_migrate::v3::config::NodeVersion"]],["impl Unpin for V3",1,["volta_migrate::v3::V3"]],["impl Unpin for V4",1,["volta_migrate::v4::V4"]],["impl Unpin for MigrationState",1,["volta_migrate::MigrationState"]]], +"volta_shim":[["impl Unpin for Error",1,["volta_shim::common::Error"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/ops/drop/trait.Drop.js b/main/trait.impl/core/ops/drop/trait.Drop.js new file mode 100644 index 000000000..32c51ef9e --- /dev/null +++ b/main/trait.impl/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[["impl Drop for VoltaLock"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js b/main/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 000000000..373630dd2 --- /dev/null +++ b/main/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,12 @@ +(function() {var implementors = { +"archive":[["impl !RefUnwindSafe for Tarball",1,["archive::tarball::Tarball"]],["impl !RefUnwindSafe for Zip",1,["archive::zip::Zip"]],["impl !RefUnwindSafe for ArchiveError",1,["archive::ArchiveError"]],["impl RefUnwindSafe for Origin",1,["archive::Origin"]]], +"progress_read":[["impl<R, T, F> RefUnwindSafe for ProgressRead<R, T, F>where\n F: RefUnwindSafe,\n R: RefUnwindSafe,\n T: RefUnwindSafe,",1,["progress_read::ProgressRead"]]], +"test_support":[["impl RefUnwindSafe for Execs",1,["test_support::matchers::Execs"]],["impl RefUnwindSafe for MatchKind",1,["test_support::matchers::MatchKind"]],["impl<I1, I2> RefUnwindSafe for ZipAll<I1, I2>where\n I1: RefUnwindSafe,\n I2: RefUnwindSafe,",1,["test_support::matchers::ZipAll"]],["impl RefUnwindSafe for Remove",1,["test_support::paths::Remove"]],["impl RefUnwindSafe for ProcessBuilder",1,["test_support::process::ProcessBuilder"]],["impl RefUnwindSafe for ProcessError",1,["test_support::process::ProcessError"]]], +"validate_npm_package_name":[["impl RefUnwindSafe for Validity",1,["validate_npm_package_name::Validity"]]], +"volta":[["impl RefUnwindSafe for Completions",1,["volta::command::completions::Completions"]],["impl RefUnwindSafe for Fetch",1,["volta::command::fetch::Fetch"]],["impl RefUnwindSafe for Install",1,["volta::command::install::Install"]],["impl RefUnwindSafe for Toolchain",1,["volta::command::list::toolchain::Toolchain"]],["impl RefUnwindSafe for Lookup",1,["volta::command::list::toolchain::Lookup"]],["impl RefUnwindSafe for Format",1,["volta::command::list::Format"]],["impl RefUnwindSafe for Source",1,["volta::command::list::Source"]],["impl RefUnwindSafe for PackageDetails",1,["volta::command::list::PackageDetails"]],["impl RefUnwindSafe for Package",1,["volta::command::list::Package"]],["impl RefUnwindSafe for Node",1,["volta::command::list::Node"]],["impl RefUnwindSafe for PackageManagerKind",1,["volta::command::list::PackageManagerKind"]],["impl RefUnwindSafe for PackageManager",1,["volta::command::list::PackageManager"]],["impl RefUnwindSafe for Filter",1,["volta::command::list::Filter"]],["impl RefUnwindSafe for List",1,["volta::command::list::List"]],["impl RefUnwindSafe for Subcommand",1,["volta::command::list::Subcommand"]],["impl RefUnwindSafe for Pin",1,["volta::command::pin::Pin"]],["impl RefUnwindSafe for Run",1,["volta::command::run::Run"]],["impl RefUnwindSafe for Setup",1,["volta::command::setup::Setup"]],["impl RefUnwindSafe for Uninstall",1,["volta::command::uninstall::Uninstall"]],["impl RefUnwindSafe for Use",1,["volta::command::use::Use"]],["impl RefUnwindSafe for Which",1,["volta::command::which::Which"]],["impl RefUnwindSafe for Volta",1,["volta::cli::Volta"]],["impl RefUnwindSafe for Subcommand",1,["volta::cli::Subcommand"]],["impl !RefUnwindSafe for Error",1,["volta::common::Error"]]], +"volta_core":[["impl RefUnwindSafe for ErrorKind",1,["volta_core::error::kind::ErrorKind"]],["impl !RefUnwindSafe for VoltaError",1,["volta_core::error::VoltaError"]],["impl !RefUnwindSafe for Inner",1,["volta_core::error::Inner"]],["impl RefUnwindSafe for ExitCode",1,["volta_core::error::ExitCode"]],["impl RefUnwindSafe for Event",1,["volta_core::event::Event"]],["impl RefUnwindSafe for ErrorEnv",1,["volta_core::event::ErrorEnv"]],["impl RefUnwindSafe for EventKind",1,["volta_core::event::EventKind"]],["impl RefUnwindSafe for EventLog",1,["volta_core::event::EventLog"]],["impl RefUnwindSafe for RawResolveHook",1,["volta_core::hook::serial::RawResolveHook"]],["impl RefUnwindSafe for RawIndexHook",1,["volta_core::hook::serial::RawIndexHook"]],["impl RefUnwindSafe for RawPublishHook",1,["volta_core::hook::serial::RawPublishHook"]],["impl RefUnwindSafe for RawHookConfig",1,["volta_core::hook::serial::RawHookConfig"]],["impl RefUnwindSafe for RawEventHooks",1,["volta_core::hook::serial::RawEventHooks"]],["impl<T> RefUnwindSafe for RawToolHooks<T>where\n T: RefUnwindSafe,",1,["volta_core::hook::serial::RawToolHooks"]],["impl RefUnwindSafe for RawYarnHooks",1,["volta_core::hook::serial::RawYarnHooks"]],["impl RefUnwindSafe for DistroHook",1,["volta_core::hook::tool::DistroHook"]],["impl RefUnwindSafe for MetadataHook",1,["volta_core::hook::tool::MetadataHook"]],["impl RefUnwindSafe for YarnIndexHook",1,["volta_core::hook::tool::YarnIndexHook"]],["impl RefUnwindSafe for Publish",1,["volta_core::hook::Publish"]],["impl RefUnwindSafe for LazyHookConfig",1,["volta_core::hook::LazyHookConfig"]],["impl RefUnwindSafe for HookConfig",1,["volta_core::hook::HookConfig"]],["impl<T> RefUnwindSafe for ToolHooks<T>where\n T: RefUnwindSafe,",1,["volta_core::hook::ToolHooks"]],["impl RefUnwindSafe for YarnHooks",1,["volta_core::hook::YarnHooks"]],["impl RefUnwindSafe for RegistryFormat",1,["volta_core::hook::RegistryFormat"]],["impl RefUnwindSafe for EventHooks",1,["volta_core::hook::EventHooks"]],["impl RefUnwindSafe for LogContext",1,["volta_core::log::LogContext"]],["impl RefUnwindSafe for LogVerbosity",1,["volta_core::log::LogVerbosity"]],["impl RefUnwindSafe for Logger",1,["volta_core::log::Logger"]],["impl RefUnwindSafe for Image",1,["volta_core::platform::image::Image"]],["impl RefUnwindSafe for System",1,["volta_core::platform::system::System"]],["impl RefUnwindSafe for Source",1,["volta_core::platform::Source"]],["impl<T> RefUnwindSafe for Sourced<T>where\n T: RefUnwindSafe,",1,["volta_core::platform::Sourced"]],["impl<T> RefUnwindSafe for InheritOption<T>where\n T: RefUnwindSafe,",1,["volta_core::platform::InheritOption"]],["impl RefUnwindSafe for PlatformSpec",1,["volta_core::platform::PlatformSpec"]],["impl RefUnwindSafe for CliPlatform",1,["volta_core::platform::CliPlatform"]],["impl RefUnwindSafe for Platform",1,["volta_core::platform::Platform"]],["impl RefUnwindSafe for Manifest",1,["volta_core::project::serial::Manifest"]],["impl RefUnwindSafe for ManifestKey",1,["volta_core::project::serial::ManifestKey"]],["impl RefUnwindSafe for RawManifest",1,["volta_core::project::serial::RawManifest"]],["impl RefUnwindSafe for ToolchainSpec",1,["volta_core::project::serial::ToolchainSpec"]],["impl RefUnwindSafe for LazyProject",1,["volta_core::project::LazyProject"]],["impl RefUnwindSafe for Project",1,["volta_core::project::Project"]],["impl RefUnwindSafe for PartialPlatform",1,["volta_core::project::PartialPlatform"]],["impl RefUnwindSafe for DefaultBinary",1,["volta_core::run::binary::DefaultBinary"]],["impl !RefUnwindSafe for Executor",1,["volta_core::run::executor::Executor"]],["impl !RefUnwindSafe for ToolCommand",1,["volta_core::run::executor::ToolCommand"]],["impl RefUnwindSafe for ToolKind",1,["volta_core::run::executor::ToolKind"]],["impl !RefUnwindSafe for PackageInstallCommand",1,["volta_core::run::executor::PackageInstallCommand"]],["impl !RefUnwindSafe for PackageLinkCommand",1,["volta_core::run::executor::PackageLinkCommand"]],["impl !RefUnwindSafe for PackageUpgradeCommand",1,["volta_core::run::executor::PackageUpgradeCommand"]],["impl RefUnwindSafe for InternalInstallCommand",1,["volta_core::run::executor::InternalInstallCommand"]],["impl RefUnwindSafe for UninstallCommand",1,["volta_core::run::executor::UninstallCommand"]],["impl<'a> RefUnwindSafe for CommandArg<'a>",1,["volta_core::run::parser::CommandArg"]],["impl<'a> RefUnwindSafe for GlobalCommand<'a>",1,["volta_core::run::parser::GlobalCommand"]],["impl<'a> RefUnwindSafe for InstallArgs<'a>",1,["volta_core::run::parser::InstallArgs"]],["impl<'a> RefUnwindSafe for UninstallArgs<'a>",1,["volta_core::run::parser::UninstallArgs"]],["impl<'a> RefUnwindSafe for UpgradeArgs<'a>",1,["volta_core::run::parser::UpgradeArgs"]],["impl<'a> RefUnwindSafe for InterceptedCommand<'a>",1,["volta_core::run::parser::InterceptedCommand"]],["impl<'a> RefUnwindSafe for LinkArgs<'a>",1,["volta_core::run::parser::LinkArgs"]],["impl RefUnwindSafe for ActivityKind",1,["volta_core::session::ActivityKind"]],["impl RefUnwindSafe for Session",1,["volta_core::session::Session"]],["impl RefUnwindSafe for ShimResult",1,["volta_core::shim::ShimResult"]],["impl RefUnwindSafe for LockState",1,["volta_core::sync::LockState"]],["impl RefUnwindSafe for VoltaLock",1,["volta_core::sync::VoltaLock"]],["impl RefUnwindSafe for Manifest",1,["volta_core::tool::node::fetch::Manifest"]],["impl RefUnwindSafe for NodeIndex",1,["volta_core::tool::node::metadata::NodeIndex"]],["impl RefUnwindSafe for NodeEntry",1,["volta_core::tool::node::metadata::NodeEntry"]],["impl RefUnwindSafe for RawNodeIndex",1,["volta_core::tool::node::metadata::RawNodeIndex"]],["impl RefUnwindSafe for RawNodeEntry",1,["volta_core::tool::node::metadata::RawNodeEntry"]],["impl RefUnwindSafe for NodeVersion",1,["volta_core::tool::node::NodeVersion"]],["impl RefUnwindSafe for Node",1,["volta_core::tool::node::Node"]],["impl RefUnwindSafe for Npm",1,["volta_core::tool::npm::Npm"]],["impl RefUnwindSafe for BundledNpm",1,["volta_core::tool::npm::BundledNpm"]],["impl RefUnwindSafe for PackageManager",1,["volta_core::tool::package::manager::PackageManager"]],["impl RefUnwindSafe for BinMapVisitor",1,["volta_core::tool::package::metadata::serde_bins::BinMapVisitor"]],["impl RefUnwindSafe for PackageConfig",1,["volta_core::tool::package::metadata::PackageConfig"]],["impl RefUnwindSafe for BinConfig",1,["volta_core::tool::package::metadata::BinConfig"]],["impl RefUnwindSafe for RawPlatformSpec",1,["volta_core::tool::package::metadata::RawPlatformSpec"]],["impl RefUnwindSafe for PackageManifest",1,["volta_core::tool::package::metadata::PackageManifest"]],["impl RefUnwindSafe for GlobalYarnManifest",1,["volta_core::tool::package::metadata::GlobalYarnManifest"]],["impl RefUnwindSafe for Package",1,["volta_core::tool::package::Package"]],["impl RefUnwindSafe for DirectInstall",1,["volta_core::tool::package::DirectInstall"]],["impl RefUnwindSafe for InPlaceUpgrade",1,["volta_core::tool::package::InPlaceUpgrade"]],["impl RefUnwindSafe for NeedsScope",1,["volta_core::tool::package::NeedsScope"]],["impl RefUnwindSafe for Pnpm",1,["volta_core::tool::pnpm::Pnpm"]],["impl RefUnwindSafe for PackageDetails",1,["volta_core::tool::registry::PackageDetails"]],["impl RefUnwindSafe for PackageIndex",1,["volta_core::tool::registry::PackageIndex"]],["impl RefUnwindSafe for RawPackageMetadata",1,["volta_core::tool::registry::RawPackageMetadata"]],["impl RefUnwindSafe for RawPackageVersionInfo",1,["volta_core::tool::registry::RawPackageVersionInfo"]],["impl RefUnwindSafe for RawDistInfo",1,["volta_core::tool::registry::RawDistInfo"]],["impl RefUnwindSafe for YarnIndex",1,["volta_core::tool::yarn::metadata::YarnIndex"]],["impl RefUnwindSafe for RawYarnIndex",1,["volta_core::tool::yarn::metadata::RawYarnIndex"]],["impl RefUnwindSafe for RawYarnEntry",1,["volta_core::tool::yarn::metadata::RawYarnEntry"]],["impl RefUnwindSafe for RawYarnAsset",1,["volta_core::tool::yarn::metadata::RawYarnAsset"]],["impl RefUnwindSafe for Yarn",1,["volta_core::tool::yarn::Yarn"]],["impl RefUnwindSafe for Spec",1,["volta_core::tool::Spec"]],["impl RefUnwindSafe for FetchStatus",1,["volta_core::tool::FetchStatus"]],["impl RefUnwindSafe for NodeVersion",1,["volta_core::toolchain::serial::NodeVersion"]],["impl RefUnwindSafe for Platform",1,["volta_core::toolchain::serial::Platform"]],["impl RefUnwindSafe for LazyToolchain",1,["volta_core::toolchain::LazyToolchain"]],["impl RefUnwindSafe for Toolchain",1,["volta_core::toolchain::Toolchain"]],["impl RefUnwindSafe for VersionVisitor",1,["volta_core::version::version_serde::VersionVisitor"]],["impl RefUnwindSafe for Wrapper",1,["volta_core::version::hashmap_version_serde::Wrapper"]],["impl RefUnwindSafe for VersionSpec",1,["volta_core::version::VersionSpec"]],["impl RefUnwindSafe for VersionTag",1,["volta_core::version::VersionTag"]]], +"volta_layout":[["impl RefUnwindSafe for VoltaInstall",1,["volta_layout::v0::VoltaInstall"]],["impl RefUnwindSafe for VoltaHome",1,["volta_layout::v0::VoltaHome"]],["impl RefUnwindSafe for VoltaInstall",1,["volta_layout::v1::VoltaInstall"]],["impl RefUnwindSafe for VoltaHome",1,["volta_layout::v1::VoltaHome"]],["impl RefUnwindSafe for VoltaHome",1,["volta_layout::v2::VoltaHome"]],["impl RefUnwindSafe for VoltaHome",1,["volta_layout::v3::VoltaHome"]],["impl RefUnwindSafe for VoltaHome",1,["volta_layout::v4::VoltaHome"]]], +"volta_layout_macro":[["impl RefUnwindSafe for Ast",1,["volta_layout_macro::ast::Ast"]],["impl RefUnwindSafe for LayoutStruct",1,["volta_layout_macro::ast::LayoutStruct"]],["impl RefUnwindSafe for Directory",1,["volta_layout_macro::ast::Directory"]],["impl RefUnwindSafe for EntryKind",1,["volta_layout_macro::ast::EntryKind"]],["impl RefUnwindSafe for FieldPrefix",1,["volta_layout_macro::ast::FieldPrefix"]],["impl RefUnwindSafe for FieldContents",1,["volta_layout_macro::ast::FieldContents"]],["impl RefUnwindSafe for Ir",1,["volta_layout_macro::ir::Ir"]],["impl RefUnwindSafe for Entry",1,["volta_layout_macro::ir::Entry"]]], +"volta_migrate":[["impl RefUnwindSafe for Empty",1,["volta_migrate::empty::Empty"]],["impl RefUnwindSafe for V0",1,["volta_migrate::v0::V0"]],["impl RefUnwindSafe for V1",1,["volta_migrate::v1::V1"]],["impl RefUnwindSafe for V2",1,["volta_migrate::v2::V2"]],["impl RefUnwindSafe for LegacyPackageConfig",1,["volta_migrate::v3::config::LegacyPackageConfig"]],["impl RefUnwindSafe for LegacyPlatform",1,["volta_migrate::v3::config::LegacyPlatform"]],["impl RefUnwindSafe for NodeVersion",1,["volta_migrate::v3::config::NodeVersion"]],["impl RefUnwindSafe for V3",1,["volta_migrate::v3::V3"]],["impl RefUnwindSafe for V4",1,["volta_migrate::v4::V4"]],["impl RefUnwindSafe for MigrationState",1,["volta_migrate::MigrationState"]]], +"volta_shim":[["impl !RefUnwindSafe for Error",1,["volta_shim::common::Error"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js b/main/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 000000000..3dfdaa4f0 --- /dev/null +++ b/main/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,12 @@ +(function() {var implementors = { +"archive":[["impl !UnwindSafe for Tarball",1,["archive::tarball::Tarball"]],["impl !UnwindSafe for Zip",1,["archive::zip::Zip"]],["impl !UnwindSafe for ArchiveError",1,["archive::ArchiveError"]],["impl UnwindSafe for Origin",1,["archive::Origin"]]], +"progress_read":[["impl<R, T, F> UnwindSafe for ProgressRead<R, T, F>where\n F: UnwindSafe,\n R: UnwindSafe,\n T: UnwindSafe,",1,["progress_read::ProgressRead"]]], +"test_support":[["impl UnwindSafe for Execs",1,["test_support::matchers::Execs"]],["impl UnwindSafe for MatchKind",1,["test_support::matchers::MatchKind"]],["impl<I1, I2> UnwindSafe for ZipAll<I1, I2>where\n I1: UnwindSafe,\n I2: UnwindSafe,",1,["test_support::matchers::ZipAll"]],["impl UnwindSafe for Remove",1,["test_support::paths::Remove"]],["impl UnwindSafe for ProcessBuilder",1,["test_support::process::ProcessBuilder"]],["impl UnwindSafe for ProcessError",1,["test_support::process::ProcessError"]]], +"validate_npm_package_name":[["impl UnwindSafe for Validity",1,["validate_npm_package_name::Validity"]]], +"volta":[["impl UnwindSafe for Completions",1,["volta::command::completions::Completions"]],["impl UnwindSafe for Fetch",1,["volta::command::fetch::Fetch"]],["impl UnwindSafe for Install",1,["volta::command::install::Install"]],["impl UnwindSafe for Toolchain",1,["volta::command::list::toolchain::Toolchain"]],["impl UnwindSafe for Lookup",1,["volta::command::list::toolchain::Lookup"]],["impl UnwindSafe for Format",1,["volta::command::list::Format"]],["impl UnwindSafe for Source",1,["volta::command::list::Source"]],["impl UnwindSafe for PackageDetails",1,["volta::command::list::PackageDetails"]],["impl UnwindSafe for Package",1,["volta::command::list::Package"]],["impl UnwindSafe for Node",1,["volta::command::list::Node"]],["impl UnwindSafe for PackageManagerKind",1,["volta::command::list::PackageManagerKind"]],["impl UnwindSafe for PackageManager",1,["volta::command::list::PackageManager"]],["impl UnwindSafe for Filter",1,["volta::command::list::Filter"]],["impl UnwindSafe for List",1,["volta::command::list::List"]],["impl UnwindSafe for Subcommand",1,["volta::command::list::Subcommand"]],["impl UnwindSafe for Pin",1,["volta::command::pin::Pin"]],["impl UnwindSafe for Run",1,["volta::command::run::Run"]],["impl UnwindSafe for Setup",1,["volta::command::setup::Setup"]],["impl UnwindSafe for Uninstall",1,["volta::command::uninstall::Uninstall"]],["impl UnwindSafe for Use",1,["volta::command::use::Use"]],["impl UnwindSafe for Which",1,["volta::command::which::Which"]],["impl UnwindSafe for Volta",1,["volta::cli::Volta"]],["impl UnwindSafe for Subcommand",1,["volta::cli::Subcommand"]],["impl !UnwindSafe for Error",1,["volta::common::Error"]]], +"volta_core":[["impl UnwindSafe for ErrorKind",1,["volta_core::error::kind::ErrorKind"]],["impl !UnwindSafe for VoltaError",1,["volta_core::error::VoltaError"]],["impl !UnwindSafe for Inner",1,["volta_core::error::Inner"]],["impl UnwindSafe for ExitCode",1,["volta_core::error::ExitCode"]],["impl UnwindSafe for Event",1,["volta_core::event::Event"]],["impl UnwindSafe for ErrorEnv",1,["volta_core::event::ErrorEnv"]],["impl UnwindSafe for EventKind",1,["volta_core::event::EventKind"]],["impl UnwindSafe for EventLog",1,["volta_core::event::EventLog"]],["impl UnwindSafe for RawResolveHook",1,["volta_core::hook::serial::RawResolveHook"]],["impl UnwindSafe for RawIndexHook",1,["volta_core::hook::serial::RawIndexHook"]],["impl UnwindSafe for RawPublishHook",1,["volta_core::hook::serial::RawPublishHook"]],["impl UnwindSafe for RawHookConfig",1,["volta_core::hook::serial::RawHookConfig"]],["impl UnwindSafe for RawEventHooks",1,["volta_core::hook::serial::RawEventHooks"]],["impl<T> UnwindSafe for RawToolHooks<T>where\n T: UnwindSafe,",1,["volta_core::hook::serial::RawToolHooks"]],["impl UnwindSafe for RawYarnHooks",1,["volta_core::hook::serial::RawYarnHooks"]],["impl UnwindSafe for DistroHook",1,["volta_core::hook::tool::DistroHook"]],["impl UnwindSafe for MetadataHook",1,["volta_core::hook::tool::MetadataHook"]],["impl UnwindSafe for YarnIndexHook",1,["volta_core::hook::tool::YarnIndexHook"]],["impl UnwindSafe for Publish",1,["volta_core::hook::Publish"]],["impl UnwindSafe for LazyHookConfig",1,["volta_core::hook::LazyHookConfig"]],["impl UnwindSafe for HookConfig",1,["volta_core::hook::HookConfig"]],["impl<T> UnwindSafe for ToolHooks<T>where\n T: UnwindSafe,",1,["volta_core::hook::ToolHooks"]],["impl UnwindSafe for YarnHooks",1,["volta_core::hook::YarnHooks"]],["impl UnwindSafe for RegistryFormat",1,["volta_core::hook::RegistryFormat"]],["impl UnwindSafe for EventHooks",1,["volta_core::hook::EventHooks"]],["impl UnwindSafe for LogContext",1,["volta_core::log::LogContext"]],["impl UnwindSafe for LogVerbosity",1,["volta_core::log::LogVerbosity"]],["impl UnwindSafe for Logger",1,["volta_core::log::Logger"]],["impl UnwindSafe for Image",1,["volta_core::platform::image::Image"]],["impl UnwindSafe for System",1,["volta_core::platform::system::System"]],["impl UnwindSafe for Source",1,["volta_core::platform::Source"]],["impl<T> UnwindSafe for Sourced<T>where\n T: UnwindSafe,",1,["volta_core::platform::Sourced"]],["impl<T> UnwindSafe for InheritOption<T>where\n T: UnwindSafe,",1,["volta_core::platform::InheritOption"]],["impl UnwindSafe for PlatformSpec",1,["volta_core::platform::PlatformSpec"]],["impl UnwindSafe for CliPlatform",1,["volta_core::platform::CliPlatform"]],["impl UnwindSafe for Platform",1,["volta_core::platform::Platform"]],["impl UnwindSafe for Manifest",1,["volta_core::project::serial::Manifest"]],["impl UnwindSafe for ManifestKey",1,["volta_core::project::serial::ManifestKey"]],["impl UnwindSafe for RawManifest",1,["volta_core::project::serial::RawManifest"]],["impl UnwindSafe for ToolchainSpec",1,["volta_core::project::serial::ToolchainSpec"]],["impl UnwindSafe for LazyProject",1,["volta_core::project::LazyProject"]],["impl UnwindSafe for Project",1,["volta_core::project::Project"]],["impl UnwindSafe for PartialPlatform",1,["volta_core::project::PartialPlatform"]],["impl UnwindSafe for DefaultBinary",1,["volta_core::run::binary::DefaultBinary"]],["impl !UnwindSafe for Executor",1,["volta_core::run::executor::Executor"]],["impl !UnwindSafe for ToolCommand",1,["volta_core::run::executor::ToolCommand"]],["impl UnwindSafe for ToolKind",1,["volta_core::run::executor::ToolKind"]],["impl !UnwindSafe for PackageInstallCommand",1,["volta_core::run::executor::PackageInstallCommand"]],["impl !UnwindSafe for PackageLinkCommand",1,["volta_core::run::executor::PackageLinkCommand"]],["impl !UnwindSafe for PackageUpgradeCommand",1,["volta_core::run::executor::PackageUpgradeCommand"]],["impl UnwindSafe for InternalInstallCommand",1,["volta_core::run::executor::InternalInstallCommand"]],["impl UnwindSafe for UninstallCommand",1,["volta_core::run::executor::UninstallCommand"]],["impl<'a> UnwindSafe for CommandArg<'a>",1,["volta_core::run::parser::CommandArg"]],["impl<'a> UnwindSafe for GlobalCommand<'a>",1,["volta_core::run::parser::GlobalCommand"]],["impl<'a> UnwindSafe for InstallArgs<'a>",1,["volta_core::run::parser::InstallArgs"]],["impl<'a> UnwindSafe for UninstallArgs<'a>",1,["volta_core::run::parser::UninstallArgs"]],["impl<'a> UnwindSafe for UpgradeArgs<'a>",1,["volta_core::run::parser::UpgradeArgs"]],["impl<'a> UnwindSafe for InterceptedCommand<'a>",1,["volta_core::run::parser::InterceptedCommand"]],["impl<'a> UnwindSafe for LinkArgs<'a>",1,["volta_core::run::parser::LinkArgs"]],["impl UnwindSafe for ActivityKind",1,["volta_core::session::ActivityKind"]],["impl UnwindSafe for Session",1,["volta_core::session::Session"]],["impl UnwindSafe for ShimResult",1,["volta_core::shim::ShimResult"]],["impl UnwindSafe for LockState",1,["volta_core::sync::LockState"]],["impl UnwindSafe for VoltaLock",1,["volta_core::sync::VoltaLock"]],["impl UnwindSafe for Manifest",1,["volta_core::tool::node::fetch::Manifest"]],["impl UnwindSafe for NodeIndex",1,["volta_core::tool::node::metadata::NodeIndex"]],["impl UnwindSafe for NodeEntry",1,["volta_core::tool::node::metadata::NodeEntry"]],["impl UnwindSafe for RawNodeIndex",1,["volta_core::tool::node::metadata::RawNodeIndex"]],["impl UnwindSafe for RawNodeEntry",1,["volta_core::tool::node::metadata::RawNodeEntry"]],["impl UnwindSafe for NodeVersion",1,["volta_core::tool::node::NodeVersion"]],["impl UnwindSafe for Node",1,["volta_core::tool::node::Node"]],["impl UnwindSafe for Npm",1,["volta_core::tool::npm::Npm"]],["impl UnwindSafe for BundledNpm",1,["volta_core::tool::npm::BundledNpm"]],["impl UnwindSafe for PackageManager",1,["volta_core::tool::package::manager::PackageManager"]],["impl UnwindSafe for BinMapVisitor",1,["volta_core::tool::package::metadata::serde_bins::BinMapVisitor"]],["impl UnwindSafe for PackageConfig",1,["volta_core::tool::package::metadata::PackageConfig"]],["impl UnwindSafe for BinConfig",1,["volta_core::tool::package::metadata::BinConfig"]],["impl UnwindSafe for RawPlatformSpec",1,["volta_core::tool::package::metadata::RawPlatformSpec"]],["impl UnwindSafe for PackageManifest",1,["volta_core::tool::package::metadata::PackageManifest"]],["impl UnwindSafe for GlobalYarnManifest",1,["volta_core::tool::package::metadata::GlobalYarnManifest"]],["impl UnwindSafe for Package",1,["volta_core::tool::package::Package"]],["impl UnwindSafe for DirectInstall",1,["volta_core::tool::package::DirectInstall"]],["impl UnwindSafe for InPlaceUpgrade",1,["volta_core::tool::package::InPlaceUpgrade"]],["impl UnwindSafe for NeedsScope",1,["volta_core::tool::package::NeedsScope"]],["impl UnwindSafe for Pnpm",1,["volta_core::tool::pnpm::Pnpm"]],["impl UnwindSafe for PackageDetails",1,["volta_core::tool::registry::PackageDetails"]],["impl UnwindSafe for PackageIndex",1,["volta_core::tool::registry::PackageIndex"]],["impl UnwindSafe for RawPackageMetadata",1,["volta_core::tool::registry::RawPackageMetadata"]],["impl UnwindSafe for RawPackageVersionInfo",1,["volta_core::tool::registry::RawPackageVersionInfo"]],["impl UnwindSafe for RawDistInfo",1,["volta_core::tool::registry::RawDistInfo"]],["impl UnwindSafe for YarnIndex",1,["volta_core::tool::yarn::metadata::YarnIndex"]],["impl UnwindSafe for RawYarnIndex",1,["volta_core::tool::yarn::metadata::RawYarnIndex"]],["impl UnwindSafe for RawYarnEntry",1,["volta_core::tool::yarn::metadata::RawYarnEntry"]],["impl UnwindSafe for RawYarnAsset",1,["volta_core::tool::yarn::metadata::RawYarnAsset"]],["impl UnwindSafe for Yarn",1,["volta_core::tool::yarn::Yarn"]],["impl UnwindSafe for Spec",1,["volta_core::tool::Spec"]],["impl UnwindSafe for FetchStatus",1,["volta_core::tool::FetchStatus"]],["impl UnwindSafe for NodeVersion",1,["volta_core::toolchain::serial::NodeVersion"]],["impl UnwindSafe for Platform",1,["volta_core::toolchain::serial::Platform"]],["impl UnwindSafe for LazyToolchain",1,["volta_core::toolchain::LazyToolchain"]],["impl UnwindSafe for Toolchain",1,["volta_core::toolchain::Toolchain"]],["impl UnwindSafe for VersionVisitor",1,["volta_core::version::version_serde::VersionVisitor"]],["impl UnwindSafe for Wrapper",1,["volta_core::version::hashmap_version_serde::Wrapper"]],["impl UnwindSafe for VersionSpec",1,["volta_core::version::VersionSpec"]],["impl UnwindSafe for VersionTag",1,["volta_core::version::VersionTag"]]], +"volta_layout":[["impl UnwindSafe for VoltaInstall",1,["volta_layout::v0::VoltaInstall"]],["impl UnwindSafe for VoltaHome",1,["volta_layout::v0::VoltaHome"]],["impl UnwindSafe for VoltaInstall",1,["volta_layout::v1::VoltaInstall"]],["impl UnwindSafe for VoltaHome",1,["volta_layout::v1::VoltaHome"]],["impl UnwindSafe for VoltaHome",1,["volta_layout::v2::VoltaHome"]],["impl UnwindSafe for VoltaHome",1,["volta_layout::v3::VoltaHome"]],["impl UnwindSafe for VoltaHome",1,["volta_layout::v4::VoltaHome"]]], +"volta_layout_macro":[["impl UnwindSafe for Ast",1,["volta_layout_macro::ast::Ast"]],["impl UnwindSafe for LayoutStruct",1,["volta_layout_macro::ast::LayoutStruct"]],["impl UnwindSafe for Directory",1,["volta_layout_macro::ast::Directory"]],["impl UnwindSafe for EntryKind",1,["volta_layout_macro::ast::EntryKind"]],["impl UnwindSafe for FieldPrefix",1,["volta_layout_macro::ast::FieldPrefix"]],["impl UnwindSafe for FieldContents",1,["volta_layout_macro::ast::FieldContents"]],["impl UnwindSafe for Ir",1,["volta_layout_macro::ir::Ir"]],["impl UnwindSafe for Entry",1,["volta_layout_macro::ir::Entry"]]], +"volta_migrate":[["impl UnwindSafe for Empty",1,["volta_migrate::empty::Empty"]],["impl UnwindSafe for V0",1,["volta_migrate::v0::V0"]],["impl UnwindSafe for V1",1,["volta_migrate::v1::V1"]],["impl UnwindSafe for V2",1,["volta_migrate::v2::V2"]],["impl UnwindSafe for LegacyPackageConfig",1,["volta_migrate::v3::config::LegacyPackageConfig"]],["impl UnwindSafe for LegacyPlatform",1,["volta_migrate::v3::config::LegacyPlatform"]],["impl UnwindSafe for NodeVersion",1,["volta_migrate::v3::config::NodeVersion"]],["impl UnwindSafe for V3",1,["volta_migrate::v3::V3"]],["impl UnwindSafe for V4",1,["volta_migrate::v4::V4"]],["impl UnwindSafe for MigrationState",1,["volta_migrate::MigrationState"]]], +"volta_shim":[["impl !UnwindSafe for Error",1,["volta_shim::common::Error"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/core/str/traits/trait.FromStr.js b/main/trait.impl/core/str/traits/trait.FromStr.js new file mode 100644 index 000000000..5c0c9524e --- /dev/null +++ b/main/trait.impl/core/str/traits/trait.FromStr.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"volta":[["impl FromStr for Subcommand"]], +"volta_core":[["impl FromStr for VersionTag"],["impl FromStr for VersionSpec"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/hamcrest2/core/trait.Matcher.js b/main/trait.impl/hamcrest2/core/trait.Matcher.js new file mode 100644 index 000000000..9ac657898 --- /dev/null +++ b/main/trait.impl/hamcrest2/core/trait.Matcher.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"test_support":[["impl<'a> Matcher<&'a mut ProcessBuilder> for Execs"],["impl Matcher<ProcessBuilder> for Execs"],["impl Matcher<Output> for Execs"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/log/trait.Log.js b/main/trait.impl/log/trait.Log.js new file mode 100644 index 000000000..8aa8cf186 --- /dev/null +++ b/main/trait.impl/log/trait.Log.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[["impl Log for Logger"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/serde/de/trait.Deserialize.js b/main/trait.impl/serde/de/trait.Deserialize.js new file mode 100644 index 000000000..6400e4a91 --- /dev/null +++ b/main/trait.impl/serde/de/trait.Deserialize.js @@ -0,0 +1,4 @@ +(function() {var implementors = { +"volta_core":[["impl<'de> Deserialize<'de> for RawDistInfo"],["impl<'de> Deserialize<'de> for PackageConfig"],["impl<'de> Deserialize<'de> for RawIndexHook"],["impl<'de> Deserialize<'de> for RawYarnAsset"],["impl<'de> Deserialize<'de> for BinConfig"],["impl<'de> Deserialize<'de> for RawManifest"],["impl<'de> Deserialize<'de> for RawYarnIndex"],["impl<'de> Deserialize<'de> for RawEventHooks"],["impl<'de> Deserialize<'de> for GlobalYarnManifest"],["impl<'de, T: Tool> Deserialize<'de> for RawToolHooks<T>"],["impl<'de> Deserialize<'de> for NodeVersion"],["impl<'de> Deserialize<'de> for Wrapper"],["impl<'de> Deserialize<'de> for Event"],["impl<'de> Deserialize<'de> for ErrorEnv"],["impl<'de> Deserialize<'de> for RawPackageVersionInfo"],["impl<'de> Deserialize<'de> for RawHookConfig"],["impl<'de> Deserialize<'de> for RawPublishHook"],["impl<'de> Deserialize<'de> for RawNodeEntry"],["impl<'de> Deserialize<'de> for RawResolveHook"],["impl<'de> Deserialize<'de> for RawNodeIndex"],["impl<'de> Deserialize<'de> for ToolchainSpec"],["impl<'de> Deserialize<'de> for EventKind"],["impl<'de> Deserialize<'de> for PackageManifest"],["impl<'de> Deserialize<'de> for RawPackageMetadata"],["impl<'de> Deserialize<'de> for Manifest"],["impl<'de> Deserialize<'de> for RawYarnEntry"],["impl<'de> Deserialize<'de> for Platform"],["impl<'de> Deserialize<'de> for RawYarnHooks"],["impl<'de> Deserialize<'de> for PackageManager"]], +"volta_migrate":[["impl<'de> Deserialize<'de> for LegacyPlatform"],["impl<'de> Deserialize<'de> for NodeVersion"],["impl<'de> Deserialize<'de> for LegacyPackageConfig"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/serde/de/trait.Visitor.js b/main/trait.impl/serde/de/trait.Visitor.js new file mode 100644 index 000000000..6e3abf597 --- /dev/null +++ b/main/trait.impl/serde/de/trait.Visitor.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[["impl Visitor<'_> for VersionVisitor"],["impl<'de> Visitor<'de> for BinMapVisitor"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/serde/ser/trait.Serialize.js b/main/trait.impl/serde/ser/trait.Serialize.js new file mode 100644 index 000000000..e96a374ff --- /dev/null +++ b/main/trait.impl/serde/ser/trait.Serialize.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[["impl Serialize for PackageConfig"],["impl<T: Tool> Serialize for RawToolHooks<T>"],["impl Serialize for ErrorEnv"],["impl Serialize for PackageManager"],["impl Serialize for BinConfig"],["impl Serialize for RawIndexHook"],["impl Serialize for RawHookConfig"],["impl Serialize for Event"],["impl Serialize for EventKind"],["impl Serialize for NodeVersion"],["impl Serialize for ToolchainSpec"],["impl Serialize for RawPublishHook"],["impl Serialize for Platform"],["impl Serialize for RawYarnHooks"],["impl Serialize for RawResolveHook"],["impl Serialize for RawEventHooks"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/std/io/trait.Read.js b/main/trait.impl/std/io/trait.Read.js new file mode 100644 index 000000000..768cc6280 --- /dev/null +++ b/main/trait.impl/std/io/trait.Read.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"progress_read":[["impl<R: Read, T, F: FnMut(&T, usize) -> T> Read for ProgressRead<R, T, F>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/std/io/trait.Seek.js b/main/trait.impl/std/io/trait.Seek.js new file mode 100644 index 000000000..c54503eb4 --- /dev/null +++ b/main/trait.impl/std/io/trait.Seek.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"progress_read":[["impl<R: Read + Seek, T, F: FnMut(&T, usize) -> T> Seek for ProgressRead<R, T, F>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/syn/parse/trait.Parse.js b/main/trait.impl/syn/parse/trait.Parse.js new file mode 100644 index 000000000..e46036d82 --- /dev/null +++ b/main/trait.impl/syn/parse/trait.Parse.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_layout_macro":[["impl Parse for LayoutStruct"],["impl Parse for Directory"],["impl Parse for Ast"],["impl Parse for FieldPrefix"],["impl Parse for FieldContents"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/test_support/paths/trait.PathExt.js b/main/trait.impl/test_support/paths/trait.PathExt.js new file mode 100644 index 000000000..726b4d4d1 --- /dev/null +++ b/main/trait.impl/test_support/paths/trait.PathExt.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"test_support":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/volta/command/trait.Command.js b/main/trait.impl/volta/command/trait.Command.js new file mode 100644 index 000000000..311e261d2 --- /dev/null +++ b/main/trait.impl/volta/command/trait.Command.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/volta/common/trait.IntoResult.js b/main/trait.impl/volta/common/trait.IntoResult.js new file mode 100644 index 000000000..311e261d2 --- /dev/null +++ b/main/trait.impl/volta/common/trait.IntoResult.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/volta_core/error/trait.Context.js b/main/trait.impl/volta_core/error/trait.Context.js new file mode 100644 index 000000000..efec2eb2a --- /dev/null +++ b/main/trait.impl/volta_core/error/trait.Context.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/volta_core/tool/trait.Tool.js b/main/trait.impl/volta_core/tool/trait.Tool.js new file mode 100644 index 000000000..efec2eb2a --- /dev/null +++ b/main/trait.impl/volta_core/tool/trait.Tool.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_core":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/trait.impl/volta_shim/common/trait.IntoResult.js b/main/trait.impl/volta_shim/common/trait.IntoResult.js new file mode 100644 index 000000000..6ebcb6d11 --- /dev/null +++ b/main/trait.impl/volta_shim/common/trait.IntoResult.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"volta_shim":[] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/main/type.impl/core/iter/adapters/chain/struct.Chain.js b/main/type.impl/core/iter/adapters/chain/struct.Chain.js new file mode 100644 index 000000000..486c09d6f --- /dev/null +++ b/main/type.impl/core/iter/adapters/chain/struct.Chain.js @@ -0,0 +1,3 @@ +(function() {var type_impls = { +"volta_core":[["
1.0.0 · source§

impl<A, B> Iterator for Chain<A, B>where\n A: Iterator,\n B: Iterator<Item = <A as Iterator>::Item>,

§

type Item = <A as Iterator>::Item

The type of the elements being iterated over.
source§

fn next(&mut self) -> Option<<A as Iterator>::Item>

Advances the iterator and returns the next value. Read more
source§

fn count(self) -> usize

Consumes the iterator, counting the number of iterations and returning it. Read more
source§

fn try_fold<Acc, F, R>(&mut self, acc: Acc, f: F) -> Rwhere\n Chain<A, B>: Sized,\n F: FnMut(Acc, <Chain<A, B> as Iterator>::Item) -> R,\n R: Try<Output = Acc>,

An iterator method that applies a function as long as it returns\nsuccessfully, producing a single, final value. Read more
source§

fn fold<Acc, F>(self, acc: Acc, f: F) -> Accwhere\n F: FnMut(Acc, <Chain<A, B> as Iterator>::Item) -> Acc,

Folds every element into an accumulator by applying an operation,\nreturning the final result. Read more
source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
source§

fn nth(&mut self, n: usize) -> Option<<Chain<A, B> as Iterator>::Item>

Returns the nth element of the iterator. Read more
source§

fn find<P>(&mut self, predicate: P) -> Option<<Chain<A, B> as Iterator>::Item>where\n P: FnMut(&<Chain<A, B> as Iterator>::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
source§

fn last(self) -> Option<<A as Iterator>::Item>

Consumes the iterator, returning the last element. Read more
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
source§

fn next_chunk<const N: usize>(\n &mut self\n) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.28.0 · source§

fn step_by(self, step: usize) -> StepBy<Self>where\n Self: Sized,

Creates an iterator starting at the same point, but stepping by\nthe given amount at each iteration. Read more
1.0.0 · source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter> where\n Self: Sized,\n U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n Self: Sized,\n U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>where\n Self: Sized,\n G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator\nbetween adjacent items of the original iterator. Read more
1.0.0 · source§

fn map<B, F>(self, f: F) -> Map<Self, F>where\n Self: Sized,\n F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each\nelement. Read more
1.21.0 · source§

fn for_each<F>(self, f: F)where\n Self: Sized,\n F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element\nshould be yielded. Read more
1.0.0 · source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · source§

fn enumerate(self) -> Enumerate<Self>where\n Self: Sized,

Creates an iterator which gives the current iteration count as well as\nthe next value. Read more
1.0.0 · source§

fn peekable(self) -> Peekable<Self>where\n Self: Sized,

Creates an iterator which can use the peek and peek_mut methods\nto look at the next element of the iterator without consuming it. See\ntheir documentation for more information. Read more
1.0.0 · source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>where\n Self: Sized,\n P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · source§

fn skip(self, n: usize) -> Skip<Self>where\n Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · source§

fn take(self, n: usize) -> Take<Self>where\n Self: Sized,

Creates an iterator that yields the first n elements, or fewer\nif the underlying iterator ends sooner. Read more
1.0.0 · source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where\n Self: Sized,\n F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but\nunlike fold, produces a new iterator. Read more
1.0.0 · source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where\n Self: Sized,\n U: IntoIterator,\n F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>where\n Self: Sized,\n F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over\nself and returns an iterator over the outputs of f. Like slice::windows(),\nthe windows during mapping overlap as well. Read more
1.0.0 · source§

fn fuse(self) -> Fuse<Self>where\n Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>where\n Self: Sized,\n F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere\n Self: Sized,

Borrows an iterator, rather than consuming it. Read more
1.0.0 · source§

fn collect<B>(self) -> Bwhere\n B: FromIterator<Self::Item>,\n Self: Sized,

Transforms an iterator into a collection. Read more
source§

fn collect_into<E>(self, collection: &mut E) -> &mut Ewhere\n E: Extend<Self::Item>,\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · source§

fn partition<B, F>(self, f: F) -> (B, B)where\n Self: Sized,\n B: Default + Extend<Self::Item>,\n F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
source§

fn is_partitioned<P>(self, predicate: P) -> boolwhere\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate,\nsuch that all those that return true precede all those that return false. Read more
1.27.0 · source§

fn try_for_each<F, R>(&mut self, f: F) -> Rwhere\n Self: Sized,\n F: FnMut(Self::Item) -> R,\n R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the\niterator, stopping at the first error and returning that error. Read more
1.51.0 · source§

fn reduce<F>(self, f: F) -> Option<Self::Item>where\n Self: Sized,\n F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing\noperation. Read more
source§

fn try_reduce<F, R>(\n &mut self,\n f: F\n) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryTypewhere\n Self: Sized,\n F: FnMut(Self::Item, Self::Item) -> R,\n R: Try<Output = Self::Item>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the\nclosure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · source§

fn all<F>(&mut self, f: F) -> boolwhere\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · source§

fn any<F>(&mut self, f: F) -> boolwhere\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.30.0 · source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns\nthe first non-none result. Read more
source§

fn try_find<F, R>(\n &mut self,\n f: F\n) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere\n Self: Sized,\n F: FnMut(&Self::Item) -> R,\n R: Try<Output = bool>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns\nthe first true result or the first error. Read more
1.0.0 · source§

fn position<P>(&mut self, predicate: P) -> Option<usize>where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.6.0 · source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the\nspecified function. Read more
1.15.0 · source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the\nspecified comparison function. Read more
1.6.0 · source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the\nspecified function. Read more
1.15.0 · source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the\nspecified comparison function. Read more
1.0.0 · source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where\n FromA: Default + Extend<A>,\n FromB: Default + Extend<B>,\n Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · source§

fn copied<'a, T>(self) -> Copied<Self>where\n T: 'a + Copy,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · source§

fn cloned<'a, T>(self) -> Cloned<Self>where\n T: 'a + Clone,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · source§

fn sum<S>(self) -> Swhere\n Self: Sized,\n S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · source§

fn product<P>(self) -> Pwhere\n Self: Sized,\n P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Lexicographically compares the PartialOrd elements of\nthis Iterator with those of another. The comparison works like short-circuit\nevaluation, returning a result without comparing the remaining elements.\nAs soon as an order can be determined, the evaluation stops and a result is returned. Read more
source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · source§

fn eq<I>(self, other: I) -> boolwhere\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are equal to those of\nanother. Read more
source§

fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of\nanother with respect to the specified equality function. Read more
1.5.0 · source§

fn ne<I>(self, other: I) -> boolwhere\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are not equal to those of\nanother. Read more
1.5.0 · source§

fn lt<I>(self, other: I) -> boolwhere\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless than those of another. Read more
1.5.0 · source§

fn le<I>(self, other: I) -> boolwhere\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless or equal to those of another. Read more
1.5.0 · source§

fn gt<I>(self, other: I) -> boolwhere\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than those of another. Read more
1.5.0 · source§

fn ge<I>(self, other: I) -> boolwhere\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than or equal to those of another. Read more
source§

fn is_sorted_by<F>(self, compare: F) -> boolwhere\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given comparator function. Read more
source§

fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere\n Self: Sized,\n F: FnMut(Self::Item) -> K,\n K: PartialOrd,

🔬This is a nightly-only experimental API. (is_sorted)
Checks if the elements of this iterator are sorted using the given key extraction\nfunction. Read more
","Iterator","volta_core::project::serial::DependencyMapIterator"],["
source§

impl<A, B> TrustedLen for Chain<A, B>where\n A: TrustedLen,\n B: TrustedLen<Item = <A as Iterator>::Item>,

","TrustedLen","volta_core::project::serial::DependencyMapIterator"],["
1.0.0 · source§

impl<A, B> Clone for Chain<A, B>where\n A: Clone,\n B: Clone,

source§

fn clone(&self) -> Chain<A, B>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
","Clone","volta_core::project::serial::DependencyMapIterator"],["
1.26.0 · source§

impl<A, B> FusedIterator for Chain<A, B>where\n A: FusedIterator,\n B: FusedIterator<Item = <A as Iterator>::Item>,

","FusedIterator","volta_core::project::serial::DependencyMapIterator"],["
1.0.0 · source§

impl<A, B> DoubleEndedIterator for Chain<A, B>where\n A: DoubleEndedIterator,\n B: DoubleEndedIterator<Item = <A as Iterator>::Item>,

source§

fn next_back(&mut self) -> Option<<A as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
source§

fn nth_back(&mut self, n: usize) -> Option<<Chain<A, B> as Iterator>::Item>

Returns the nth element from the end of the iterator. Read more
source§

fn rfind<P>(&mut self, predicate: P) -> Option<<Chain<A, B> as Iterator>::Item>where\n P: FnMut(&<Chain<A, B> as Iterator>::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
source§

fn try_rfold<Acc, F, R>(&mut self, acc: Acc, f: F) -> Rwhere\n Chain<A, B>: Sized,\n F: FnMut(Acc, <Chain<A, B> as Iterator>::Item) -> R,\n R: Try<Output = Acc>,

This is the reverse version of Iterator::try_fold(): it takes\nelements starting from the back of the iterator. Read more
source§

fn rfold<Acc, F>(self, acc: Acc, f: F) -> Accwhere\n F: FnMut(Acc, <Chain<A, B> as Iterator>::Item) -> Acc,

An iterator method that reduces the iterator’s elements to a single,\nfinal value, starting from the back. Read more
","DoubleEndedIterator","volta_core::project::serial::DependencyMapIterator"],["
1.0.0 · source§

impl<A, B> Debug for Chain<A, B>where\n A: Debug,\n B: Debug,

source§

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

Formats the value using the given formatter. Read more
","Debug","volta_core::project::serial::DependencyMapIterator"],["
1.70.0 · source§

impl<A, B> Default for Chain<A, B>where\n A: Default,\n B: Default,

source§

fn default() -> Chain<A, B>

Creates a Chain from the default values for A and B.

\n\n
struct Foo<'a>(Chain<slice::Iter<'a, u8>, btree_set::Iter<'a, u8>>);\n\nlet set = BTreeSet::<u8>::new();\nlet slice: &[u8] = &[];\nlet mut foo = Foo(slice.iter().chain(set.iter()));\n\n// take requires `Default`\nlet _: Chain<_, _> = mem::take(&mut foo.0);
\n
","Default","volta_core::project::serial::DependencyMapIterator"]] +};if (window.register_type_impls) {window.register_type_impls(type_impls);} else {window.pending_type_impls = type_impls;}})() \ No newline at end of file diff --git a/main/type.impl/core/result/enum.Result.js b/main/type.impl/core/result/enum.Result.js new file mode 100644 index 000000000..3b0b456b4 --- /dev/null +++ b/main/type.impl/core/result/enum.Result.js @@ -0,0 +1,4 @@ +(function() {var type_impls = { +"volta_core":[["
source§

impl<T, E> Result<T, E>

1.0.0 (const: 1.48.0) · source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

\n
Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_ok(), true);\n\nlet x: Result<i32, &str> = Err("Some error message");\nassert_eq!(x.is_ok(), false);
\n
1.70.0 · source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if the result is Ok and the value inside of it matches a predicate.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err("hey");\nassert_eq!(x.is_ok_and(|x| x > 1), false);
\n
1.0.0 (const: 1.48.0) · source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

\n
Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_err(), false);\n\nlet x: Result<i32, &str> = Err("Some error message");\nassert_eq!(x.is_err(), true);
\n
1.70.0 · source

pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool

Returns true if the result is Err and the value inside of it matches a predicate.

\n
Examples
\n
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
\n
1.0.0 · source

pub fn ok(self) -> Option<T>

Converts from Result<T, E> to Option<T>.

\n

Converts self into an Option<T>, consuming self,\nand discarding the error, if any.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.ok(), Some(2));\n\nlet x: Result<u32, &str> = Err("Nothing here");\nassert_eq!(x.ok(), None);
\n
1.0.0 · source

pub fn err(self) -> Option<E>

Converts from Result<T, E> to Option<E>.

\n

Converts self into an Option<E>, consuming self,\nand discarding the success value, if any.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err("Nothing here");\nassert_eq!(x.err(), Some("Nothing here"));
\n
1.0.0 (const: 1.48.0) · source

pub const fn as_ref(&self) -> Result<&T, &E>

Converts from &Result<T, E> to Result<&T, &E>.

\n

Produces a new Result, containing a reference\ninto the original, leaving the original in place.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err("Error");\nassert_eq!(x.as_ref(), Err(&"Error"));
\n
1.0.0 (const: unstable) · source

pub fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut Result<T, E> to Result<&mut T, &mut E>.

\n
Examples
\n
fn mutate(r: &mut Result<i32, i32>) {\n    match r.as_mut() {\n        Ok(v) => *v = 42,\n        Err(e) => *e = 0,\n    }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
\n
1.0.0 · source

pub fn map<U, F>(self, op: F) -> Result<U, E>where\n F: FnOnce(T) -> U,

Maps a Result<T, E> to Result<U, E> by applying a function to a\ncontained Ok value, leaving an Err value untouched.

\n

This function can be used to compose the results of two functions.

\n
Examples
\n

Print the numbers on each line of a string multiplied by two.

\n\n
let line = "1\\n2\\n3\\n4\\n";\n\nfor num in line.lines() {\n    match num.parse::<i32>().map(|i| i * 2) {\n        Ok(n) => println!("{n}"),\n        Err(..) => {}\n    }\n}
\n
1.41.0 · source

pub fn map_or<U, F>(self, default: U, f: F) -> Uwhere\n F: FnOnce(T) -> U,

Returns the provided default (if Err), or\napplies a function to the contained value (if Ok).

\n

Arguments passed to map_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else,\nwhich is lazily evaluated.

\n
Examples
\n
let x: Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err("bar");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
\n
1.41.0 · source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> Uwhere\n D: FnOnce(E) -> U,\n F: FnOnce(T) -> U,

Maps a Result<T, E> to U by applying fallback function default to\na contained Err value, or function f to a contained Ok value.

\n

This function can be used to unpack a successful result\nwhile handling an error.

\n
Examples
\n
let k = 21;\n\nlet x : Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err("bar");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
\n
1.0.0 · source

pub fn map_err<F, O>(self, op: O) -> Result<T, F>where\n O: FnOnce(E) -> F,

Maps a Result<T, E> to Result<T, F> by applying a function to a\ncontained Err value, leaving an Ok value untouched.

\n

This function can be used to pass through a successful result while handling\nan error.

\n
Examples
\n
fn stringify(x: u32) -> String { format!("error code: {x}") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
\n
source

pub fn inspect<F>(self, f: F) -> Result<T, E>where\n F: FnOnce(&T),

🔬This is a nightly-only experimental API. (result_option_inspect)

Calls the provided closure with a reference to the contained value (if Ok).

\n
Examples
\n
#![feature(result_option_inspect)]\n\nlet x: u8 = "4"\n    .parse::<u8>()\n    .inspect(|x| println!("original: {x}"))\n    .map(|x| x.pow(3))\n    .expect("failed to parse number");
\n
source

pub fn inspect_err<F>(self, f: F) -> Result<T, E>where\n F: FnOnce(&E),

🔬This is a nightly-only experimental API. (result_option_inspect)

Calls the provided closure with a reference to the contained error (if Err).

\n
Examples
\n
#![feature(result_option_inspect)]\n\nuse std::{fs, io};\n\nfn read() -> io::Result<String> {\n    fs::read_to_string("address.txt")\n        .inspect_err(|e| eprintln!("failed to read file: {e}"))\n}
\n
1.47.0 · source

pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>where\n T: Deref,

Converts from Result<T, E> (or &Result<T, E>) to Result<&<T as Deref>::Target, &E>.

\n

Coerces the Ok variant of the original Result via Deref\nand returns the new Result.

\n
Examples
\n
let x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&str, &u32> = Ok("hello");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
\n
1.47.0 · source

pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>where\n T: DerefMut,

Converts from Result<T, E> (or &mut Result<T, E>) to Result<&mut <T as DerefMut>::Target, &mut E>.

\n

Coerces the Ok variant of the original Result via DerefMut\nand returns the new Result.

\n
Examples
\n
let mut s = "HELLO".to_string();\nlet mut x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
\n
1.0.0 · source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
Examples
\n
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter().next(), None);
\n
1.0.0 · source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
Examples
\n
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n    Some(v) => *v = 40,\n    None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter_mut().next(), None);
\n
1.4.0 · source

pub fn expect(self, msg: &str) -> Twhere\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
Panics
\n

Panics if the value is an Err, with a panic message including the\npassed message, and the content of the Err.

\n
Examples
\n
let x: Result<u32, &str> = Err("emergency failure");\nx.expect("Testing expect"); // panics with `Testing expect: emergency failure`
\n
Recommended Message Style
\n

We recommend that expect messages are used to describe the reason you\nexpect the Result should be Ok.

\n\n
let path = std::env::var("IMPORTANT_PATH")\n    .expect("env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`");
\n

Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.

\n

For more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error module docs.

\n
1.0.0 · source

pub fn unwrap(self) -> Twhere\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
Panics
\n

Panics if the value is an Err, with a panic message provided by the\nErr’s value.

\n
Examples
\n

Basic usage:

\n\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nx.unwrap(); // panics with `emergency failure`
\n
1.16.0 · source

pub fn unwrap_or_default(self) -> Twhere\n T: Default,

Returns the contained Ok value or a default

\n

Consumes the self argument then, if Ok, returns the contained\nvalue, otherwise if Err, returns the default value for that\ntype.

\n
Examples
\n

Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse converts\na string to any other type that implements FromStr, returning an\nErr on error.

\n\n
let good_year_from_input = "1909";\nlet bad_year_from_input = "190blarg";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
\n
1.17.0 · source

pub fn expect_err(self, msg: &str) -> Ewhere\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
Panics
\n

Panics if the value is an Ok, with a panic message including the\npassed message, and the content of the Ok.

\n
Examples
\n
let x: Result<u32, &str> = Ok(10);\nx.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
\n
1.0.0 · source

pub fn unwrap_err(self) -> Ewhere\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
Panics
\n

Panics if the value is an Ok, with a custom panic message provided\nby the Ok’s value.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(x.unwrap_err(), "emergency failure");
\n
source

pub fn into_ok(self) -> Twhere\n E: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Ok value, but never panics.

\n

Unlike unwrap, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap as a maintainability safeguard that will fail\nto compile if the error type of the Result is later changed\nto an error that can actually occur.

\n
Examples
\n
\nfn only_good_news() -> Result<String, !> {\n    Ok("this is fine".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!("{s}");
\n
source

pub fn into_err(self) -> Ewhere\n T: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Err value, but never panics.

\n

Unlike unwrap_err, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err as a maintainability safeguard that will fail\nto compile if the ok type of the Result is later changed\nto a type that can actually occur.

\n
Examples
\n
\nfn only_bad_news() -> Result<!, String> {\n    Err("Oops, it failed".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!("{error}");
\n
1.0.0 · source

pub fn and<U>(self, res: Result<U, E>) -> Result<U, E>

Returns res if the result is Ok, otherwise returns the Err value of self.

\n

Arguments passed to and are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then, which is\nlazily evaluated.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("late error"));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<&str, &str> = Ok("foo");\nassert_eq!(x.and(y), Err("early error"));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("not a 2"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok("different result type");\nassert_eq!(x.and(y), Ok("different result type"));
\n
1.0.0 · source

pub fn and_then<U, F>(self, op: F) -> Result<U, E>where\n F: FnOnce(T) -> Result<U, E>,

Calls op if the result is Ok, otherwise returns the Err value of self.

\n

This function can be used for control flow based on Result values.

\n
Examples
\n
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n    x.checked_mul(x).map(|sq| sq.to_string()).ok_or("overflowed")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err("overflowed"));\nassert_eq!(Err("not a number").and_then(sq_then_to_string), Err("not a number"));
\n

Often used to chain fallible operations that may return Err.

\n\n
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows "/" maps to "C:\\"\nlet root_modified_time = Path::new("/").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new("/bad/path").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
\n
1.0.0 · source

pub fn or<F>(self, res: Result<T, F>) -> Result<T, F>

Returns res if the result is Err, otherwise returns the Ok value of self.

\n

Arguments passed to or are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else, which is\nlazily evaluated.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Err("late error"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
\n
1.0.0 · source

pub fn or_else<F, O>(self, op: O) -> Result<T, F>where\n O: FnOnce(E) -> Result<T, F>,

Calls op if the result is Err, otherwise returns the Ok value of self.

\n

This function can be used for control flow based on result values.

\n
Examples
\n
fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
\n
1.0.0 · source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

\n

Arguments passed to unwrap_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else,\nwhich is lazily evaluated.

\n
Examples
\n
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err("error");\nassert_eq!(x.unwrap_or(default), default);
\n
1.0.0 · source

pub fn unwrap_or_else<F>(self, op: F) -> Twhere\n F: FnOnce(E) -> T,

Returns the contained Ok value or computes it from a closure.

\n
Examples
\n
fn count(x: &str) -> usize { x.len() }\n\nassert_eq!(Ok(2).unwrap_or_else(count), 2);\nassert_eq!(Err("foo").unwrap_or_else(count), 3);
\n
1.58.0 · source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value,\nwithout checking that the value is not an Err.

\n
Safety
\n

Calling this method on an Err is undefined behavior.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
\n
1.58.0 · source

pub unsafe fn unwrap_err_unchecked(self) -> E

Returns the contained Err value, consuming the self value,\nwithout checking that the value is not an Ok.

\n
Safety
\n

Calling this method on an Ok is undefined behavior.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, "emergency failure");
\n
",0,"volta_core::error::Fallible"],["
source§

impl<T, E> Result<&T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>where\n T: Copy,

Maps a Result<&T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>where\n T: Clone,

Maps a Result<&T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"volta_core::error::Fallible"],["
source§

impl<T, E> Result<&mut T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>where\n T: Copy,

Maps a Result<&mut T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>where\n T: Clone,

Maps a Result<&mut T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"volta_core::error::Fallible"],["
source§

impl<T, E> Result<Option<T>, E>

1.33.0 (const: unstable) · source

pub fn transpose(self) -> Option<Result<T, E>>

Transposes a Result of an Option into an Option of a Result.

\n

Ok(None) will be mapped to None.\nOk(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).

\n
Examples
\n
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
\n
",0,"volta_core::error::Fallible"],["
source§

impl<T, E> Result<Result<T, E>, E>

source

pub fn flatten(self) -> Result<T, E>

🔬This is a nightly-only experimental API. (result_flattening)

Converts from Result<Result<T, E>, E> to Result<T, E>

\n
Examples
\n
#![feature(result_flattening)]\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));\nassert_eq!(Ok("hello"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
\n

Flattening only removes one level of nesting at a time:

\n\n
#![feature(result_flattening)]\nlet x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok("hello")));\nassert_eq!(Ok(Ok("hello")), x.flatten());\nassert_eq!(Ok("hello"), x.flatten().flatten());
\n
",0,"volta_core::error::Fallible"],["
1.61.0 · source§

impl<T, E> Termination for Result<T, E>where\n T: Termination,\n E: Debug,

source§

fn report(self) -> ExitCode

Is called to get the representation of the value as status code.\nThis status code is returned to the operating system.
","Termination","volta_core::error::Fallible"],["
source§

impl<T, E, F> FromResidual<Yeet<E>> for Result<T, F>where\n F: From<E>,

source§

fn from_residual(_: Yeet<E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","volta_core::error::Fallible"],["
source§

impl<T, E, F> FromResidual<Result<Infallible, E>> for Result<T, F>where\n F: From<E>,

source§

fn from_residual(residual: Result<Infallible, E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","volta_core::error::Fallible"],["
source§

impl<T, E> Try for Result<T, E>

§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = Result<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual\nas part of ? when short-circuiting. Read more
source§

fn from_output(output: <Result<T, E> as Try>::Output) -> Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch(\n self\n) -> ControlFlow<<Result<T, E> as Try>::Residual, <Result<T, E> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break). Read more
","Try","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> StructuralEq for Result<T, E>

","StructuralEq","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> Eq for Result<T, E>where\n T: Eq,\n E: Eq,

","Eq","volta_core::error::Fallible"],["
1.0.0 · source§

impl<A, E, V> FromIterator<Result<A, E>> for Result<V, E>where\n V: FromIterator<A>,

source§

fn from_iter<I>(iter: I) -> Result<V, E>where\n I: IntoIterator<Item = Result<A, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err occur, a\ncontainer with the values of each Result is returned.

\n

Here is an example which increments every integer in a vector,\nchecking for overflow:

\n\n
let v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_add(1).ok_or("Overflow!")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
\n

Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:

\n\n
let v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_sub(1).ok_or("Underflow!")\n).collect();\nassert_eq!(res, Err("Underflow!"));
\n

Here is a variation on the previous example, showing that no\nfurther elements are taken from iter after the first Err.

\n\n
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n    shared += x;\n    x.checked_sub(2).ok_or("Underflow!")\n}).collect();\nassert_eq!(res, Err("Underflow!"));\nassert_eq!(shared, 6);
\n

Since the third element caused an underflow, no further elements were taken,\nso the final value of shared is 6 (= 3 + 2 + 1), not 16.

\n
","FromIterator>","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> Ord for Result<T, E>where\n T: Ord,\n E: Ord,

source§

fn cmp(&self, other: &Result<T, E>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere\n Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
","Ord","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> PartialEq for Result<T, E>where\n T: PartialEq,\n E: PartialEq,

source§

fn eq(&self, other: &Result<T, E>) -> bool

This method tests for self and other values to be equal, and is used\nby ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always\nsufficient, and should not be overridden without very good reason.
","PartialEq","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> Clone for Result<T, E>where\n T: Clone,\n E: Clone,

source§

fn clone(&self) -> Result<T, E>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Result<T, E>)

Performs copy-assignment from source. Read more
","Clone","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> Hash for Result<T, E>where\n T: Hash,\n E: Hash,

source§

fn hash<__H>(&self, state: &mut __H)where\n __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> IntoIterator for Result<T, E>

source§

fn into_iter(self) -> IntoIter<T>

Returns a consuming iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
Examples
\n
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err("nothing!");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
\n
§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
","IntoIterator","volta_core::error::Fallible"],["
source§

impl<T, E> Residual<T> for Result<Infallible, E>

§

type TryType = Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
","Residual","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> StructuralPartialEq for Result<T, E>

","StructuralPartialEq","volta_core::error::Fallible"],["
1.16.0 · source§

impl<T, U, E> Sum<Result<U, E>> for Result<T, E>where\n T: Sum<U>,

source§

fn sum<I>(iter: I) -> Result<T, E>where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the sum of all elements is returned.

\n
Examples
\n

This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:

\n\n
let f = |&x: &i32| if x < 0 { Err("Negative element found") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err("Negative element found"));
\n
","Sum>","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> Debug for Result<T, E>where\n T: Debug,\n E: Debug,

source§

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

Formats the value using the given formatter. Read more
","Debug","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> PartialOrd for Result<T, E>where\n T: PartialOrd,\n E: PartialOrd,

source§

fn partial_cmp(&self, other: &Result<T, E>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <=\noperator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >=\noperator. Read more
","PartialOrd","volta_core::error::Fallible"],["
1.0.0 · source§

impl<T, E> Copy for Result<T, E>where\n T: Copy,\n E: Copy,

","Copy","volta_core::error::Fallible"],["
1.16.0 · source§

impl<T, U, E> Product<Result<U, E>> for Result<T, E>where\n T: Product<U>,

source§

fn product<I>(iter: I) -> Result<T, E>where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the product of all elements is returned.

\n
Examples
\n

This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err:

\n\n
let nums = vec!["5", "10", "1", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec!["5", "10", "one", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
\n
","Product>","volta_core::error::Fallible"],["
source§

impl<'de, T, E> Deserialize<'de> for Result<T, E>where\n T: Deserialize<'de>,\n E: Deserialize<'de>,

source§

fn deserialize<D>(\n deserializer: D\n) -> Result<Result<T, E>, <D as Deserializer<'de>>::Error>where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","volta_core::error::Fallible"],["
source§

impl<T, E> Serialize for Result<T, E>where\n T: Serialize,\n E: Serialize,

source§

fn serialize<S>(\n &self,\n serializer: S\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","volta_core::error::Fallible"],["
§

impl<T, E> WrapErr<T, E> for Result<T, E>where\n E: Diag + Send + Sync + 'static,

§

fn wrap_err<D>(self, msg: D) -> Result<T, Report>where\n D: Display + Send + Sync + 'static,

Wrap the error value with a new adhoc error
§

fn wrap_err_with<D, F>(self, msg: F) -> Result<T, Report>where\n D: Display + Send + Sync + 'static,\n F: FnOnce() -> D,

Wrap the error value with a new adhoc error that is evaluated lazily\nonly once an error does occur.
§

fn context<D>(self, msg: D) -> Result<T, Report>where\n D: Display + Send + Sync + 'static,

Compatibility re-export of wrap_err() for interop with anyhow
§

fn with_context<D, F>(self, msg: F) -> Result<T, Report>where\n D: Display + Send + Sync + 'static,\n F: FnOnce() -> D,

Compatibility re-export of wrap_err_with() for interop with anyhow
","WrapErr","volta_core::error::Fallible"],["
§

impl<T, E> IntoDiagnostic<T, E> for Result<T, E>where\n E: Error + Send + Sync + 'static,

§

fn into_diagnostic(self) -> Result<T, Report>

Converts Result types that return regular std::error::Errors\ninto a Result that returns a [Diagnostic].
","IntoDiagnostic","volta_core::error::Fallible"],["
source§

impl<T, E> Context<T> for Result<T, E>where\n E: Error + 'static,

source§

fn with_context<F>(self, f: F) -> Fallible<T>where\n F: FnOnce() -> ErrorKind,

","Context","volta_core::error::Fallible"]], +"volta_layout_macro":[["
source§

impl<T, E> Result<T, E>

1.0.0 (const: 1.48.0) · source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

\n
Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_ok(), true);\n\nlet x: Result<i32, &str> = Err("Some error message");\nassert_eq!(x.is_ok(), false);
\n
1.70.0 · source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if the result is Ok and the value inside of it matches a predicate.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err("hey");\nassert_eq!(x.is_ok_and(|x| x > 1), false);
\n
1.0.0 (const: 1.48.0) · source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

\n
Examples
\n
let x: Result<i32, &str> = Ok(-3);\nassert_eq!(x.is_err(), false);\n\nlet x: Result<i32, &str> = Err("Some error message");\nassert_eq!(x.is_err(), true);
\n
1.70.0 · source

pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool

Returns true if the result is Err and the value inside of it matches a predicate.

\n
Examples
\n
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
\n
1.0.0 · source

pub fn ok(self) -> Option<T>

Converts from Result<T, E> to Option<T>.

\n

Converts self into an Option<T>, consuming self,\nand discarding the error, if any.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.ok(), Some(2));\n\nlet x: Result<u32, &str> = Err("Nothing here");\nassert_eq!(x.ok(), None);
\n
1.0.0 · source

pub fn err(self) -> Option<E>

Converts from Result<T, E> to Option<E>.

\n

Converts self into an Option<E>, consuming self,\nand discarding the success value, if any.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err("Nothing here");\nassert_eq!(x.err(), Some("Nothing here"));
\n
1.0.0 (const: 1.48.0) · source

pub const fn as_ref(&self) -> Result<&T, &E>

Converts from &Result<T, E> to Result<&T, &E>.

\n

Produces a new Result, containing a reference\ninto the original, leaving the original in place.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err("Error");\nassert_eq!(x.as_ref(), Err(&"Error"));
\n
1.0.0 (const: unstable) · source

pub fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut Result<T, E> to Result<&mut T, &mut E>.

\n
Examples
\n
fn mutate(r: &mut Result<i32, i32>) {\n    match r.as_mut() {\n        Ok(v) => *v = 42,\n        Err(e) => *e = 0,\n    }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
\n
1.0.0 · source

pub fn map<U, F>(self, op: F) -> Result<U, E>where\n F: FnOnce(T) -> U,

Maps a Result<T, E> to Result<U, E> by applying a function to a\ncontained Ok value, leaving an Err value untouched.

\n

This function can be used to compose the results of two functions.

\n
Examples
\n

Print the numbers on each line of a string multiplied by two.

\n\n
let line = "1\\n2\\n3\\n4\\n";\n\nfor num in line.lines() {\n    match num.parse::<i32>().map(|i| i * 2) {\n        Ok(n) => println!("{n}"),\n        Err(..) => {}\n    }\n}
\n
1.41.0 · source

pub fn map_or<U, F>(self, default: U, f: F) -> Uwhere\n F: FnOnce(T) -> U,

Returns the provided default (if Err), or\napplies a function to the contained value (if Ok).

\n

Arguments passed to map_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else,\nwhich is lazily evaluated.

\n
Examples
\n
let x: Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err("bar");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
\n
1.41.0 · source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> Uwhere\n D: FnOnce(E) -> U,\n F: FnOnce(T) -> U,

Maps a Result<T, E> to U by applying fallback function default to\na contained Err value, or function f to a contained Ok value.

\n

This function can be used to unpack a successful result\nwhile handling an error.

\n
Examples
\n
let k = 21;\n\nlet x : Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err("bar");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
\n
1.0.0 · source

pub fn map_err<F, O>(self, op: O) -> Result<T, F>where\n O: FnOnce(E) -> F,

Maps a Result<T, E> to Result<T, F> by applying a function to a\ncontained Err value, leaving an Ok value untouched.

\n

This function can be used to pass through a successful result while handling\nan error.

\n
Examples
\n
fn stringify(x: u32) -> String { format!("error code: {x}") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
\n
source

pub fn inspect<F>(self, f: F) -> Result<T, E>where\n F: FnOnce(&T),

🔬This is a nightly-only experimental API. (result_option_inspect)

Calls the provided closure with a reference to the contained value (if Ok).

\n
Examples
\n
#![feature(result_option_inspect)]\n\nlet x: u8 = "4"\n    .parse::<u8>()\n    .inspect(|x| println!("original: {x}"))\n    .map(|x| x.pow(3))\n    .expect("failed to parse number");
\n
source

pub fn inspect_err<F>(self, f: F) -> Result<T, E>where\n F: FnOnce(&E),

🔬This is a nightly-only experimental API. (result_option_inspect)

Calls the provided closure with a reference to the contained error (if Err).

\n
Examples
\n
#![feature(result_option_inspect)]\n\nuse std::{fs, io};\n\nfn read() -> io::Result<String> {\n    fs::read_to_string("address.txt")\n        .inspect_err(|e| eprintln!("failed to read file: {e}"))\n}
\n
1.47.0 · source

pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>where\n T: Deref,

Converts from Result<T, E> (or &Result<T, E>) to Result<&<T as Deref>::Target, &E>.

\n

Coerces the Ok variant of the original Result via Deref\nand returns the new Result.

\n
Examples
\n
let x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&str, &u32> = Ok("hello");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
\n
1.47.0 · source

pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>where\n T: DerefMut,

Converts from Result<T, E> (or &mut Result<T, E>) to Result<&mut <T as DerefMut>::Target, &mut E>.

\n

Coerces the Ok variant of the original Result via DerefMut\nand returns the new Result.

\n
Examples
\n
let mut s = "HELLO".to_string();\nlet mut x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
\n
1.0.0 · source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
Examples
\n
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter().next(), None);
\n
1.0.0 · source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
Examples
\n
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n    Some(v) => *v = 40,\n    None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter_mut().next(), None);
\n
1.4.0 · source

pub fn expect(self, msg: &str) -> Twhere\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
Panics
\n

Panics if the value is an Err, with a panic message including the\npassed message, and the content of the Err.

\n
Examples
\n
let x: Result<u32, &str> = Err("emergency failure");\nx.expect("Testing expect"); // panics with `Testing expect: emergency failure`
\n
Recommended Message Style
\n

We recommend that expect messages are used to describe the reason you\nexpect the Result should be Ok.

\n\n
let path = std::env::var("IMPORTANT_PATH")\n    .expect("env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`");
\n

Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.

\n

For more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error module docs.

\n
1.0.0 · source

pub fn unwrap(self) -> Twhere\n E: Debug,

Returns the contained Ok value, consuming the self value.

\n

Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err\ncase explicitly, or call unwrap_or, unwrap_or_else, or\nunwrap_or_default.

\n
Panics
\n

Panics if the value is an Err, with a panic message provided by the\nErr’s value.

\n
Examples
\n

Basic usage:

\n\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nx.unwrap(); // panics with `emergency failure`
\n
1.16.0 · source

pub fn unwrap_or_default(self) -> Twhere\n T: Default,

Returns the contained Ok value or a default

\n

Consumes the self argument then, if Ok, returns the contained\nvalue, otherwise if Err, returns the default value for that\ntype.

\n
Examples
\n

Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse converts\na string to any other type that implements FromStr, returning an\nErr on error.

\n\n
let good_year_from_input = "1909";\nlet bad_year_from_input = "190blarg";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
\n
1.17.0 · source

pub fn expect_err(self, msg: &str) -> Ewhere\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
Panics
\n

Panics if the value is an Ok, with a panic message including the\npassed message, and the content of the Ok.

\n
Examples
\n
let x: Result<u32, &str> = Ok(10);\nx.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
\n
1.0.0 · source

pub fn unwrap_err(self) -> Ewhere\n T: Debug,

Returns the contained Err value, consuming the self value.

\n
Panics
\n

Panics if the value is an Ok, with a custom panic message provided\nby the Ok’s value.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(x.unwrap_err(), "emergency failure");
\n
source

pub fn into_ok(self) -> Twhere\n E: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Ok value, but never panics.

\n

Unlike unwrap, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap as a maintainability safeguard that will fail\nto compile if the error type of the Result is later changed\nto an error that can actually occur.

\n
Examples
\n
\nfn only_good_news() -> Result<String, !> {\n    Ok("this is fine".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!("{s}");
\n
source

pub fn into_err(self) -> Ewhere\n T: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Err value, but never panics.

\n

Unlike unwrap_err, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err as a maintainability safeguard that will fail\nto compile if the ok type of the Result is later changed\nto a type that can actually occur.

\n
Examples
\n
\nfn only_bad_news() -> Result<!, String> {\n    Err("Oops, it failed".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!("{error}");
\n
1.0.0 · source

pub fn and<U>(self, res: Result<U, E>) -> Result<U, E>

Returns res if the result is Ok, otherwise returns the Err value of self.

\n

Arguments passed to and are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then, which is\nlazily evaluated.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("late error"));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<&str, &str> = Ok("foo");\nassert_eq!(x.and(y), Err("early error"));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("not a 2"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok("different result type");\nassert_eq!(x.and(y), Ok("different result type"));
\n
1.0.0 · source

pub fn and_then<U, F>(self, op: F) -> Result<U, E>where\n F: FnOnce(T) -> Result<U, E>,

Calls op if the result is Ok, otherwise returns the Err value of self.

\n

This function can be used for control flow based on Result values.

\n
Examples
\n
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n    x.checked_mul(x).map(|sq| sq.to_string()).ok_or("overflowed")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err("overflowed"));\nassert_eq!(Err("not a number").and_then(sq_then_to_string), Err("not a number"));
\n

Often used to chain fallible operations that may return Err.

\n\n
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows "/" maps to "C:\\"\nlet root_modified_time = Path::new("/").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new("/bad/path").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
\n
1.0.0 · source

pub fn or<F>(self, res: Result<T, F>) -> Result<T, F>

Returns res if the result is Err, otherwise returns the Ok value of self.

\n

Arguments passed to or are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else, which is\nlazily evaluated.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Err("late error"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
\n
1.0.0 · source

pub fn or_else<F, O>(self, op: O) -> Result<T, F>where\n O: FnOnce(E) -> Result<T, F>,

Calls op if the result is Err, otherwise returns the Ok value of self.

\n

This function can be used for control flow based on result values.

\n
Examples
\n
fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
\n
1.0.0 · source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

\n

Arguments passed to unwrap_or are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else,\nwhich is lazily evaluated.

\n
Examples
\n
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err("error");\nassert_eq!(x.unwrap_or(default), default);
\n
1.0.0 · source

pub fn unwrap_or_else<F>(self, op: F) -> Twhere\n F: FnOnce(E) -> T,

Returns the contained Ok value or computes it from a closure.

\n
Examples
\n
fn count(x: &str) -> usize { x.len() }\n\nassert_eq!(Ok(2).unwrap_or_else(count), 2);\nassert_eq!(Err("foo").unwrap_or_else(count), 3);
\n
1.58.0 · source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value,\nwithout checking that the value is not an Err.

\n
Safety
\n

Calling this method on an Err is undefined behavior.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
\n
1.58.0 · source

pub unsafe fn unwrap_err_unchecked(self) -> E

Returns the contained Err value, consuming the self value,\nwithout checking that the value is not an Ok.

\n
Safety
\n

Calling this method on an Ok is undefined behavior.

\n
Examples
\n
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
\n\n
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, "emergency failure");
\n
",0,"volta_layout_macro::ast::Result"],["
source§

impl<T, E> Result<&T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>where\n T: Copy,

Maps a Result<&T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>where\n T: Clone,

Maps a Result<&T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
Examples
\n
let val = 12;\nlet x: Result<&i32, i32> = Ok(&val);\nassert_eq!(x, Ok(&12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"volta_layout_macro::ast::Result"],["
source§

impl<T, E> Result<&mut T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>where\n T: Copy,

Maps a Result<&mut T, E> to a Result<T, E> by copying the contents of the\nOk part.

\n
Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
\n
1.59.0 · source

pub fn cloned(self) -> Result<T, E>where\n T: Clone,

Maps a Result<&mut T, E> to a Result<T, E> by cloning the contents of the\nOk part.

\n
Examples
\n
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
\n
",0,"volta_layout_macro::ast::Result"],["
source§

impl<T, E> Result<Option<T>, E>

1.33.0 (const: unstable) · source

pub fn transpose(self) -> Option<Result<T, E>>

Transposes a Result of an Option into an Option of a Result.

\n

Ok(None) will be mapped to None.\nOk(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).

\n
Examples
\n
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
\n
",0,"volta_layout_macro::ast::Result"],["
source§

impl<T, E> Result<Result<T, E>, E>

source

pub fn flatten(self) -> Result<T, E>

🔬This is a nightly-only experimental API. (result_flattening)

Converts from Result<Result<T, E>, E> to Result<T, E>

\n
Examples
\n
#![feature(result_flattening)]\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));\nassert_eq!(Ok("hello"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
\n

Flattening only removes one level of nesting at a time:

\n\n
#![feature(result_flattening)]\nlet x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok("hello")));\nassert_eq!(Ok(Ok("hello")), x.flatten());\nassert_eq!(Ok("hello"), x.flatten().flatten());
\n
",0,"volta_layout_macro::ast::Result"],["
1.61.0 · source§

impl<T, E> Termination for Result<T, E>where\n T: Termination,\n E: Debug,

source§

fn report(self) -> ExitCode

Is called to get the representation of the value as status code.\nThis status code is returned to the operating system.
","Termination","volta_layout_macro::ast::Result"],["
source§

impl<T, E, F> FromResidual<Yeet<E>> for Result<T, F>where\n F: From<E>,

source§

fn from_residual(_: Yeet<E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","volta_layout_macro::ast::Result"],["
source§

impl<T, E, F> FromResidual<Result<Infallible, E>> for Result<T, F>where\n F: From<E>,

source§

fn from_residual(residual: Result<Infallible, E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
","FromResidual>","volta_layout_macro::ast::Result"],["
source§

impl<T, E> Try for Result<T, E>

§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = Result<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual\nas part of ? when short-circuiting. Read more
source§

fn from_output(output: <Result<T, E> as Try>::Output) -> Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch(\n self\n) -> ControlFlow<<Result<T, E> as Try>::Residual, <Result<T, E> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break). Read more
","Try","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> StructuralEq for Result<T, E>

","StructuralEq","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> Eq for Result<T, E>where\n T: Eq,\n E: Eq,

","Eq","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<A, E, V> FromIterator<Result<A, E>> for Result<V, E>where\n V: FromIterator<A>,

source§

fn from_iter<I>(iter: I) -> Result<V, E>where\n I: IntoIterator<Item = Result<A, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err occur, a\ncontainer with the values of each Result is returned.

\n

Here is an example which increments every integer in a vector,\nchecking for overflow:

\n\n
let v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_add(1).ok_or("Overflow!")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
\n

Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:

\n\n
let v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n    x.checked_sub(1).ok_or("Underflow!")\n).collect();\nassert_eq!(res, Err("Underflow!"));
\n

Here is a variation on the previous example, showing that no\nfurther elements are taken from iter after the first Err.

\n\n
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n    shared += x;\n    x.checked_sub(2).ok_or("Underflow!")\n}).collect();\nassert_eq!(res, Err("Underflow!"));\nassert_eq!(shared, 6);
\n

Since the third element caused an underflow, no further elements were taken,\nso the final value of shared is 6 (= 3 + 2 + 1), not 16.

\n
","FromIterator>","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> Ord for Result<T, E>where\n T: Ord,\n E: Ord,

source§

fn cmp(&self, other: &Result<T, E>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere\n Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
","Ord","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> PartialEq for Result<T, E>where\n T: PartialEq,\n E: PartialEq,

source§

fn eq(&self, other: &Result<T, E>) -> bool

This method tests for self and other values to be equal, and is used\nby ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always\nsufficient, and should not be overridden without very good reason.
","PartialEq","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> Clone for Result<T, E>where\n T: Clone,\n E: Clone,

source§

fn clone(&self) -> Result<T, E>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Result<T, E>)

Performs copy-assignment from source. Read more
","Clone","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> Hash for Result<T, E>where\n T: Hash,\n E: Hash,

source§

fn hash<__H>(&self, state: &mut __H)where\n __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> IntoIterator for Result<T, E>

source§

fn into_iter(self) -> IntoIter<T>

Returns a consuming iterator over the possibly contained value.

\n

The iterator yields one value if the result is Result::Ok, otherwise none.

\n
Examples
\n
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err("nothing!");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
\n
§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
","IntoIterator","volta_layout_macro::ast::Result"],["
source§

impl<T, E> Residual<T> for Result<Infallible, E>

§

type TryType = Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
","Residual","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> StructuralPartialEq for Result<T, E>

","StructuralPartialEq","volta_layout_macro::ast::Result"],["
1.16.0 · source§

impl<T, U, E> Sum<Result<U, E>> for Result<T, E>where\n T: Sum<U>,

source§

fn sum<I>(iter: I) -> Result<T, E>where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the sum of all elements is returned.

\n
Examples
\n

This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:

\n\n
let f = |&x: &i32| if x < 0 { Err("Negative element found") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err("Negative element found"));
\n
","Sum>","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> Debug for Result<T, E>where\n T: Debug,\n E: Debug,

source§

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

Formats the value using the given formatter. Read more
","Debug","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> PartialOrd for Result<T, E>where\n T: PartialOrd,\n E: PartialOrd,

source§

fn partial_cmp(&self, other: &Result<T, E>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <=\noperator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >=\noperator. Read more
","PartialOrd","volta_layout_macro::ast::Result"],["
1.0.0 · source§

impl<T, E> Copy for Result<T, E>where\n T: Copy,\n E: Copy,

","Copy","volta_layout_macro::ast::Result"],["
1.16.0 · source§

impl<T, U, E> Product<Result<U, E>> for Result<T, E>where\n T: Product<U>,

source§

fn product<I>(iter: I) -> Result<T, E>where\n I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further\nelements are taken, and the Err is returned. Should no Err\noccur, the product of all elements is returned.

\n
Examples
\n

This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err:

\n\n
let nums = vec!["5", "10", "1", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec!["5", "10", "one", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
\n
","Product>","volta_layout_macro::ast::Result"]] +};if (window.register_type_impls) {window.register_type_impls(type_impls);} else {window.pending_type_impls = type_impls;}})() \ No newline at end of file diff --git a/main/validate_npm_package_name/all.html b/main/validate_npm_package_name/all.html new file mode 100644 index 000000000..141bbc9f2 --- /dev/null +++ b/main/validate_npm_package_name/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/main/validate_npm_package_name/constant.BLACKLIST.html b/main/validate_npm_package_name/constant.BLACKLIST.html new file mode 100644 index 000000000..1931f68d9 --- /dev/null +++ b/main/validate_npm_package_name/constant.BLACKLIST.html @@ -0,0 +1 @@ +BLACKLIST in validate_npm_package_name - Rust
pub(crate) const BLACKLIST: [&str; 2];
\ No newline at end of file diff --git a/main/validate_npm_package_name/constant.BUILTINS.html b/main/validate_npm_package_name/constant.BUILTINS.html new file mode 100644 index 000000000..8986c8349 --- /dev/null +++ b/main/validate_npm_package_name/constant.BUILTINS.html @@ -0,0 +1 @@ +BUILTINS in validate_npm_package_name - Rust
pub(crate) const BUILTINS: [&str; 39];
\ No newline at end of file diff --git a/main/validate_npm_package_name/enum.Validity.html b/main/validate_npm_package_name/enum.Validity.html new file mode 100644 index 000000000..283529e90 --- /dev/null +++ b/main/validate_npm_package_name/enum.Validity.html @@ -0,0 +1,25 @@ +Validity in validate_npm_package_name - Rust
pub enum Validity {
+    Valid,
+    ValidForOldPackages {
+        warnings: Vec<String>,
+    },
+    Invalid {
+        warnings: Vec<String>,
+        errors: Vec<String>,
+    },
+}

Variants§

§

Valid

Valid for new and old packages

+
§

ValidForOldPackages

Fields

§warnings: Vec<String>

Valid only for old packages

+
§

Invalid

Fields

§warnings: Vec<String>
§errors: Vec<String>

Not valid for new or old packages

+

Implementations§

Trait Implementations§

source§

impl Debug for Validity

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for Validity

source§

fn eq(&self, other: &Validity) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for Validity

source§

impl StructuralEq for Validity

source§

impl StructuralPartialEq for Validity

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/validate_npm_package_name/fn.done.html b/main/validate_npm_package_name/fn.done.html new file mode 100644 index 000000000..b74328f10 --- /dev/null +++ b/main/validate_npm_package_name/fn.done.html @@ -0,0 +1 @@ +done in validate_npm_package_name - Rust
pub(crate) fn done(warnings: Vec<String>, errors: Vec<String>) -> Validity
\ No newline at end of file diff --git a/main/validate_npm_package_name/fn.validate.html b/main/validate_npm_package_name/fn.validate.html new file mode 100644 index 000000000..bc1a8cfdb --- /dev/null +++ b/main/validate_npm_package_name/fn.validate.html @@ -0,0 +1 @@ +validate in validate_npm_package_name - Rust
pub fn validate(name: &str) -> Validity
\ No newline at end of file diff --git a/main/validate_npm_package_name/index.html b/main/validate_npm_package_name/index.html new file mode 100644 index 000000000..5d466ad1a --- /dev/null +++ b/main/validate_npm_package_name/index.html @@ -0,0 +1,5 @@ +validate_npm_package_name - Rust
Expand description

A Rust implementation of the validation rules from the core JS package +validate-npm-package-name.

+

Enums

Constants

Statics

Functions

\ No newline at end of file diff --git a/main/validate_npm_package_name/sidebar-items.js b/main/validate_npm_package_name/sidebar-items.js new file mode 100644 index 000000000..48cde7ae7 --- /dev/null +++ b/main/validate_npm_package_name/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["BLACKLIST","BUILTINS"],"enum":["Validity"],"fn":["done","validate"],"static":["ENCODE_URI_SET","SCOPED_PACKAGE","SPECIAL_CHARS"]}; \ No newline at end of file diff --git a/main/validate_npm_package_name/static.ENCODE_URI_SET.html b/main/validate_npm_package_name/static.ENCODE_URI_SET.html new file mode 100644 index 000000000..186de370a --- /dev/null +++ b/main/validate_npm_package_name/static.ENCODE_URI_SET.html @@ -0,0 +1,3 @@ +ENCODE_URI_SET in validate_npm_package_name - Rust
pub(crate) static ENCODE_URI_SET: &AsciiSet
Expand description

The set of characters to encode, matching the characters encoded by +encodeURIComponent

+
\ No newline at end of file diff --git a/main/validate_npm_package_name/static.SCOPED_PACKAGE.html b/main/validate_npm_package_name/static.SCOPED_PACKAGE.html new file mode 100644 index 000000000..594ce6955 --- /dev/null +++ b/main/validate_npm_package_name/static.SCOPED_PACKAGE.html @@ -0,0 +1 @@ +SCOPED_PACKAGE in validate_npm_package_name - Rust
pub(crate) static SCOPED_PACKAGE: Lazy<Regex>
\ No newline at end of file diff --git a/main/validate_npm_package_name/static.SPECIAL_CHARS.html b/main/validate_npm_package_name/static.SPECIAL_CHARS.html new file mode 100644 index 000000000..556acfe98 --- /dev/null +++ b/main/validate_npm_package_name/static.SPECIAL_CHARS.html @@ -0,0 +1 @@ +SPECIAL_CHARS in validate_npm_package_name - Rust
pub(crate) static SPECIAL_CHARS: Lazy<Regex>
\ No newline at end of file diff --git a/main/volta/all.html b/main/volta/all.html new file mode 100644 index 000000000..e1e577d05 --- /dev/null +++ b/main/volta/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Functions

Statics

Constants

\ No newline at end of file diff --git a/main/volta/cli/enum.Subcommand.html b/main/volta/cli/enum.Subcommand.html new file mode 100644 index 000000000..2126cd2a8 --- /dev/null +++ b/main/volta/cli/enum.Subcommand.html @@ -0,0 +1,47 @@ +Subcommand in volta::cli - Rust

Enum volta::cli::Subcommand

source ·
pub(crate) enum Subcommand {
+    Fetch(Fetch),
+    Install(Install),
+    Uninstall(Uninstall),
+    Pin(Pin),
+    List(List),
+    Completions(Completions),
+    Which(Which),
+    Use(Use),
+    Setup(Setup),
+    Run(Run),
+}

Variants§

§

Fetch(Fetch)

Fetches a tool to the local machine

+
§

Install(Install)

Installs a tool in your toolchain

+
§

Uninstall(Uninstall)

Uninstalls a tool from your toolchain

+
§

Pin(Pin)

Pins your project’s runtime or package manager

+
§

List(List)

Displays the current toolchain

+
§

Completions(Completions)

Generates Volta completions

+

By default, completions will be generated for the value of your current shell, +shell, i.e. the value of SHELL. If you set the <shell> option, completions +will be generated for that shell instead.

+

If you specify a directory, the completions will be written to a file there; +otherwise, they will be written to stdout.

+
§

Which(Which)

Locates the actual binary that will be called by Volta

+
§

Use(Use)

§

Setup(Setup)

Enables Volta for the current user / shell

+
§

Run(Run)

Run a command with custom Node, npm, pnpm, and/or Yarn versions

+

Implementations§

source§

impl Subcommand

source

pub(crate) fn run(self, session: &mut Session) -> Fallible<ExitCode>

Trait Implementations§

source§

impl FromArgMatches for Subcommand

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut<'b>( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Subcommand for Subcommand

source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/cli/fn.styles.html b/main/volta/cli/fn.styles.html new file mode 100644 index 000000000..9b4134964 --- /dev/null +++ b/main/volta/cli/fn.styles.html @@ -0,0 +1 @@ +styles in volta::cli - Rust

Function volta::cli::styles

source ·
fn styles() -> Styles
\ No newline at end of file diff --git a/main/volta/cli/index.html b/main/volta/cli/index.html new file mode 100644 index 000000000..69c2c0acc --- /dev/null +++ b/main/volta/cli/index.html @@ -0,0 +1 @@ +volta::cli - Rust

Module volta::cli

source ·

Structs

Enums

Functions

\ No newline at end of file diff --git a/main/volta/cli/sidebar-items.js b/main/volta/cli/sidebar-items.js new file mode 100644 index 000000000..7a10a73f0 --- /dev/null +++ b/main/volta/cli/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Subcommand"],"fn":["styles"],"struct":["Volta"]}; \ No newline at end of file diff --git a/main/volta/cli/struct.Volta.html b/main/volta/cli/struct.Volta.html new file mode 100644 index 000000000..0ad8818ef --- /dev/null +++ b/main/volta/cli/struct.Volta.html @@ -0,0 +1,40 @@ +Volta in volta::cli - Rust

Struct volta::cli::Volta

source ·
pub(crate) struct Volta {
+    pub(crate) command: Option<Subcommand>,
+    pub(crate) verbose: bool,
+    pub(crate) very_verbose: bool,
+    pub(crate) quiet: bool,
+    pub(crate) version: bool,
+}

Fields§

§command: Option<Subcommand>§verbose: bool

Enables verbose diagnostics

+
§very_verbose: bool

Enables trace-level diagnostics.

+
§quiet: bool

Prevents unnecessary output

+
§version: bool

Prints the current version of Volta

+

Implementations§

source§

impl Volta

source

pub(crate) fn run(self, session: &mut Session) -> Fallible<ExitCode>

Trait Implementations§

source§

impl Args for Volta

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl CommandFactory for Volta

source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
source§

impl FromArgMatches for Volta

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for Volta

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Selfwhere + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error. Read more
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where + I: IntoIterator<Item = T>, + T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl RefUnwindSafe for Volta

§

impl Send for Volta

§

impl Sync for Volta

§

impl Unpin for Volta

§

impl UnwindSafe for Volta

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/completions/index.html b/main/volta/command/completions/index.html new file mode 100644 index 000000000..d84ef4e39 --- /dev/null +++ b/main/volta/command/completions/index.html @@ -0,0 +1 @@ +volta::command::completions - Rust
\ No newline at end of file diff --git a/main/volta/command/completions/sidebar-items.js b/main/volta/command/completions/sidebar-items.js new file mode 100644 index 000000000..3f5d9aaae --- /dev/null +++ b/main/volta/command/completions/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Completions"]}; \ No newline at end of file diff --git a/main/volta/command/completions/struct.Completions.html b/main/volta/command/completions/struct.Completions.html new file mode 100644 index 000000000..2783a954d --- /dev/null +++ b/main/volta/command/completions/struct.Completions.html @@ -0,0 +1,31 @@ +Completions in volta::command::completions - Rust
pub(crate) struct Completions {
+    shell: Shell,
+    out_file: Option<PathBuf>,
+    force: bool,
+}

Fields§

§shell: Shell

Shell to generate completions for

+
§out_file: Option<PathBuf>

File to write generated completions to

+
§force: bool

Write over an existing file, if any.

+

Trait Implementations§

source§

impl Args for Completions

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Completions

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl Debug for Completions

source§

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

Formats the value using the given formatter. Read more
source§

impl FromArgMatches for Completions

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/fetch/index.html b/main/volta/command/fetch/index.html new file mode 100644 index 000000000..e90e2f10c --- /dev/null +++ b/main/volta/command/fetch/index.html @@ -0,0 +1 @@ +volta::command::fetch - Rust

Module volta::command::fetch

source ·

Structs

\ No newline at end of file diff --git a/main/volta/command/fetch/sidebar-items.js b/main/volta/command/fetch/sidebar-items.js new file mode 100644 index 000000000..2e61580f4 --- /dev/null +++ b/main/volta/command/fetch/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Fetch"]}; \ No newline at end of file diff --git a/main/volta/command/fetch/struct.Fetch.html b/main/volta/command/fetch/struct.Fetch.html new file mode 100644 index 000000000..289e967e4 --- /dev/null +++ b/main/volta/command/fetch/struct.Fetch.html @@ -0,0 +1,27 @@ +Fetch in volta::command::fetch - Rust

Struct volta::command::fetch::Fetch

source ·
pub(crate) struct Fetch {
+    tools: Vec<String>,
+}

Fields§

§tools: Vec<String>

Tools to fetch, like node, yarn@latest or your-package@^14.4.3.

+

Trait Implementations§

source§

impl Args for Fetch

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Fetch

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Fetch

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for Fetch

§

impl Send for Fetch

§

impl Sync for Fetch

§

impl Unpin for Fetch

§

impl UnwindSafe for Fetch

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/index.html b/main/volta/command/index.html new file mode 100644 index 000000000..6f18e7637 --- /dev/null +++ b/main/volta/command/index.html @@ -0,0 +1 @@ +volta::command - Rust

Module volta::command

source ·

Modules

Traits

\ No newline at end of file diff --git a/main/volta/command/install/index.html b/main/volta/command/install/index.html new file mode 100644 index 000000000..e77c693e7 --- /dev/null +++ b/main/volta/command/install/index.html @@ -0,0 +1 @@ +volta::command::install - Rust

Module volta::command::install

source ·

Structs

\ No newline at end of file diff --git a/main/volta/command/install/sidebar-items.js b/main/volta/command/install/sidebar-items.js new file mode 100644 index 000000000..bdd8a88ff --- /dev/null +++ b/main/volta/command/install/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Install"]}; \ No newline at end of file diff --git a/main/volta/command/install/struct.Install.html b/main/volta/command/install/struct.Install.html new file mode 100644 index 000000000..17357c7db --- /dev/null +++ b/main/volta/command/install/struct.Install.html @@ -0,0 +1,27 @@ +Install in volta::command::install - Rust

Struct volta::command::install::Install

source ·
pub(crate) struct Install {
+    tools: Vec<String>,
+}

Fields§

§tools: Vec<String>

Tools to install, like node, yarn@latest or your-package@^14.4.3.

+

Trait Implementations§

source§

impl Args for Install

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Install

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Install

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/enum.Filter.html b/main/volta/command/list/enum.Filter.html new file mode 100644 index 000000000..2f9a48435 --- /dev/null +++ b/main/volta/command/list/enum.Filter.html @@ -0,0 +1,24 @@ +Filter in volta::command::list - Rust

Enum volta::command::list::Filter

source ·
enum Filter {
+    Current,
+    Default,
+    None,
+}
Expand description

How (if at all) should the list query be narrowed?

+

Variants§

§

Current

Display only the currently active tool(s).

+

For example, if the user queries volta list --current yarn, show only +the version of Yarn currently in use: project, default, or none.

+
§

Default

Show only the user’s default tool(s).

+

For example, if the user queries volta list --default node, show only +the user’s default Node version.

+
§

None

Do not filter at all. Show all tool(s) matching the query.

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/enum.Format.html b/main/volta/command/list/enum.Format.html new file mode 100644 index 000000000..26cdd3eb1 --- /dev/null +++ b/main/volta/command/list/enum.Format.html @@ -0,0 +1,16 @@ +Format in volta::command::list - Rust

Enum volta::command::list::Format

source ·
enum Format {
+    Human,
+    Plain,
+}

Variants§

§

Human

§

Plain

Trait Implementations§

source§

impl Clone for Format

source§

fn clone(&self) -> Format

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ValueEnum for Format

source§

fn value_variants<'a>() -> &'a [Self]

All possible argument values, in display order.
source§

fn to_possible_value<'a>(&self) -> Option<PossibleValue>

The canonical argument value. Read more
§

fn from_str(input: &str, ignore_case: bool) -> Result<Self, String>

Parse an argument into Self.
source§

impl Copy for Format

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/enum.Package.html b/main/volta/command/list/enum.Package.html new file mode 100644 index 000000000..c13bf1b58 --- /dev/null +++ b/main/volta/command/list/enum.Package.html @@ -0,0 +1,29 @@ +Package in volta::command::list - Rust

Enum volta::command::list::Package

source ·
enum Package {
+    Default {
+        details: PackageDetails,
+        node: Version,
+        tools: Vec<String>,
+    },
+    Project {
+        name: String,
+        tools: Vec<String>,
+        path: PathBuf,
+    },
+    Fetched(PackageDetails),
+}

Variants§

§

Default

Fields

§node: Version

The version of Node the package is installed against.

+
§tools: Vec<String>

The names of the tools associated with the package.

+
§

Project

Fields

§name: String
§tools: Vec<String>

The names of the tools associated with the package.

+
§path: PathBuf
§

Fetched(PackageDetails)

Implementations§

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/enum.PackageManagerKind.html b/main/volta/command/list/enum.PackageManagerKind.html new file mode 100644 index 000000000..cd75b619e --- /dev/null +++ b/main/volta/command/list/enum.PackageManagerKind.html @@ -0,0 +1,33 @@ +PackageManagerKind in volta::command::list - Rust
enum PackageManagerKind {
+    Npm,
+    Pnpm,
+    Yarn,
+}

Variants§

§

Npm

§

Pnpm

§

Yarn

Trait Implementations§

source§

impl Clone for PackageManagerKind

source§

fn clone(&self) -> PackageManagerKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Display for PackageManagerKind

source§

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

Formats the value using the given formatter. Read more
source§

impl Ord for PackageManagerKind

source§

fn cmp(&self, other: &PackageManagerKind) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for PackageManagerKind

source§

fn eq(&self, other: &PackageManagerKind) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PackageManagerKind

source§

fn partial_cmp(&self, other: &PackageManagerKind) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Copy for PackageManagerKind

source§

impl Eq for PackageManagerKind

source§

impl StructuralEq for PackageManagerKind

source§

impl StructuralPartialEq for PackageManagerKind

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/enum.Source.html b/main/volta/command/list/enum.Source.html new file mode 100644 index 000000000..db73edf38 --- /dev/null +++ b/main/volta/command/list/enum.Source.html @@ -0,0 +1,28 @@ +Source in volta::command::list - Rust

Enum volta::command::list::Source

source ·
enum Source {
+    Project(PathBuf),
+    Default,
+    None,
+}
Expand description

The source of a given item, from the perspective of a user.

+

Note: this is distinct from volta_core::platform::sourced::Source, which +represents the source only of a Platform, which is a composite structure. +By contrast, this Source is concerned only with a single item.

+

Variants§

§

Project(PathBuf)

The item is from a project. The wrapped PathBuf is the path to the +project’s package.json.

+
§

Default

The item is the user’s default.

+
§

None

The item is one that has been fetched but is not installed anywhere.

+

Implementations§

source§

impl Source

source

fn allowed_with(&self, filter: &Filter) -> bool

Trait Implementations§

source§

impl Clone for Source

source§

fn clone(&self) -> Source

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Source

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for Source

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for Source

source§

fn eq(&self, other: &Source) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Source

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/enum.Subcommand.html b/main/volta/command/list/enum.Subcommand.html new file mode 100644 index 000000000..c4e35bf4b --- /dev/null +++ b/main/volta/command/list/enum.Subcommand.html @@ -0,0 +1,29 @@ +Subcommand in volta::command::list - Rust
enum Subcommand {
+    All,
+    Node,
+    Npm,
+    Pnpm,
+    Yarn,
+    PackageOrTool {
+        name: String,
+    },
+}
Expand description

Which tool should we look up?

+

Variants§

§

All

Show every item in the toolchain.

+
§

Node

Show locally cached Node versions.

+
§

Npm

Show locally cached npm versions.

+
§

Pnpm

Show locally cached pnpm versions.

+
§

Yarn

Show locally cached Yarn versions.

+
§

PackageOrTool

Fields

§name: String

Show locally cached versions of a package or a package binary.

+

Trait Implementations§

source§

impl Clone for Subcommand

source§

fn clone(&self) -> Subcommand

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl FromStr for Subcommand

§

type Err = Infallible

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_active.html b/main/volta/command/list/human/fn.display_active.html new file mode 100644 index 000000000..ecce714db --- /dev/null +++ b/main/volta/command/list/human/fn.display_active.html @@ -0,0 +1,8 @@ +display_active in volta::command::list::human - Rust
fn display_active(
+    runtime: &Option<Box<Node>>,
+    package_managers: &[PackageManager],
+    packages: &[Package]
+) -> String
Expand description

Format the output for Toolchain::Active.

+

Accepts the components from the toolchain rather than the item itself so +that

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_all.html b/main/volta/command/list/human/fn.display_all.html new file mode 100644 index 000000000..0b75c71d4 --- /dev/null +++ b/main/volta/command/list/human/fn.display_all.html @@ -0,0 +1,6 @@ +display_all in volta::command::list::human - Rust

Function volta::command::list::human::display_all

source ·
fn display_all(
+    runtimes: &[Node],
+    package_managers: &[PackageManager],
+    packages: &[Package]
+) -> String
Expand description

Format the output for Toolchain::All.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_node.html b/main/volta/command/list/human/fn.display_node.html new file mode 100644 index 000000000..37c9d14e2 --- /dev/null +++ b/main/volta/command/list/human/fn.display_node.html @@ -0,0 +1,2 @@ +display_node in volta::command::list::human - Rust

Function volta::command::list::human::display_node

source ·
fn display_node(runtimes: &[Node]) -> String
Expand description

Format a set of Toolchain::Nodes.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_npms.html b/main/volta/command/list/human/fn.display_npms.html new file mode 100644 index 000000000..632f8bb52 --- /dev/null +++ b/main/volta/command/list/human/fn.display_npms.html @@ -0,0 +1,2 @@ +display_npms in volta::command::list::human - Rust

Function volta::command::list::human::display_npms

source ·
fn display_npms(managers: &[PackageManager]) -> String
Expand description

Format a set of Toolchain::PackageManagers for volta list npm

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_package_managers.html b/main/volta/command/list/human/fn.display_package_managers.html new file mode 100644 index 000000000..012bbc69f --- /dev/null +++ b/main/volta/command/list/human/fn.display_package_managers.html @@ -0,0 +1,5 @@ +display_package_managers in volta::command::list::human - Rust
fn display_package_managers(
+    kind: PackageManagerKind,
+    managers: &[PackageManager]
+) -> String
Expand description

Format a set of Toolchain::PackageManagers.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_packages.html b/main/volta/command/list/human/fn.display_packages.html new file mode 100644 index 000000000..2bcce82a3 --- /dev/null +++ b/main/volta/command/list/human/fn.display_packages.html @@ -0,0 +1,2 @@ +display_packages in volta::command::list::human - Rust
fn display_packages(packages: &[Package]) -> String
Expand description

Format a set of Toolchain::Packages and their associated tools.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.display_tool.html b/main/volta/command/list/human/fn.display_tool.html new file mode 100644 index 000000000..af9e7bb7e --- /dev/null +++ b/main/volta/command/list/human/fn.display_tool.html @@ -0,0 +1,2 @@ +display_tool in volta::command::list::human - Rust

Function volta::command::list::human::display_tool

source ·
fn display_tool(tool: &str, host_packages: &[Package]) -> String
Expand description

Format a single Toolchain::Tool with associated Toolchain::Package

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format.html b/main/volta/command/list/human/fn.format.html new file mode 100644 index 000000000..ab384b985 --- /dev/null +++ b/main/volta/command/list/human/fn.format.html @@ -0,0 +1 @@ +format in volta::command::list::human - Rust

Function volta::command::list::human::format

source ·
pub(super) fn format(toolchain: &Toolchain) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_package.html b/main/volta/command/list/human/fn.format_package.html new file mode 100644 index 000000000..0f7cabedd --- /dev/null +++ b/main/volta/command/list/human/fn.format_package.html @@ -0,0 +1,2 @@ +format_package in volta::command::list::human - Rust
fn format_package(package: &Package) -> String
Expand description

Format a single Toolchain::Package and its associated tools.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_package_list.html b/main/volta/command/list/human/fn.format_package_list.html new file mode 100644 index 000000000..c688d7eaf --- /dev/null +++ b/main/volta/command/list/human/fn.format_package_list.html @@ -0,0 +1,2 @@ +format_package_list in volta::command::list::human - Rust
fn format_package_list(packages: &[Package]) -> String
Expand description

format a list of Toolchain::Packages and their associated tools.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_package_manager.html b/main/volta/command/list/human/fn.format_package_manager.html new file mode 100644 index 000000000..b468f53c7 --- /dev/null +++ b/main/volta/command/list/human/fn.format_package_manager.html @@ -0,0 +1,2 @@ +format_package_manager in volta::command::list::human - Rust
fn format_package_manager(package_manager: &PackageManager) -> String
Expand description

format a single Toolchain::PackageManager.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_package_manager_kind.html b/main/volta/command/list/human/fn.format_package_manager_kind.html new file mode 100644 index 000000000..97ab0e38c --- /dev/null +++ b/main/volta/command/list/human/fn.format_package_manager_kind.html @@ -0,0 +1,3 @@ +format_package_manager_kind in volta::command::list::human - Rust
fn format_package_manager_kind(kind: PackageManagerKind) -> String
Expand description

format the title for a kind of package manager

+

This is distinct from the Display impl, because we need ‘Yarn’ to be capitalized for human output

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_package_manager_list_condensed.html b/main/volta/command/list/human/fn.format_package_manager_list_condensed.html new file mode 100644 index 000000000..12aa91888 --- /dev/null +++ b/main/volta/command/list/human/fn.format_package_manager_list_condensed.html @@ -0,0 +1,4 @@ +format_package_manager_list_condensed in volta::command::list::human - Rust
fn format_package_manager_list_condensed(
+    package_managers: &[PackageManager]
+) -> String
Expand description

format a list of Toolchain::PackageManagers in condensed form

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_package_manager_list_verbose.html b/main/volta/command/list/human/fn.format_package_manager_list_verbose.html new file mode 100644 index 000000000..a9db889e3 --- /dev/null +++ b/main/volta/command/list/human/fn.format_package_manager_list_verbose.html @@ -0,0 +1,4 @@ +format_package_manager_list_verbose in volta::command::list::human - Rust
fn format_package_manager_list_verbose(
+    package_managers: &[PackageManager]
+) -> String
Expand description

format a list of Toolchain::PackageManagers in verbose form

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_runtime.html b/main/volta/command/list/human/fn.format_runtime.html new file mode 100644 index 000000000..13b5d10ec --- /dev/null +++ b/main/volta/command/list/human/fn.format_runtime.html @@ -0,0 +1,2 @@ +format_runtime in volta::command::list::human - Rust
fn format_runtime(runtime: &Node) -> String
Expand description

format a single version of Toolchain::Node.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_runtime_list.html b/main/volta/command/list/human/fn.format_runtime_list.html new file mode 100644 index 000000000..8f2e8b2d1 --- /dev/null +++ b/main/volta/command/list/human/fn.format_runtime_list.html @@ -0,0 +1,2 @@ +format_runtime_list in volta::command::list::human - Rust
fn format_runtime_list(runtimes: &[Node]) -> String
Expand description

format a list of Toolchain::Nodes.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_tool.html b/main/volta/command/list/human/fn.format_tool.html new file mode 100644 index 000000000..e60d239ac --- /dev/null +++ b/main/volta/command/list/human/fn.format_tool.html @@ -0,0 +1,2 @@ +format_tool in volta::command::list::human - Rust

Function volta::command::list::human::format_tool

source ·
fn format_tool(package: &Package) -> String
Expand description

Format a single Toolchain::Package without detail information

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.format_tool_list.html b/main/volta/command/list/human/fn.format_tool_list.html new file mode 100644 index 000000000..ff2ad63cc --- /dev/null +++ b/main/volta/command/list/human/fn.format_tool_list.html @@ -0,0 +1,2 @@ +format_tool_list in volta::command::list::human - Rust
fn format_tool_list(packages: &[Package]) -> String
Expand description

Format a list of Toolchain::Packages without detail information

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.list_package_source.html b/main/volta/command/list/human/fn.list_package_source.html new file mode 100644 index 000000000..6c26043bf --- /dev/null +++ b/main/volta/command/list/human/fn.list_package_source.html @@ -0,0 +1,2 @@ +list_package_source in volta::command::list::human - Rust
fn list_package_source(package: &Package) -> String
Expand description

List a the source from a Toolchain::Package.

+
\ No newline at end of file diff --git a/main/volta/command/list/human/fn.wrap.html b/main/volta/command/list/human/fn.wrap.html new file mode 100644 index 000000000..0c8580874 --- /dev/null +++ b/main/volta/command/list/human/fn.wrap.html @@ -0,0 +1,3 @@ +wrap in volta::command::list::human - Rust

Function volta::command::list::human::wrap

source ·
fn wrap<S>(text: S) -> Stringwhere
+    S: AsRef<str>,
Expand description

Wrap and indent the output

+
\ No newline at end of file diff --git a/main/volta/command/list/human/index.html b/main/volta/command/list/human/index.html new file mode 100644 index 000000000..faa1d26df --- /dev/null +++ b/main/volta/command/list/human/index.html @@ -0,0 +1,2 @@ +volta::command::list::human - Rust

Module volta::command::list::human

source ·
Expand description

Define the “human” format style for list commands.

+

Statics

Functions

\ No newline at end of file diff --git a/main/volta/command/list/human/sidebar-items.js b/main/volta/command/list/human/sidebar-items.js new file mode 100644 index 000000000..9a31dfe1e --- /dev/null +++ b/main/volta/command/list/human/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["display_active","display_all","display_node","display_npms","display_package_managers","display_packages","display_tool","format","format_package","format_package_list","format_package_manager","format_package_manager_kind","format_package_manager_list_condensed","format_package_manager_list_verbose","format_runtime","format_runtime_list","format_tool","format_tool_list","list_package_source","wrap"],"static":["INDENTATION","NO_RUNTIME","TEXT_WIDTH"]}; \ No newline at end of file diff --git a/main/volta/command/list/human/static.INDENTATION.html b/main/volta/command/list/human/static.INDENTATION.html new file mode 100644 index 000000000..886b159c0 --- /dev/null +++ b/main/volta/command/list/human/static.INDENTATION.html @@ -0,0 +1 @@ +INDENTATION in volta::command::list::human - Rust
static INDENTATION: &str
\ No newline at end of file diff --git a/main/volta/command/list/human/static.NO_RUNTIME.html b/main/volta/command/list/human/static.NO_RUNTIME.html new file mode 100644 index 000000000..d2a5df3c1 --- /dev/null +++ b/main/volta/command/list/human/static.NO_RUNTIME.html @@ -0,0 +1 @@ +NO_RUNTIME in volta::command::list::human - Rust
static NO_RUNTIME: &str
\ No newline at end of file diff --git a/main/volta/command/list/human/static.TEXT_WIDTH.html b/main/volta/command/list/human/static.TEXT_WIDTH.html new file mode 100644 index 000000000..b953227e1 --- /dev/null +++ b/main/volta/command/list/human/static.TEXT_WIDTH.html @@ -0,0 +1 @@ +TEXT_WIDTH in volta::command::list::human - Rust
static TEXT_WIDTH: Lazy<usize>
\ No newline at end of file diff --git a/main/volta/command/list/index.html b/main/volta/command/list/index.html new file mode 100644 index 000000000..7fca123b2 --- /dev/null +++ b/main/volta/command/list/index.html @@ -0,0 +1,2 @@ +volta::command::list - Rust

Module volta::command::list

source ·

Modules

  • human 🔒
    Define the “human” format style for list commands.
  • plain 🔒
    Define the “plain” format style for list commands.
  • toolchain 🔒

Structs

Enums

\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.describe_package_managers.html b/main/volta/command/list/plain/fn.describe_package_managers.html new file mode 100644 index 000000000..e4be7acdd --- /dev/null +++ b/main/volta/command/list/plain/fn.describe_package_managers.html @@ -0,0 +1,3 @@ +describe_package_managers in volta::command::list::plain - Rust
fn describe_package_managers(
+    package_managers: &[PackageManager]
+) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.describe_packages.html b/main/volta/command/list/plain/fn.describe_packages.html new file mode 100644 index 000000000..3f0ac64ed --- /dev/null +++ b/main/volta/command/list/plain/fn.describe_packages.html @@ -0,0 +1 @@ +describe_packages in volta::command::list::plain - Rust
fn describe_packages(packages: &[Package]) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.describe_runtimes.html b/main/volta/command/list/plain/fn.describe_runtimes.html new file mode 100644 index 000000000..93fdca03e --- /dev/null +++ b/main/volta/command/list/plain/fn.describe_runtimes.html @@ -0,0 +1 @@ +describe_runtimes in volta::command::list::plain - Rust
fn describe_runtimes(runtimes: &[Node]) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.describe_tool_set.html b/main/volta/command/list/plain/fn.describe_tool_set.html new file mode 100644 index 000000000..d9d5095b7 --- /dev/null +++ b/main/volta/command/list/plain/fn.describe_tool_set.html @@ -0,0 +1 @@ +describe_tool_set in volta::command::list::plain - Rust
fn describe_tool_set(name: &str, hosts: &[Package]) -> String
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.display_node.html b/main/volta/command/list/plain/fn.display_node.html new file mode 100644 index 000000000..f75e89140 --- /dev/null +++ b/main/volta/command/list/plain/fn.display_node.html @@ -0,0 +1 @@ +display_node in volta::command::list::plain - Rust

Function volta::command::list::plain::display_node

source ·
fn display_node(source: &Source, version: &Version) -> String
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.display_package.html b/main/volta/command/list/plain/fn.display_package.html new file mode 100644 index 000000000..c593119ec --- /dev/null +++ b/main/volta/command/list/plain/fn.display_package.html @@ -0,0 +1 @@ +display_package in volta::command::list::plain - Rust
fn display_package(package: &Package) -> String
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.display_package_manager.html b/main/volta/command/list/plain/fn.display_package_manager.html new file mode 100644 index 000000000..55d080cbe --- /dev/null +++ b/main/volta/command/list/plain/fn.display_package_manager.html @@ -0,0 +1 @@ +display_package_manager in volta::command::list::plain - Rust
fn display_package_manager(package_manager: &PackageManager) -> String
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.display_tool.html b/main/volta/command/list/plain/fn.display_tool.html new file mode 100644 index 000000000..6bc246c30 --- /dev/null +++ b/main/volta/command/list/plain/fn.display_tool.html @@ -0,0 +1 @@ +display_tool in volta::command::list::plain - Rust

Function volta::command::list::plain::display_tool

source ·
fn display_tool(name: &str, host: &Package) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.format.html b/main/volta/command/list/plain/fn.format.html new file mode 100644 index 000000000..f773d65a4 --- /dev/null +++ b/main/volta/command/list/plain/fn.format.html @@ -0,0 +1 @@ +format in volta::command::list::plain - Rust

Function volta::command::list::plain::format

source ·
pub(super) fn format(toolchain: &Toolchain) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/list/plain/fn.package_source.html b/main/volta/command/list/plain/fn.package_source.html new file mode 100644 index 000000000..29bf7c665 --- /dev/null +++ b/main/volta/command/list/plain/fn.package_source.html @@ -0,0 +1 @@ +package_source in volta::command::list::plain - Rust
fn package_source(package: &Package) -> String
\ No newline at end of file diff --git a/main/volta/command/list/plain/index.html b/main/volta/command/list/plain/index.html new file mode 100644 index 000000000..dc61b17c4 --- /dev/null +++ b/main/volta/command/list/plain/index.html @@ -0,0 +1,2 @@ +volta::command::list::plain - Rust

Module volta::command::list::plain

source ·
Expand description

Define the “plain” format style for list commands.

+

Functions

\ No newline at end of file diff --git a/main/volta/command/list/plain/sidebar-items.js b/main/volta/command/list/plain/sidebar-items.js new file mode 100644 index 000000000..471c73a05 --- /dev/null +++ b/main/volta/command/list/plain/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["describe_package_managers","describe_packages","describe_runtimes","describe_tool_set","display_node","display_package","display_package_manager","display_tool","format","package_source"]}; \ No newline at end of file diff --git a/main/volta/command/list/sidebar-items.js b/main/volta/command/list/sidebar-items.js new file mode 100644 index 000000000..63660c171 --- /dev/null +++ b/main/volta/command/list/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Filter","Format","Package","PackageManagerKind","Source","Subcommand"],"mod":["human","plain","toolchain"],"struct":["List","Node","PackageDetails","PackageManager"]}; \ No newline at end of file diff --git a/main/volta/command/list/struct.List.html b/main/volta/command/list/struct.List.html new file mode 100644 index 000000000..d62733853 --- /dev/null +++ b/main/volta/command/list/struct.List.html @@ -0,0 +1,36 @@ +List in volta::command::list - Rust

Struct volta::command::list::List

source ·
pub(crate) struct List {
+    subcommand: Option<Subcommand>,
+    format: Option<Format>,
+    current: bool,
+    default: bool,
+}

Fields§

§subcommand: Option<Subcommand>

The tool to lookup - all, node, npm, yarn, pnpm, or the name +of a package or binary.

+
§format: Option<Format>

Specify the output format.

+

Defaults to human for TTYs, plain otherwise.

+
§current: bool

Show the currently-active tool(s).

+

Equivalent to volta list when not specifying a specific tool.

+
§default: bool

Show your default tool(s).

+

Implementations§

Trait Implementations§

source§

impl Args for List

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for List

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for List

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for List

§

impl Send for List

§

impl Sync for List

§

impl Unpin for List

§

impl UnwindSafe for List

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/struct.Node.html b/main/volta/command/list/struct.Node.html new file mode 100644 index 000000000..6da2f9c96 --- /dev/null +++ b/main/volta/command/list/struct.Node.html @@ -0,0 +1,16 @@ +Node in volta::command::list - Rust

Struct volta::command::list::Node

source ·
struct Node {
+    pub source: Source,
+    pub version: Version,
+}

Fields§

§source: Source§version: Version

Trait Implementations§

source§

impl Clone for Node

source§

fn clone(&self) -> Node

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnwindSafe for Node

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/struct.PackageDetails.html b/main/volta/command/list/struct.PackageDetails.html new file mode 100644 index 000000000..c66c57194 --- /dev/null +++ b/main/volta/command/list/struct.PackageDetails.html @@ -0,0 +1,19 @@ +PackageDetails in volta::command::list - Rust
struct PackageDetails {
+    pub name: String,
+    pub version: Version,
+}
Expand description

A package and its associated tools, for displaying to the user as part of +their toolchain.

+

Fields§

§name: String

The name of the package.

+
§version: Version

The package’s own version.

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/struct.PackageManager.html b/main/volta/command/list/struct.PackageManager.html new file mode 100644 index 000000000..c02f3e8c9 --- /dev/null +++ b/main/volta/command/list/struct.PackageManager.html @@ -0,0 +1,17 @@ +PackageManager in volta::command::list - Rust
struct PackageManager {
+    kind: PackageManagerKind,
+    source: Source,
+    version: Version,
+}

Fields§

§kind: PackageManagerKind§source: Source§version: Version

Trait Implementations§

source§

impl Clone for PackageManager

source§

fn clone(&self) -> PackageManager

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/toolchain/enum.Lookup.html b/main/volta/command/list/toolchain/enum.Lookup.html new file mode 100644 index 000000000..56ef29e00 --- /dev/null +++ b/main/volta/command/list/toolchain/enum.Lookup.html @@ -0,0 +1,32 @@ +Lookup in volta::command::list::toolchain - Rust
enum Lookup {
+    Runtime,
+    Npm,
+    Pnpm,
+    Yarn,
+}
Expand description

Lightweight rule for which item to get the Source for.

+

Variants§

§

Runtime

Look up the Node runtime

+
§

Npm

Look up the npm package manager

+
§

Pnpm

Look up the pnpm package manager

+
§

Yarn

Look up the Yarn package manager

+

Implementations§

source§

impl Lookup

source

fn version_from_spec(&self) -> impl Fn(&PlatformSpec) -> Option<Version> + '_

source

fn version_source( + self, + project: Option<&Project>, + default_platform: Option<&PlatformSpec>, + version: &Version +) -> Source

source

fn active_tool( + self, + project: Option<&Project>, + default: Option<&PlatformSpec> +) -> Option<(Source, Version)>

Determine the Source for a given kind of tool (Lookup).

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/toolchain/enum.Toolchain.html b/main/volta/command/list/toolchain/enum.Toolchain.html new file mode 100644 index 000000000..975a853cc --- /dev/null +++ b/main/volta/command/list/toolchain/enum.Toolchain.html @@ -0,0 +1,59 @@ +Toolchain in volta::command::list::toolchain - Rust
pub(super) enum Toolchain {
+    Node(Vec<Node>),
+    PackageManagers {
+        kind: PackageManagerKind,
+        managers: Vec<PackageManager>,
+    },
+    Packages(Vec<Package>),
+    Tool {
+        name: String,
+        host_packages: Vec<Package>,
+    },
+    Active {
+        runtime: Option<Box<Node>>,
+        package_managers: Vec<PackageManager>,
+        packages: Vec<Package>,
+    },
+    All {
+        runtimes: Vec<Node>,
+        package_managers: Vec<PackageManager>,
+        packages: Vec<Package>,
+    },
+}

Variants§

§

Node(Vec<Node>)

§

PackageManagers

§

Packages(Vec<Package>)

§

Tool

Fields

§name: String
§host_packages: Vec<Package>
§

Active

Fields

§runtime: Option<Box<Node>>
§package_managers: Vec<PackageManager>
§packages: Vec<Package>
§

All

Fields

§runtimes: Vec<Node>
§package_managers: Vec<PackageManager>
§packages: Vec<Package>

Implementations§

source§

impl Toolchain

source

pub(super) fn active( + project: Option<&Project>, + default_platform: Option<&PlatformSpec> +) -> Fallible<Toolchain>

source

pub(super) fn all( + project: Option<&Project>, + default_platform: Option<&PlatformSpec> +) -> Fallible<Toolchain>

source

pub(super) fn node( + project: Option<&Project>, + default_platform: Option<&PlatformSpec>, + filter: &Filter +) -> Fallible<Toolchain>

source

pub(super) fn npm( + project: Option<&Project>, + default_platform: Option<&PlatformSpec>, + filter: &Filter +) -> Fallible<Toolchain>

source

pub(super) fn pnpm( + project: Option<&Project>, + default_platform: Option<&PlatformSpec>, + filter: &Filter +) -> Fallible<Toolchain>

source

pub(super) fn yarn( + project: Option<&Project>, + default_platform: Option<&PlatformSpec>, + filter: &Filter +) -> Fallible<Toolchain>

source

pub(super) fn package_or_tool( + name: &str, + project: Option<&Project>, + filter: &Filter +) -> Fallible<Toolchain>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/list/toolchain/fn.tool_source.html b/main/volta/command/list/toolchain/fn.tool_source.html new file mode 100644 index 000000000..893f9570c --- /dev/null +++ b/main/volta/command/list/toolchain/fn.tool_source.html @@ -0,0 +1,2 @@ +tool_source in volta::command::list::toolchain - Rust
fn tool_source(name: &str, project: Option<&Project>) -> Fallible<Source>
Expand description

Look up the Source for a tool with a given name.

+
\ No newline at end of file diff --git a/main/volta/command/list/toolchain/index.html b/main/volta/command/list/toolchain/index.html new file mode 100644 index 000000000..56ef01d60 --- /dev/null +++ b/main/volta/command/list/toolchain/index.html @@ -0,0 +1 @@ +volta::command::list::toolchain - Rust

Module volta::command::list::toolchain

source ·

Enums

  • Lookup 🔒
    Lightweight rule for which item to get the Source for.
  • Toolchain 🔒

Functions

  • Look up the Source for a tool with a given name.
\ No newline at end of file diff --git a/main/volta/command/list/toolchain/sidebar-items.js b/main/volta/command/list/toolchain/sidebar-items.js new file mode 100644 index 000000000..21f2c7af8 --- /dev/null +++ b/main/volta/command/list/toolchain/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Lookup","Toolchain"],"fn":["tool_source"]}; \ No newline at end of file diff --git a/main/volta/command/pin/index.html b/main/volta/command/pin/index.html new file mode 100644 index 000000000..56558dbac --- /dev/null +++ b/main/volta/command/pin/index.html @@ -0,0 +1 @@ +volta::command::pin - Rust

Module volta::command::pin

source ·

Structs

\ No newline at end of file diff --git a/main/volta/command/pin/sidebar-items.js b/main/volta/command/pin/sidebar-items.js new file mode 100644 index 000000000..37eb67beb --- /dev/null +++ b/main/volta/command/pin/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Pin"]}; \ No newline at end of file diff --git a/main/volta/command/pin/struct.Pin.html b/main/volta/command/pin/struct.Pin.html new file mode 100644 index 000000000..fcc056aac --- /dev/null +++ b/main/volta/command/pin/struct.Pin.html @@ -0,0 +1,27 @@ +Pin in volta::command::pin - Rust

Struct volta::command::pin::Pin

source ·
pub(crate) struct Pin {
+    tools: Vec<String>,
+}

Fields§

§tools: Vec<String>

Tools to pin, like node@lts or yarn@^1.14.

+

Trait Implementations§

source§

impl Args for Pin

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Pin

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Pin

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for Pin

§

impl Send for Pin

§

impl Sync for Pin

§

impl Unpin for Pin

§

impl UnwindSafe for Pin

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/run/index.html b/main/volta/command/run/index.html new file mode 100644 index 000000000..647d1618c --- /dev/null +++ b/main/volta/command/run/index.html @@ -0,0 +1 @@ +volta::command::run - Rust

Module volta::command::run

source ·

Structs

\ No newline at end of file diff --git a/main/volta/command/run/sidebar-items.js b/main/volta/command/run/sidebar-items.js new file mode 100644 index 000000000..b03cbb40e --- /dev/null +++ b/main/volta/command/run/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Run"]}; \ No newline at end of file diff --git a/main/volta/command/run/struct.Run.html b/main/volta/command/run/struct.Run.html new file mode 100644 index 000000000..e0017c2e2 --- /dev/null +++ b/main/volta/command/run/struct.Run.html @@ -0,0 +1,48 @@ +Run in volta::command::run - Rust

Struct volta::command::run::Run

source ·
pub(crate) struct Run {
+    node: Option<String>,
+    npm: Option<String>,
+    bundled_npm: bool,
+    pnpm: Option<String>,
+    no_pnpm: bool,
+    yarn: Option<String>,
+    no_yarn: bool,
+    envs: Vec<String>,
+    command_and_args: Vec<OsString>,
+}

Fields§

§node: Option<String>

Set the custom Node version

+
§npm: Option<String>

Set the custom npm version

+
§bundled_npm: bool

Forces npm to be the version bundled with Node

+
§pnpm: Option<String>

Set the custon pnpm version

+
§no_pnpm: bool

Disables pnpm

+
§yarn: Option<String>

Set the custom Yarn version

+
§no_yarn: bool

Disables Yarn

+
§envs: Vec<String>

Set an environment variable (can be used multiple times)

+
§command_and_args: Vec<OsString>

The command to run, along with any arguments

+

Implementations§

source§

impl Run

source

fn parse_platform(&self, session: &mut Session) -> Fallible<CliPlatform>

Builds a CliPlatform from the provided cli options

+

Will resolve a semver / tag version if necessary

+
source

fn parse_envs(&self) -> HashMap<&str, &str>

Convert the environment variable settings passed to the command line into a map

+

We ignore any setting that doesn’t have a value associated with it +We also ignore the PATH environment variable as that is set when running a command

+

Trait Implementations§

source§

impl Args for Run

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Run

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl Debug for Run

source§

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

Formats the value using the given formatter. Read more
source§

impl FromArgMatches for Run

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for Run

§

impl Send for Run

§

impl Sync for Run

§

impl Unpin for Run

§

impl UnwindSafe for Run

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/setup/index.html b/main/volta/command/setup/index.html new file mode 100644 index 000000000..1eb45ce32 --- /dev/null +++ b/main/volta/command/setup/index.html @@ -0,0 +1 @@ +volta::command::setup - Rust

Module volta::command::setup

source ·

Modules

Structs

\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.add_bash_profiles.html b/main/volta/command/setup/os/fn.add_bash_profiles.html new file mode 100644 index 000000000..e9df17bb8 --- /dev/null +++ b/main/volta/command/setup/os/fn.add_bash_profiles.html @@ -0,0 +1,4 @@ +add_bash_profiles in volta::command::setup::os - Rust
fn add_bash_profiles(home_dir: &Path, shell: &str, profiles: &mut Vec<PathBuf>)
Expand description

Add bash profile scripts, if necessary

+

Note: We only add the bash scripts if they already exist, as creating new files can impact +the processing of existing files in bash (e.g. preventing ~/.profile from being loaded)

+
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.add_fish_profile.html b/main/volta/command/setup/os/fn.add_fish_profile.html new file mode 100644 index 000000000..15c629f5f --- /dev/null +++ b/main/volta/command/setup/os/fn.add_fish_profile.html @@ -0,0 +1,2 @@ +add_fish_profile in volta::command::setup::os - Rust
fn add_fish_profile(home_dir: &Path, shell: &str, profiles: &mut Vec<PathBuf>)
Expand description

Add fish profile scripts, if necessary

+
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.add_zsh_profile.html b/main/volta/command/setup/os/fn.add_zsh_profile.html new file mode 100644 index 000000000..f97aa8833 --- /dev/null +++ b/main/volta/command/setup/os/fn.add_zsh_profile.html @@ -0,0 +1,2 @@ +add_zsh_profile in volta::command::setup::os - Rust
fn add_zsh_profile(home_dir: &Path, shell: &str, profiles: &mut Vec<PathBuf>)
Expand description

Add zsh profile script, if necessary

+
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.determine_profiles.html b/main/volta/command/setup/os/fn.determine_profiles.html new file mode 100644 index 000000000..814b2c652 --- /dev/null +++ b/main/volta/command/setup/os/fn.determine_profiles.html @@ -0,0 +1,3 @@ +determine_profiles in volta::command::setup::os - Rust
fn determine_profiles() -> Fallible<Vec<PathBuf>>
Expand description

Returns a list of profile files to modify / create.

+

Any file in the list should be created if it doesn’t already exist

+
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.format_home.html b/main/volta/command/setup/os/fn.format_home.html new file mode 100644 index 000000000..25882ecae --- /dev/null +++ b/main/volta/command/setup/os/fn.format_home.html @@ -0,0 +1 @@ +format_home in volta::command::setup::os - Rust

Function volta::command::setup::os::format_home

source ·
fn format_home(volta_home: &Path) -> String
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.read_profile_without_volta.html b/main/volta/command/setup/os/fn.read_profile_without_volta.html new file mode 100644 index 000000000..55459cc30 --- /dev/null +++ b/main/volta/command/setup/os/fn.read_profile_without_volta.html @@ -0,0 +1 @@ +read_profile_without_volta in volta::command::setup::os - Rust
fn read_profile_without_volta(path: &Path) -> Option<String>
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.setup_environment.html b/main/volta/command/setup/os/fn.setup_environment.html new file mode 100644 index 000000000..9e55bb42f --- /dev/null +++ b/main/volta/command/setup/os/fn.setup_environment.html @@ -0,0 +1 @@ +setup_environment in volta::command::setup::os - Rust
pub fn setup_environment() -> Fallible<()>
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.write_profile_fish.html b/main/volta/command/setup/os/fn.write_profile_fish.html new file mode 100644 index 000000000..6e345ea6c --- /dev/null +++ b/main/volta/command/setup/os/fn.write_profile_fish.html @@ -0,0 +1,5 @@ +write_profile_fish in volta::command::setup::os - Rust
fn write_profile_fish(
+    path: &Path,
+    contents: String,
+    volta_home: &str
+) -> Result<()>
\ No newline at end of file diff --git a/main/volta/command/setup/os/fn.write_profile_sh.html b/main/volta/command/setup/os/fn.write_profile_sh.html new file mode 100644 index 000000000..1bf52c66e --- /dev/null +++ b/main/volta/command/setup/os/fn.write_profile_sh.html @@ -0,0 +1,5 @@ +write_profile_sh in volta::command::setup::os - Rust
fn write_profile_sh(
+    path: &Path,
+    contents: String,
+    volta_home: &str
+) -> Result<()>
\ No newline at end of file diff --git a/main/volta/command/setup/os/index.html b/main/volta/command/setup/os/index.html new file mode 100644 index 000000000..91f78692d --- /dev/null +++ b/main/volta/command/setup/os/index.html @@ -0,0 +1 @@ +volta::command::setup::os - Rust

Module volta::command::setup::os

source ·

Functions

\ No newline at end of file diff --git a/main/volta/command/setup/os/sidebar-items.js b/main/volta/command/setup/os/sidebar-items.js new file mode 100644 index 000000000..923f62632 --- /dev/null +++ b/main/volta/command/setup/os/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["add_bash_profiles","add_fish_profile","add_zsh_profile","determine_profiles","format_home","read_profile_without_volta","setup_environment","write_profile_fish","write_profile_sh"]}; \ No newline at end of file diff --git a/main/volta/command/setup/sidebar-items.js b/main/volta/command/setup/sidebar-items.js new file mode 100644 index 000000000..aa67001c0 --- /dev/null +++ b/main/volta/command/setup/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["os"],"struct":["Setup"]}; \ No newline at end of file diff --git a/main/volta/command/setup/struct.Setup.html b/main/volta/command/setup/struct.Setup.html new file mode 100644 index 000000000..a9d7fdf39 --- /dev/null +++ b/main/volta/command/setup/struct.Setup.html @@ -0,0 +1,24 @@ +Setup in volta::command::setup - Rust

Struct volta::command::setup::Setup

source ·
pub(crate) struct Setup {}

Trait Implementations§

source§

impl Args for Setup

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Setup

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Setup

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for Setup

§

impl Send for Setup

§

impl Sync for Setup

§

impl Unpin for Setup

§

impl UnwindSafe for Setup

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/sidebar-items.js b/main/volta/command/sidebar-items.js new file mode 100644 index 000000000..93d98bb60 --- /dev/null +++ b/main/volta/command/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["completions","fetch","install","list","pin","run","setup","uninstall","use","which"],"trait":["Command"]}; \ No newline at end of file diff --git a/main/volta/command/trait.Command.html b/main/volta/command/trait.Command.html new file mode 100644 index 000000000..b4e1bdf1c --- /dev/null +++ b/main/volta/command/trait.Command.html @@ -0,0 +1,8 @@ +Command in volta::command - Rust

Trait volta::command::Command

source ·
pub(crate) trait Command: Sized {
+    // Required method
+    fn run(self, session: &mut Session) -> Fallible<ExitCode>;
+}
Expand description

A Volta command.

+

Required Methods§

source

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().

+

Object Safety§

This trait is not object safe.

Implementors§

\ No newline at end of file diff --git a/main/volta/command/uninstall/index.html b/main/volta/command/uninstall/index.html new file mode 100644 index 000000000..bc95649e1 --- /dev/null +++ b/main/volta/command/uninstall/index.html @@ -0,0 +1 @@ +volta::command::uninstall - Rust
\ No newline at end of file diff --git a/main/volta/command/uninstall/sidebar-items.js b/main/volta/command/uninstall/sidebar-items.js new file mode 100644 index 000000000..32f6e85f2 --- /dev/null +++ b/main/volta/command/uninstall/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Uninstall"]}; \ No newline at end of file diff --git a/main/volta/command/uninstall/struct.Uninstall.html b/main/volta/command/uninstall/struct.Uninstall.html new file mode 100644 index 000000000..f4153630b --- /dev/null +++ b/main/volta/command/uninstall/struct.Uninstall.html @@ -0,0 +1,27 @@ +Uninstall in volta::command::uninstall - Rust
pub(crate) struct Uninstall {
+    tool: String,
+}

Fields§

§tool: String

The tool to uninstall, like ember-cli-update, typescript, or

+

Trait Implementations§

source§

impl Args for Uninstall

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Uninstall

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Uninstall

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/use/constant.ADVICE.html b/main/volta/command/use/constant.ADVICE.html new file mode 100644 index 000000000..916f03236 --- /dev/null +++ b/main/volta/command/use/constant.ADVICE.html @@ -0,0 +1,4 @@ +ADVICE in volta::command::use - Rust

Constant volta::command::use::ADVICE

source ·
const ADVICE: &str = "
+    To install a tool in your toolchain, use `volta install`.
+    To pin your project's runtime or package manager, use `volta pin`.
+";
\ No newline at end of file diff --git a/main/volta/command/use/constant.USAGE.html b/main/volta/command/use/constant.USAGE.html new file mode 100644 index 000000000..27bee6f53 --- /dev/null +++ b/main/volta/command/use/constant.USAGE.html @@ -0,0 +1,5 @@ +USAGE in volta::command::use - Rust

Constant volta::command::use::USAGE

source ·
pub(crate) const USAGE: &str = "The subcommand `use` is deprecated.
+
+    To install a tool in your toolchain, use `volta install`.
+    To pin your project's runtime or package manager, use `volta pin`.
+";
\ No newline at end of file diff --git a/main/volta/command/use/index.html b/main/volta/command/use/index.html new file mode 100644 index 000000000..4427e9de3 --- /dev/null +++ b/main/volta/command/use/index.html @@ -0,0 +1 @@ +volta::command::use - Rust

Module volta::command::use

source ·

Structs

Constants

\ No newline at end of file diff --git a/main/volta/command/use/sidebar-items.js b/main/volta/command/use/sidebar-items.js new file mode 100644 index 000000000..8b8ecda5c --- /dev/null +++ b/main/volta/command/use/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["ADVICE","USAGE"],"struct":["Use"]}; \ No newline at end of file diff --git a/main/volta/command/use/struct.Use.html b/main/volta/command/use/struct.Use.html new file mode 100644 index 000000000..2783fbbe4 --- /dev/null +++ b/main/volta/command/use/struct.Use.html @@ -0,0 +1,26 @@ +Use in volta::command::use - Rust

Struct volta::command::use::Use

source ·
pub(crate) struct Use {
+    anything: Vec<String>,
+}

Fields§

§anything: Vec<String>

Trait Implementations§

source§

impl Args for Use

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Use

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Use

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for Use

§

impl Send for Use

§

impl Sync for Use

§

impl Unpin for Use

§

impl UnwindSafe for Use

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/command/which/index.html b/main/volta/command/which/index.html new file mode 100644 index 000000000..c8fc1457e --- /dev/null +++ b/main/volta/command/which/index.html @@ -0,0 +1 @@ +volta::command::which - Rust

Module volta::command::which

source ·

Structs

\ No newline at end of file diff --git a/main/volta/command/which/sidebar-items.js b/main/volta/command/which/sidebar-items.js new file mode 100644 index 000000000..101f72ea6 --- /dev/null +++ b/main/volta/command/which/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Which"]}; \ No newline at end of file diff --git a/main/volta/command/which/struct.Which.html b/main/volta/command/which/struct.Which.html new file mode 100644 index 000000000..713557965 --- /dev/null +++ b/main/volta/command/which/struct.Which.html @@ -0,0 +1,27 @@ +Which in volta::command::which - Rust

Struct volta::command::which::Which

source ·
pub(crate) struct Which {
+    binary: OsString,
+}

Fields§

§binary: OsString

The binary to find, e.g. node or npm

+

Trait Implementations§

source§

impl Args for Which

source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via +[FromArgMatches::from_arg_matches_mut] Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via +[FromArgMatches::update_from_arg_matches_mut] Read more
source§

impl Command for Which

source§

fn run(self, session: &mut Session) -> Fallible<ExitCode>

Executes the command. Returns Ok(true) if the process should return 0, +Ok(false) if the process should return 1, and Err(e) if the process +should return e.exit_code().
source§

impl FromArgMatches for Which

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( + __clap_arg_matches: &mut ArgMatches +) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( + &mut self, + __clap_arg_matches: &ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( + &mut self, + __clap_arg_matches: &mut ArgMatches +) -> Result<(), Error>

Assign values from ArgMatches to self.

Auto Trait Implementations§

§

impl RefUnwindSafe for Which

§

impl Send for Which

§

impl Sync for Which

§

impl Unpin for Which

§

impl UnwindSafe for Which

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/common/enum.Error.html b/main/volta/common/enum.Error.html new file mode 100644 index 000000000..5756bac87 --- /dev/null +++ b/main/volta/common/enum.Error.html @@ -0,0 +1,15 @@ +Error in volta::common - Rust

Enum volta::common::Error

source ·
pub enum Error {
+    Volta(VoltaError),
+    Tool(i32),
+}

Variants§

§

Volta(VoltaError)

§

Tool(i32)

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !Send for Error

§

impl !Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta/common/fn.ensure_layout.html b/main/volta/common/fn.ensure_layout.html new file mode 100644 index 000000000..987468596 --- /dev/null +++ b/main/volta/common/fn.ensure_layout.html @@ -0,0 +1 @@ +ensure_layout in volta::common - Rust

Function volta::common::ensure_layout

source ·
pub fn ensure_layout() -> Result<(), Error>
\ No newline at end of file diff --git a/main/volta/common/index.html b/main/volta/common/index.html new file mode 100644 index 000000000..43e3c5255 --- /dev/null +++ b/main/volta/common/index.html @@ -0,0 +1 @@ +volta::common - Rust
\ No newline at end of file diff --git a/main/volta/common/sidebar-items.js b/main/volta/common/sidebar-items.js new file mode 100644 index 000000000..d8d09d593 --- /dev/null +++ b/main/volta/common/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Error"],"fn":["ensure_layout"],"trait":["IntoResult"]}; \ No newline at end of file diff --git a/main/volta/common/trait.IntoResult.html b/main/volta/common/trait.IntoResult.html new file mode 100644 index 000000000..b9638cccb --- /dev/null +++ b/main/volta/common/trait.IntoResult.html @@ -0,0 +1,4 @@ +IntoResult in volta::common - Rust

Trait volta::common::IntoResult

source ·
pub trait IntoResult<T> {
+    // Required method
+    fn into_result(self) -> Result<T, Error>;
+}

Required Methods§

Implementations on Foreign Types§

source§

impl IntoResult<()> for Result<ExitStatus, VoltaError>

Implementors§

\ No newline at end of file diff --git a/main/volta/fn.main.html b/main/volta/fn.main.html new file mode 100644 index 000000000..a98dcf17b --- /dev/null +++ b/main/volta/fn.main.html @@ -0,0 +1,2 @@ +main in volta - Rust

Function volta::main

source ·
pub fn main()
Expand description

The entry point for the volta CLI.

+
\ No newline at end of file diff --git a/main/volta/index.html b/main/volta/index.html new file mode 100644 index 000000000..3236292f4 --- /dev/null +++ b/main/volta/index.html @@ -0,0 +1,2 @@ +volta - Rust

Crate volta

source ·

Modules

Functions

  • The entry point for the volta CLI.
\ No newline at end of file diff --git a/main/volta/sidebar-items.js b/main/volta/sidebar-items.js new file mode 100644 index 000000000..098410b97 --- /dev/null +++ b/main/volta/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["main"],"mod":["cli","command","common"]}; \ No newline at end of file diff --git a/main/volta_core/all.html b/main/volta_core/all.html new file mode 100644 index 000000000..b702292ba --- /dev/null +++ b/main/volta_core/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Macros

Functions

Type Aliases

Statics

Constants

\ No newline at end of file diff --git a/main/volta_core/command/fn.create_command.html b/main/volta_core/command/fn.create_command.html new file mode 100644 index 000000000..ee4efc4cc --- /dev/null +++ b/main/volta_core/command/fn.create_command.html @@ -0,0 +1,2 @@ +create_command in volta_core::command - Rust
pub fn create_command<E>(exe: E) -> Commandwhere
+    E: AsRef<OsStr>,
\ No newline at end of file diff --git a/main/volta_core/command/index.html b/main/volta_core/command/index.html new file mode 100644 index 000000000..ddd9cfe30 --- /dev/null +++ b/main/volta_core/command/index.html @@ -0,0 +1 @@ +volta_core::command - Rust
\ No newline at end of file diff --git a/main/volta_core/command/sidebar-items.js b/main/volta_core/command/sidebar-items.js new file mode 100644 index 000000000..c282f8f27 --- /dev/null +++ b/main/volta_core/command/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["create_command"]}; \ No newline at end of file diff --git a/main/volta_core/constant.VOLTA_FEATURE_PNPM.html b/main/volta_core/constant.VOLTA_FEATURE_PNPM.html new file mode 100644 index 000000000..553f1ad01 --- /dev/null +++ b/main/volta_core/constant.VOLTA_FEATURE_PNPM.html @@ -0,0 +1 @@ +VOLTA_FEATURE_PNPM in volta_core - Rust
pub(crate) const VOLTA_FEATURE_PNPM: &str = "VOLTA_FEATURE_PNPM";
\ No newline at end of file diff --git a/main/volta_core/error/enum.ErrorKind.html b/main/volta_core/error/enum.ErrorKind.html new file mode 100644 index 000000000..9ed4def4d --- /dev/null +++ b/main/volta_core/error/enum.ErrorKind.html @@ -0,0 +1,406 @@ +ErrorKind in volta_core::error - Rust
pub enum ErrorKind {
+
Show 114 variants BinaryAlreadyInstalled { + bin_name: String, + existing_package: String, + new_package: String, + }, + BinaryExecError, + BinaryNotFound { + name: String, + }, + BuildPathError, + BypassError { + command: String, + }, + CannotFetchPackage { + package: String, + }, + CannotPinPackage { + package: String, + }, + CompletionsOutFileError { + path: PathBuf, + }, + ContainingDirError { + path: PathBuf, + }, + CouldNotDetermineTool, + CouldNotStartMigration, + CreateDirError { + dir: PathBuf, + }, + CreateLayoutFileError { + file: PathBuf, + }, + CreateSharedLinkError { + name: String, + }, + CreateTempDirError { + in_dir: PathBuf, + }, + CreateTempFileError { + in_dir: PathBuf, + }, + CurrentDirError, + DeleteDirectoryError { + directory: PathBuf, + }, + DeleteFileError { + file: PathBuf, + }, + DeprecatedCommandError { + command: String, + advice: String, + }, + DownloadToolNetworkError { + tool: Spec, + from_url: String, + }, + ExecuteHookError { + command: String, + }, + ExtensionCycleError { + paths: Vec<PathBuf>, + duplicate: PathBuf, + }, + ExtensionPathError { + path: PathBuf, + }, + HookCommandFailed { + command: String, + }, + HookMultipleFieldsSpecified, + HookNoFieldsSpecified, + HookPathError { + command: String, + }, + InstalledPackageNameError, + InvalidHookCommand { + command: String, + }, + InvalidHookOutput { + command: String, + }, + InvalidInvocation { + action: String, + name: String, + version: String, + }, + InvalidInvocationOfBareVersion { + action: String, + version: String, + }, + InvalidRegistryFormat { + format: String, + }, + InvalidToolName { + name: String, + errors: Vec<String>, + }, + LockAcquireError, + NoBundledNpm { + command: String, + }, + NoCommandLinePnpm, + NoCommandLineYarn, + NoDefaultNodeVersion { + tool: String, + }, + NodeVersionNotFound { + matching: String, + }, + NoHomeEnvironmentVar, + NoInstallDir, + NoLocalDataDir, + NoPinnedNodeVersion { + tool: String, + }, + NoPlatform, + NoProjectNodeInManifest, + NoProjectYarn, + NoProjectPnpm, + NoShellProfile { + env_profile: String, + bin_dir: PathBuf, + }, + NotInPackage, + NoDefaultYarn, + NoDefaultPnpm, + NpmLinkMissingPackage { + package: String, + }, + NpmLinkWrongManager { + package: String, + }, + NpmVersionNotFound { + matching: String, + }, + NpxNotAvailable { + version: String, + }, + PackageInstallFailed { + package: String, + }, + PackageManifestParseError { + package: String, + }, + PackageManifestReadError { + package: String, + }, + PackageNotFound { + package: String, + }, + PackageParseError { + file: PathBuf, + }, + PackageReadError { + file: PathBuf, + }, + PackageUnpackError, + PackageWriteError { + file: PathBuf, + }, + ParseBinConfigError, + ParseHooksError { + file: PathBuf, + }, + ParseNodeIndexCacheError, + ParseNodeIndexError { + from_url: String, + }, + ParseNodeIndexExpiryError, + ParseNpmManifestError, + ParsePackageConfigError, + ParsePlatformError, + ParseToolSpecError { + tool_spec: String, + }, + PersistInventoryError { + tool: String, + }, + PnpmVersionNotFound { + matching: String, + }, + ProjectLocalBinaryExecError { + command: String, + }, + ProjectLocalBinaryNotFound { + command: String, + }, + PublishHookBothUrlAndBin, + PublishHookNeitherUrlNorBin, + ReadBinConfigDirError { + dir: PathBuf, + }, + ReadBinConfigError { + file: PathBuf, + }, + ReadDefaultNpmError { + file: PathBuf, + }, + ReadDirError { + dir: PathBuf, + }, + ReadHooksError { + file: PathBuf, + }, + ReadNodeIndexCacheError { + file: PathBuf, + }, + ReadNodeIndexExpiryError { + file: PathBuf, + }, + ReadNpmManifestError, + ReadPackageConfigError { + file: PathBuf, + }, + ReadPlatformError { + file: PathBuf, + }, + RegistryFetchError { + tool: String, + from_url: String, + }, + RunShimDirectly, + SetToolExecutable { + tool: String, + }, + SetupToolImageError { + tool: String, + version: String, + dir: PathBuf, + }, + ShimCreateError { + name: String, + }, + ShimRemoveError { + name: String, + }, + StringifyBinConfigError, + StringifyPackageConfigError, + StringifyPlatformError, + Unimplemented { + feature: String, + }, + UnpackArchiveError { + tool: String, + version: String, + }, + UpgradePackageNotFound { + package: String, + manager: PackageManager, + }, + UpgradePackageWrongManager { + package: String, + manager: PackageManager, + }, + VersionParseError { + version: String, + }, + WriteBinConfigError { + file: PathBuf, + }, + WriteDefaultNpmError { + file: PathBuf, + }, + WriteLauncherError { + tool: String, + }, + WriteNodeIndexCacheError { + file: PathBuf, + }, + WriteNodeIndexExpiryError { + file: PathBuf, + }, + WritePackageConfigError { + file: PathBuf, + }, + WritePlatformError { + file: PathBuf, + }, + Yarn2NotSupported, + YarnLatestFetchError { + from_url: String, + }, + YarnVersionNotFound { + matching: String, + }, +
}

Variants§

§

BinaryAlreadyInstalled

Fields

§bin_name: String
§existing_package: String
§new_package: String

Thrown when package tries to install a binary that is already installed.

+
§

BinaryExecError

Thrown when executing an external binary fails

+
§

BinaryNotFound

Fields

§name: String

Thrown when a binary could not be found in the local inventory

+
§

BuildPathError

Thrown when building the virtual environment path fails

+
§

BypassError

Fields

§command: String

Thrown when unable to launch a command with VOLTA_BYPASS set

+
§

CannotFetchPackage

Fields

§package: String

Thrown when a user tries to volta fetch something other than node/yarn/npm.

+
§

CannotPinPackage

Fields

§package: String

Thrown when a user tries to volta pin something other than node/yarn/npm.

+
§

CompletionsOutFileError

Fields

§path: PathBuf

Thrown when the Completions out-dir is not a directory

+
§

ContainingDirError

Fields

§path: PathBuf

Thrown when the containing directory could not be determined

+
§

CouldNotDetermineTool

§

CouldNotStartMigration

Thrown when unable to start the migration executable

+
§

CreateDirError

Fields

§

CreateLayoutFileError

Fields

§file: PathBuf

Thrown when unable to create the layout file

+
§

CreateSharedLinkError

Fields

§name: String

Thrown when unable to create a link to the shared global library directory

+
§

CreateTempDirError

Fields

§in_dir: PathBuf

Thrown when creating a temporary directory fails

+
§

CreateTempFileError

Fields

§in_dir: PathBuf

Thrown when creating a temporary file fails

+
§

CurrentDirError

§

DeleteDirectoryError

Fields

§directory: PathBuf

Thrown when deleting a directory fails

+
§

DeleteFileError

Fields

§file: PathBuf

Thrown when deleting a file fails

+
§

DeprecatedCommandError

Fields

§command: String
§advice: String
§

DownloadToolNetworkError

Fields

§tool: Spec
§from_url: String
§

ExecuteHookError

Fields

§command: String

Thrown when unable to execute a hook command

+
§

ExtensionCycleError

Fields

§paths: Vec<PathBuf>
§duplicate: PathBuf

Thrown when volta.extends keys result in an infinite cycle

+
§

ExtensionPathError

Fields

§path: PathBuf

Thrown when determining the path to an extension manifest fails

+
§

HookCommandFailed

Fields

§command: String

Thrown when a hook command returns a non-zero exit code

+
§

HookMultipleFieldsSpecified

Thrown when a hook contains multiple fields (prefix, template, or bin)

+
§

HookNoFieldsSpecified

Thrown when a hook doesn’t contain any of the known fields (prefix, template, or bin)

+
§

HookPathError

Fields

§command: String

Thrown when determining the path to a hook fails

+
§

InstalledPackageNameError

Thrown when determining the name of a newly-installed package fails

+
§

InvalidHookCommand

Fields

§command: String
§

InvalidHookOutput

Fields

§command: String

Thrown when output from a hook command could not be read

+
§

InvalidInvocation

Fields

§action: String
§name: String
§version: String

Thrown when a user does e.g. volta install node 12 instead of +volta install node@12.

+
§

InvalidInvocationOfBareVersion

Fields

§action: String
§version: String

Thrown when a user does e.g. volta install 12 instead of +volta install node@12.

+
§

InvalidRegistryFormat

Fields

§format: String

Thrown when a format other than “npm” or “github” is given for yarn.index in the hooks

+
§

InvalidToolName

Fields

§name: String
§errors: Vec<String>

Thrown when a tool name is invalid per npm’s rules.

+
§

LockAcquireError

Thrown when unable to acquire a lock on the Volta directory

+
§

NoBundledNpm

Fields

§command: String

Thrown when pinning or installing npm@bundled and couldn’t detect the bundled version

+
§

NoCommandLinePnpm

Thrown when pnpm is not set at the command-line

+
§

NoCommandLineYarn

Thrown when Yarn is not set at the command-line

+
§

NoDefaultNodeVersion

Fields

§tool: String

Thrown when a user tries to install a Yarn or npm version before installing a Node version.

+
§

NodeVersionNotFound

Fields

§matching: String

Thrown when there is no Node version matching a requested semver specifier.

+
§

NoHomeEnvironmentVar

§

NoInstallDir

Thrown when the install dir could not be determined

+
§

NoLocalDataDir

§

NoPinnedNodeVersion

Fields

§tool: String

Thrown when a user tries to pin a npm, pnpm, or Yarn version before pinning a Node version.

+
§

NoPlatform

Thrown when the platform (Node version) could not be determined

+
§

NoProjectNodeInManifest

Thrown when parsing the project manifest and there is a "volta" key without Node

+
§

NoProjectYarn

Thrown when Yarn is not set in a project

+
§

NoProjectPnpm

Thrown when pnpm is not set in a project

+
§

NoShellProfile

Fields

§env_profile: String
§bin_dir: PathBuf

Thrown when no shell profiles could be found

+
§

NotInPackage

Thrown when the user tries to pin Node or Yarn versions outside of a package.

+
§

NoDefaultYarn

Thrown when default Yarn is not set

+
§

NoDefaultPnpm

Thrown when default pnpm is not set

+
§

NpmLinkMissingPackage

Fields

§package: String

Thrown when npm link is called with a package that isn’t available

+
§

NpmLinkWrongManager

Fields

§package: String

Thrown when npm link is called with a package that was not installed / linked with npm

+
§

NpmVersionNotFound

Fields

§matching: String

Thrown when there is no npm version matching the requested Semver/Tag

+
§

NpxNotAvailable

Fields

§version: String
§

PackageInstallFailed

Fields

§package: String

Thrown when the command to install a global package is not successful

+
§

PackageManifestParseError

Fields

§package: String

Thrown when parsing the package manifest fails

+
§

PackageManifestReadError

Fields

§package: String

Thrown when reading the package manifest fails

+
§

PackageNotFound

Fields

§package: String

Thrown when a specified package could not be found on the npm registry

+
§

PackageParseError

Fields

§file: PathBuf

Thrown when parsing a package manifest fails

+
§

PackageReadError

Fields

§file: PathBuf

Thrown when reading a package manifest fails

+
§

PackageUnpackError

Thrown when a package has been unpacked but is not formed correctly.

+
§

PackageWriteError

Fields

§file: PathBuf

Thrown when writing a package manifest fails

+
§

ParseBinConfigError

Thrown when unable to parse a bin config file

+
§

ParseHooksError

Fields

§file: PathBuf

Thrown when unable to parse a hooks.json file

+
§

ParseNodeIndexCacheError

Thrown when unable to parse the node index cache

+
§

ParseNodeIndexError

Fields

§from_url: String

Thrown when unable to parse the node index

+
§

ParseNodeIndexExpiryError

Thrown when unable to parse the node index cache expiration

+
§

ParseNpmManifestError

Thrown when unable to parse the npm manifest file from a node install

+
§

ParsePackageConfigError

Thrown when unable to parse a package configuration

+
§

ParsePlatformError

Thrown when unable to parse the platform.json file

+
§

ParseToolSpecError

Fields

§tool_spec: String

Thrown when unable to parse a tool spec (<tool>[@<version>])

+
§

PersistInventoryError

Fields

§tool: String

Thrown when persisting an archive to the inventory fails

+
§

PnpmVersionNotFound

Fields

§matching: String

Thrown when there is no pnpm version matching a requested semver specifier.

+
§

ProjectLocalBinaryExecError

Fields

§command: String

Thrown when executing a project-local binary fails

+
§

ProjectLocalBinaryNotFound

Fields

§command: String

Thrown when a project-local binary could not be found

+
§

PublishHookBothUrlAndBin

Thrown when a publish hook contains both the url and bin fields

+
§

PublishHookNeitherUrlNorBin

Thrown when a publish hook contains neither url nor bin fields

+
§

ReadBinConfigDirError

Fields

Thrown when there was an error reading the user bin directory

+
§

ReadBinConfigError

Fields

§file: PathBuf

Thrown when there was an error reading the config for a binary

+
§

ReadDefaultNpmError

Fields

§file: PathBuf

Thrown when unable to read the default npm version file

+
§

ReadDirError

Fields

Thrown when unable to read the contents of a directory

+
§

ReadHooksError

Fields

§file: PathBuf

Thrown when there was an error opening a hooks.json file

+
§

ReadNodeIndexCacheError

Fields

§file: PathBuf

Thrown when there was an error reading the Node Index Cache

+
§

ReadNodeIndexExpiryError

Fields

§file: PathBuf

Thrown when there was an error reading the Node Index Cache Expiration

+
§

ReadNpmManifestError

Thrown when there was an error reading the npm manifest file

+
§

ReadPackageConfigError

Fields

§file: PathBuf

Thrown when there was an error reading a package configuration file

+
§

ReadPlatformError

Fields

§file: PathBuf

Thrown when there was an error opening the user platform file

+
§

RegistryFetchError

Fields

§tool: String
§from_url: String

Thrown when the public registry for Node or Yarn could not be downloaded.

+
§

RunShimDirectly

Thrown when the shim binary is called directly, not through a symlink

+
§

SetToolExecutable

Fields

§tool: String

Thrown when there was an error setting a tool to executable

+
§

SetupToolImageError

Fields

§tool: String
§version: String

Thrown when there was an error copying an unpacked tool to the image directory

+
§

ShimCreateError

Fields

§name: String

Thrown when Volta is unable to create a shim

+
§

ShimRemoveError

Fields

§name: String

Thrown when Volta is unable to remove a shim

+
§

StringifyBinConfigError

Thrown when serializing a bin config to JSON fails

+
§

StringifyPackageConfigError

Thrown when serializing a package config to JSON fails

+
§

StringifyPlatformError

Thrown when serializing the platform to JSON fails

+
§

Unimplemented

Fields

§feature: String

Thrown when a given feature has not yet been implemented

+
§

UnpackArchiveError

Fields

§tool: String
§version: String

Thrown when unpacking an archive (tarball or zip) fails

+
§

UpgradePackageNotFound

Fields

§package: String

Thrown when a package to upgrade was not found

+
§

UpgradePackageWrongManager

Fields

§package: String

Thrown when a package to upgrade was installed with a different package manager

+
§

VersionParseError

Fields

§version: String
§

WriteBinConfigError

Fields

§file: PathBuf

Thrown when there was an error writing a bin config file

+
§

WriteDefaultNpmError

Fields

§file: PathBuf

Thrown when there was an error writing the default npm to file

+
§

WriteLauncherError

Fields

§tool: String

Thrown when there was an error writing the npm launcher

+
§

WriteNodeIndexCacheError

Fields

§file: PathBuf

Thrown when there was an error writing the node index cache

+
§

WriteNodeIndexExpiryError

Fields

§file: PathBuf

Thrown when there was an error writing the node index expiration

+
§

WritePackageConfigError

Fields

§file: PathBuf

Thrown when there was an error writing a package config

+
§

WritePlatformError

Fields

§file: PathBuf

Thrown when writing the platform.json file fails

+
§

Yarn2NotSupported

Thrown when a user attempts to install a version of Yarn2

+
§

YarnLatestFetchError

Fields

§from_url: String

Thrown when there is an error fetching the latest version of Yarn

+
§

YarnVersionNotFound

Fields

§matching: String

Thrown when there is no Yarn version matching a requested semver specifier.

+

Implementations§

Trait Implementations§

source§

impl Debug for ErrorKind

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ErrorKind

source§

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

Formats the value using the given formatter. Read more
source§

impl From<ErrorKind> for VoltaError

source§

fn from(kind: ErrorKind) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/error/enum.ExitCode.html b/main/volta_core/error/enum.ExitCode.html new file mode 100644 index 000000000..c1dfef70c --- /dev/null +++ b/main/volta_core/error/enum.ExitCode.html @@ -0,0 +1,37 @@ +ExitCode in volta_core::error - Rust
pub enum ExitCode {
+    Success = 0,
+    UnknownError = 1,
+    InvalidArguments = 3,
+    NoVersionMatch = 4,
+    NetworkError = 5,
+    EnvironmentError = 6,
+    FileSystemError = 7,
+    ConfigurationError = 8,
+    NotYetImplemented = 9,
+    ExecutionFailure = 126,
+    ExecutableNotFound = 127,
+}
Expand description

Exit codes supported by Volta Errors

+

Variants§

§

Success = 0

No error occurred.

+
§

UnknownError = 1

An unknown error occurred.

+
§

InvalidArguments = 3

An invalid combination of command-line arguments was supplied.

+
§

NoVersionMatch = 4

No match could be found for the requested version string.

+
§

NetworkError = 5

A network error occurred.

+
§

EnvironmentError = 6

A required environment variable was unset or invalid.

+
§

FileSystemError = 7

A file could not be read or written.

+
§

ConfigurationError = 8

Package configuration is missing or incorrect.

+
§

NotYetImplemented = 9

The command or feature is not yet implemented.

+
§

ExecutionFailure = 126

The requested executable could not be run.

+
§

ExecutableNotFound = 127

The requested executable is not available.

+

Implementations§

source§

impl ExitCode

source

pub fn exit(self) -> !

Trait Implementations§

source§

impl Clone for ExitCode

source§

fn clone(&self) -> ExitCode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ExitCode

source§

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

Formats the value using the given formatter. Read more
source§

impl Copy for ExitCode

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/error/fn.report_error.html b/main/volta_core/error/fn.report_error.html new file mode 100644 index 000000000..03cdfcb10 --- /dev/null +++ b/main/volta_core/error/fn.report_error.html @@ -0,0 +1,2 @@ +report_error in volta_core::error - Rust

Function volta_core::error::report_error

source ·
pub fn report_error(volta_version: &str, err: &VoltaError)
Expand description

Report an error, both to the console and to error logs

+
\ No newline at end of file diff --git a/main/volta_core/error/index.html b/main/volta_core/error/index.html new file mode 100644 index 000000000..c17257cdc --- /dev/null +++ b/main/volta_core/error/index.html @@ -0,0 +1 @@ +volta_core::error - Rust

Module volta_core::error

source ·

Modules

Structs

Enums

Traits

  • Trait providing the with_context method to easily convert any Result error into a VoltaError

Functions

  • Report an error, both to the console and to error logs

Type Aliases

\ No newline at end of file diff --git a/main/volta_core/error/kind/constant.PERMISSIONS_CTA.html b/main/volta_core/error/kind/constant.PERMISSIONS_CTA.html new file mode 100644 index 000000000..82708e3a8 --- /dev/null +++ b/main/volta_core/error/kind/constant.PERMISSIONS_CTA.html @@ -0,0 +1 @@ +PERMISSIONS_CTA in volta_core::error::kind - Rust
const PERMISSIONS_CTA: &str = "Please ensure you have correct permissions to the Volta directory.";
\ No newline at end of file diff --git a/main/volta_core/error/kind/constant.REPORT_BUG_CTA.html b/main/volta_core/error/kind/constant.REPORT_BUG_CTA.html new file mode 100644 index 000000000..c29e4710d --- /dev/null +++ b/main/volta_core/error/kind/constant.REPORT_BUG_CTA.html @@ -0,0 +1,3 @@ +REPORT_BUG_CTA in volta_core::error::kind - Rust
const REPORT_BUG_CTA: &str = "Please rerun the command that triggered this error with the environment
+variable `VOLTA_LOGLEVEL` set to `debug` and open an issue at
+https://github.com/volta-cli/volta/issues with the details!";
\ No newline at end of file diff --git a/main/volta_core/error/kind/enum.ErrorKind.html b/main/volta_core/error/kind/enum.ErrorKind.html new file mode 100644 index 000000000..83290c2a4 --- /dev/null +++ b/main/volta_core/error/kind/enum.ErrorKind.html @@ -0,0 +1,406 @@ +ErrorKind in volta_core::error::kind - Rust
pub enum ErrorKind {
+
Show 114 variants BinaryAlreadyInstalled { + bin_name: String, + existing_package: String, + new_package: String, + }, + BinaryExecError, + BinaryNotFound { + name: String, + }, + BuildPathError, + BypassError { + command: String, + }, + CannotFetchPackage { + package: String, + }, + CannotPinPackage { + package: String, + }, + CompletionsOutFileError { + path: PathBuf, + }, + ContainingDirError { + path: PathBuf, + }, + CouldNotDetermineTool, + CouldNotStartMigration, + CreateDirError { + dir: PathBuf, + }, + CreateLayoutFileError { + file: PathBuf, + }, + CreateSharedLinkError { + name: String, + }, + CreateTempDirError { + in_dir: PathBuf, + }, + CreateTempFileError { + in_dir: PathBuf, + }, + CurrentDirError, + DeleteDirectoryError { + directory: PathBuf, + }, + DeleteFileError { + file: PathBuf, + }, + DeprecatedCommandError { + command: String, + advice: String, + }, + DownloadToolNetworkError { + tool: Spec, + from_url: String, + }, + ExecuteHookError { + command: String, + }, + ExtensionCycleError { + paths: Vec<PathBuf>, + duplicate: PathBuf, + }, + ExtensionPathError { + path: PathBuf, + }, + HookCommandFailed { + command: String, + }, + HookMultipleFieldsSpecified, + HookNoFieldsSpecified, + HookPathError { + command: String, + }, + InstalledPackageNameError, + InvalidHookCommand { + command: String, + }, + InvalidHookOutput { + command: String, + }, + InvalidInvocation { + action: String, + name: String, + version: String, + }, + InvalidInvocationOfBareVersion { + action: String, + version: String, + }, + InvalidRegistryFormat { + format: String, + }, + InvalidToolName { + name: String, + errors: Vec<String>, + }, + LockAcquireError, + NoBundledNpm { + command: String, + }, + NoCommandLinePnpm, + NoCommandLineYarn, + NoDefaultNodeVersion { + tool: String, + }, + NodeVersionNotFound { + matching: String, + }, + NoHomeEnvironmentVar, + NoInstallDir, + NoLocalDataDir, + NoPinnedNodeVersion { + tool: String, + }, + NoPlatform, + NoProjectNodeInManifest, + NoProjectYarn, + NoProjectPnpm, + NoShellProfile { + env_profile: String, + bin_dir: PathBuf, + }, + NotInPackage, + NoDefaultYarn, + NoDefaultPnpm, + NpmLinkMissingPackage { + package: String, + }, + NpmLinkWrongManager { + package: String, + }, + NpmVersionNotFound { + matching: String, + }, + NpxNotAvailable { + version: String, + }, + PackageInstallFailed { + package: String, + }, + PackageManifestParseError { + package: String, + }, + PackageManifestReadError { + package: String, + }, + PackageNotFound { + package: String, + }, + PackageParseError { + file: PathBuf, + }, + PackageReadError { + file: PathBuf, + }, + PackageUnpackError, + PackageWriteError { + file: PathBuf, + }, + ParseBinConfigError, + ParseHooksError { + file: PathBuf, + }, + ParseNodeIndexCacheError, + ParseNodeIndexError { + from_url: String, + }, + ParseNodeIndexExpiryError, + ParseNpmManifestError, + ParsePackageConfigError, + ParsePlatformError, + ParseToolSpecError { + tool_spec: String, + }, + PersistInventoryError { + tool: String, + }, + PnpmVersionNotFound { + matching: String, + }, + ProjectLocalBinaryExecError { + command: String, + }, + ProjectLocalBinaryNotFound { + command: String, + }, + PublishHookBothUrlAndBin, + PublishHookNeitherUrlNorBin, + ReadBinConfigDirError { + dir: PathBuf, + }, + ReadBinConfigError { + file: PathBuf, + }, + ReadDefaultNpmError { + file: PathBuf, + }, + ReadDirError { + dir: PathBuf, + }, + ReadHooksError { + file: PathBuf, + }, + ReadNodeIndexCacheError { + file: PathBuf, + }, + ReadNodeIndexExpiryError { + file: PathBuf, + }, + ReadNpmManifestError, + ReadPackageConfigError { + file: PathBuf, + }, + ReadPlatformError { + file: PathBuf, + }, + RegistryFetchError { + tool: String, + from_url: String, + }, + RunShimDirectly, + SetToolExecutable { + tool: String, + }, + SetupToolImageError { + tool: String, + version: String, + dir: PathBuf, + }, + ShimCreateError { + name: String, + }, + ShimRemoveError { + name: String, + }, + StringifyBinConfigError, + StringifyPackageConfigError, + StringifyPlatformError, + Unimplemented { + feature: String, + }, + UnpackArchiveError { + tool: String, + version: String, + }, + UpgradePackageNotFound { + package: String, + manager: PackageManager, + }, + UpgradePackageWrongManager { + package: String, + manager: PackageManager, + }, + VersionParseError { + version: String, + }, + WriteBinConfigError { + file: PathBuf, + }, + WriteDefaultNpmError { + file: PathBuf, + }, + WriteLauncherError { + tool: String, + }, + WriteNodeIndexCacheError { + file: PathBuf, + }, + WriteNodeIndexExpiryError { + file: PathBuf, + }, + WritePackageConfigError { + file: PathBuf, + }, + WritePlatformError { + file: PathBuf, + }, + Yarn2NotSupported, + YarnLatestFetchError { + from_url: String, + }, + YarnVersionNotFound { + matching: String, + }, +
}

Variants§

§

BinaryAlreadyInstalled

Fields

§bin_name: String
§existing_package: String
§new_package: String

Thrown when package tries to install a binary that is already installed.

+
§

BinaryExecError

Thrown when executing an external binary fails

+
§

BinaryNotFound

Fields

§name: String

Thrown when a binary could not be found in the local inventory

+
§

BuildPathError

Thrown when building the virtual environment path fails

+
§

BypassError

Fields

§command: String

Thrown when unable to launch a command with VOLTA_BYPASS set

+
§

CannotFetchPackage

Fields

§package: String

Thrown when a user tries to volta fetch something other than node/yarn/npm.

+
§

CannotPinPackage

Fields

§package: String

Thrown when a user tries to volta pin something other than node/yarn/npm.

+
§

CompletionsOutFileError

Fields

§path: PathBuf

Thrown when the Completions out-dir is not a directory

+
§

ContainingDirError

Fields

§path: PathBuf

Thrown when the containing directory could not be determined

+
§

CouldNotDetermineTool

§

CouldNotStartMigration

Thrown when unable to start the migration executable

+
§

CreateDirError

Fields

§

CreateLayoutFileError

Fields

§file: PathBuf

Thrown when unable to create the layout file

+
§

CreateSharedLinkError

Fields

§name: String

Thrown when unable to create a link to the shared global library directory

+
§

CreateTempDirError

Fields

§in_dir: PathBuf

Thrown when creating a temporary directory fails

+
§

CreateTempFileError

Fields

§in_dir: PathBuf

Thrown when creating a temporary file fails

+
§

CurrentDirError

§

DeleteDirectoryError

Fields

§directory: PathBuf

Thrown when deleting a directory fails

+
§

DeleteFileError

Fields

§file: PathBuf

Thrown when deleting a file fails

+
§

DeprecatedCommandError

Fields

§command: String
§advice: String
§

DownloadToolNetworkError

Fields

§tool: Spec
§from_url: String
§

ExecuteHookError

Fields

§command: String

Thrown when unable to execute a hook command

+
§

ExtensionCycleError

Fields

§paths: Vec<PathBuf>
§duplicate: PathBuf

Thrown when volta.extends keys result in an infinite cycle

+
§

ExtensionPathError

Fields

§path: PathBuf

Thrown when determining the path to an extension manifest fails

+
§

HookCommandFailed

Fields

§command: String

Thrown when a hook command returns a non-zero exit code

+
§

HookMultipleFieldsSpecified

Thrown when a hook contains multiple fields (prefix, template, or bin)

+
§

HookNoFieldsSpecified

Thrown when a hook doesn’t contain any of the known fields (prefix, template, or bin)

+
§

HookPathError

Fields

§command: String

Thrown when determining the path to a hook fails

+
§

InstalledPackageNameError

Thrown when determining the name of a newly-installed package fails

+
§

InvalidHookCommand

Fields

§command: String
§

InvalidHookOutput

Fields

§command: String

Thrown when output from a hook command could not be read

+
§

InvalidInvocation

Fields

§action: String
§name: String
§version: String

Thrown when a user does e.g. volta install node 12 instead of +volta install node@12.

+
§

InvalidInvocationOfBareVersion

Fields

§action: String
§version: String

Thrown when a user does e.g. volta install 12 instead of +volta install node@12.

+
§

InvalidRegistryFormat

Fields

§format: String

Thrown when a format other than “npm” or “github” is given for yarn.index in the hooks

+
§

InvalidToolName

Fields

§name: String
§errors: Vec<String>

Thrown when a tool name is invalid per npm’s rules.

+
§

LockAcquireError

Thrown when unable to acquire a lock on the Volta directory

+
§

NoBundledNpm

Fields

§command: String

Thrown when pinning or installing npm@bundled and couldn’t detect the bundled version

+
§

NoCommandLinePnpm

Thrown when pnpm is not set at the command-line

+
§

NoCommandLineYarn

Thrown when Yarn is not set at the command-line

+
§

NoDefaultNodeVersion

Fields

§tool: String

Thrown when a user tries to install a Yarn or npm version before installing a Node version.

+
§

NodeVersionNotFound

Fields

§matching: String

Thrown when there is no Node version matching a requested semver specifier.

+
§

NoHomeEnvironmentVar

§

NoInstallDir

Thrown when the install dir could not be determined

+
§

NoLocalDataDir

§

NoPinnedNodeVersion

Fields

§tool: String

Thrown when a user tries to pin a npm, pnpm, or Yarn version before pinning a Node version.

+
§

NoPlatform

Thrown when the platform (Node version) could not be determined

+
§

NoProjectNodeInManifest

Thrown when parsing the project manifest and there is a "volta" key without Node

+
§

NoProjectYarn

Thrown when Yarn is not set in a project

+
§

NoProjectPnpm

Thrown when pnpm is not set in a project

+
§

NoShellProfile

Fields

§env_profile: String
§bin_dir: PathBuf

Thrown when no shell profiles could be found

+
§

NotInPackage

Thrown when the user tries to pin Node or Yarn versions outside of a package.

+
§

NoDefaultYarn

Thrown when default Yarn is not set

+
§

NoDefaultPnpm

Thrown when default pnpm is not set

+
§

NpmLinkMissingPackage

Fields

§package: String

Thrown when npm link is called with a package that isn’t available

+
§

NpmLinkWrongManager

Fields

§package: String

Thrown when npm link is called with a package that was not installed / linked with npm

+
§

NpmVersionNotFound

Fields

§matching: String

Thrown when there is no npm version matching the requested Semver/Tag

+
§

NpxNotAvailable

Fields

§version: String
§

PackageInstallFailed

Fields

§package: String

Thrown when the command to install a global package is not successful

+
§

PackageManifestParseError

Fields

§package: String

Thrown when parsing the package manifest fails

+
§

PackageManifestReadError

Fields

§package: String

Thrown when reading the package manifest fails

+
§

PackageNotFound

Fields

§package: String

Thrown when a specified package could not be found on the npm registry

+
§

PackageParseError

Fields

§file: PathBuf

Thrown when parsing a package manifest fails

+
§

PackageReadError

Fields

§file: PathBuf

Thrown when reading a package manifest fails

+
§

PackageUnpackError

Thrown when a package has been unpacked but is not formed correctly.

+
§

PackageWriteError

Fields

§file: PathBuf

Thrown when writing a package manifest fails

+
§

ParseBinConfigError

Thrown when unable to parse a bin config file

+
§

ParseHooksError

Fields

§file: PathBuf

Thrown when unable to parse a hooks.json file

+
§

ParseNodeIndexCacheError

Thrown when unable to parse the node index cache

+
§

ParseNodeIndexError

Fields

§from_url: String

Thrown when unable to parse the node index

+
§

ParseNodeIndexExpiryError

Thrown when unable to parse the node index cache expiration

+
§

ParseNpmManifestError

Thrown when unable to parse the npm manifest file from a node install

+
§

ParsePackageConfigError

Thrown when unable to parse a package configuration

+
§

ParsePlatformError

Thrown when unable to parse the platform.json file

+
§

ParseToolSpecError

Fields

§tool_spec: String

Thrown when unable to parse a tool spec (<tool>[@<version>])

+
§

PersistInventoryError

Fields

§tool: String

Thrown when persisting an archive to the inventory fails

+
§

PnpmVersionNotFound

Fields

§matching: String

Thrown when there is no pnpm version matching a requested semver specifier.

+
§

ProjectLocalBinaryExecError

Fields

§command: String

Thrown when executing a project-local binary fails

+
§

ProjectLocalBinaryNotFound

Fields

§command: String

Thrown when a project-local binary could not be found

+
§

PublishHookBothUrlAndBin

Thrown when a publish hook contains both the url and bin fields

+
§

PublishHookNeitherUrlNorBin

Thrown when a publish hook contains neither url nor bin fields

+
§

ReadBinConfigDirError

Fields

Thrown when there was an error reading the user bin directory

+
§

ReadBinConfigError

Fields

§file: PathBuf

Thrown when there was an error reading the config for a binary

+
§

ReadDefaultNpmError

Fields

§file: PathBuf

Thrown when unable to read the default npm version file

+
§

ReadDirError

Fields

Thrown when unable to read the contents of a directory

+
§

ReadHooksError

Fields

§file: PathBuf

Thrown when there was an error opening a hooks.json file

+
§

ReadNodeIndexCacheError

Fields

§file: PathBuf

Thrown when there was an error reading the Node Index Cache

+
§

ReadNodeIndexExpiryError

Fields

§file: PathBuf

Thrown when there was an error reading the Node Index Cache Expiration

+
§

ReadNpmManifestError

Thrown when there was an error reading the npm manifest file

+
§

ReadPackageConfigError

Fields

§file: PathBuf

Thrown when there was an error reading a package configuration file

+
§

ReadPlatformError

Fields

§file: PathBuf

Thrown when there was an error opening the user platform file

+
§

RegistryFetchError

Fields

§tool: String
§from_url: String

Thrown when the public registry for Node or Yarn could not be downloaded.

+
§

RunShimDirectly

Thrown when the shim binary is called directly, not through a symlink

+
§

SetToolExecutable

Fields

§tool: String

Thrown when there was an error setting a tool to executable

+
§

SetupToolImageError

Fields

§tool: String
§version: String

Thrown when there was an error copying an unpacked tool to the image directory

+
§

ShimCreateError

Fields

§name: String

Thrown when Volta is unable to create a shim

+
§

ShimRemoveError

Fields

§name: String

Thrown when Volta is unable to remove a shim

+
§

StringifyBinConfigError

Thrown when serializing a bin config to JSON fails

+
§

StringifyPackageConfigError

Thrown when serializing a package config to JSON fails

+
§

StringifyPlatformError

Thrown when serializing the platform to JSON fails

+
§

Unimplemented

Fields

§feature: String

Thrown when a given feature has not yet been implemented

+
§

UnpackArchiveError

Fields

§tool: String
§version: String

Thrown when unpacking an archive (tarball or zip) fails

+
§

UpgradePackageNotFound

Fields

§package: String

Thrown when a package to upgrade was not found

+
§

UpgradePackageWrongManager

Fields

§package: String

Thrown when a package to upgrade was installed with a different package manager

+
§

VersionParseError

Fields

§version: String
§

WriteBinConfigError

Fields

§file: PathBuf

Thrown when there was an error writing a bin config file

+
§

WriteDefaultNpmError

Fields

§file: PathBuf

Thrown when there was an error writing the default npm to file

+
§

WriteLauncherError

Fields

§tool: String

Thrown when there was an error writing the npm launcher

+
§

WriteNodeIndexCacheError

Fields

§file: PathBuf

Thrown when there was an error writing the node index cache

+
§

WriteNodeIndexExpiryError

Fields

§file: PathBuf

Thrown when there was an error writing the node index expiration

+
§

WritePackageConfigError

Fields

§file: PathBuf

Thrown when there was an error writing a package config

+
§

WritePlatformError

Fields

§file: PathBuf

Thrown when writing the platform.json file fails

+
§

Yarn2NotSupported

Thrown when a user attempts to install a version of Yarn2

+
§

YarnLatestFetchError

Fields

§from_url: String

Thrown when there is an error fetching the latest version of Yarn

+
§

YarnVersionNotFound

Fields

§matching: String

Thrown when there is no Yarn version matching a requested semver specifier.

+

Implementations§

Trait Implementations§

source§

impl Debug for ErrorKind

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ErrorKind

source§

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

Formats the value using the given formatter. Read more
source§

impl From<ErrorKind> for VoltaError

source§

fn from(kind: ErrorKind) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/error/kind/index.html b/main/volta_core/error/kind/index.html new file mode 100644 index 000000000..48cd5cd81 --- /dev/null +++ b/main/volta_core/error/kind/index.html @@ -0,0 +1 @@ +volta_core::error::kind - Rust
\ No newline at end of file diff --git a/main/volta_core/error/kind/sidebar-items.js b/main/volta_core/error/kind/sidebar-items.js new file mode 100644 index 000000000..480ce6461 --- /dev/null +++ b/main/volta_core/error/kind/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["PERMISSIONS_CTA","REPORT_BUG_CTA"],"enum":["ErrorKind"]}; \ No newline at end of file diff --git a/main/volta_core/error/reporter/fn.collect_arguments.html b/main/volta_core/error/reporter/fn.collect_arguments.html new file mode 100644 index 000000000..2687988e6 --- /dev/null +++ b/main/volta_core/error/reporter/fn.collect_arguments.html @@ -0,0 +1,2 @@ +collect_arguments in volta_core::error::reporter - Rust
fn collect_arguments() -> String
Expand description

Combines all the arguments into a single String

+
\ No newline at end of file diff --git a/main/volta_core/error/reporter/fn.compose_error_details.html b/main/volta_core/error/reporter/fn.compose_error_details.html new file mode 100644 index 000000000..27c7fe229 --- /dev/null +++ b/main/volta_core/error/reporter/fn.compose_error_details.html @@ -0,0 +1 @@ +compose_error_details in volta_core::error::reporter - Rust
fn compose_error_details(err: &VoltaError) -> Option<String>
\ No newline at end of file diff --git a/main/volta_core/error/reporter/fn.report_error.html b/main/volta_core/error/reporter/fn.report_error.html new file mode 100644 index 000000000..d480b8153 --- /dev/null +++ b/main/volta_core/error/reporter/fn.report_error.html @@ -0,0 +1,2 @@ +report_error in volta_core::error::reporter - Rust
pub fn report_error(volta_version: &str, err: &VoltaError)
Expand description

Report an error, both to the console and to error logs

+
\ No newline at end of file diff --git a/main/volta_core/error/reporter/fn.write_error_log.html b/main/volta_core/error/reporter/fn.write_error_log.html new file mode 100644 index 000000000..430019437 --- /dev/null +++ b/main/volta_core/error/reporter/fn.write_error_log.html @@ -0,0 +1,6 @@ +write_error_log in volta_core::error::reporter - Rust
fn write_error_log(
+    volta_version: &str,
+    message: String,
+    details: String
+) -> Result<PathBuf, Box<dyn Error>>
Expand description

Write an error log with all details about the error

+
\ No newline at end of file diff --git a/main/volta_core/error/reporter/index.html b/main/volta_core/error/reporter/index.html new file mode 100644 index 000000000..901f045df --- /dev/null +++ b/main/volta_core/error/reporter/index.html @@ -0,0 +1 @@ +volta_core::error::reporter - Rust

Module volta_core::error::reporter

source ·

Functions

\ No newline at end of file diff --git a/main/volta_core/error/reporter/sidebar-items.js b/main/volta_core/error/reporter/sidebar-items.js new file mode 100644 index 000000000..65b470105 --- /dev/null +++ b/main/volta_core/error/reporter/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["collect_arguments","compose_error_details","report_error","write_error_log"]}; \ No newline at end of file diff --git a/main/volta_core/error/sidebar-items.js b/main/volta_core/error/sidebar-items.js new file mode 100644 index 000000000..8d657e262 --- /dev/null +++ b/main/volta_core/error/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ErrorKind","ExitCode"],"fn":["report_error"],"mod":["kind","reporter"],"struct":["Inner","VoltaError"],"trait":["Context"],"type":["Fallible"]}; \ No newline at end of file diff --git a/main/volta_core/error/struct.Inner.html b/main/volta_core/error/struct.Inner.html new file mode 100644 index 000000000..d959c36ef --- /dev/null +++ b/main/volta_core/error/struct.Inner.html @@ -0,0 +1,15 @@ +Inner in volta_core::error - Rust

Struct volta_core::error::Inner

source ·
struct Inner {
+    kind: ErrorKind,
+    source: Option<Box<dyn Error>>,
+}

Fields§

§kind: ErrorKind§source: Option<Box<dyn Error>>

Trait Implementations§

source§

impl Debug for Inner

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Inner

§

impl !Send for Inner

§

impl !Sync for Inner

§

impl Unpin for Inner

§

impl !UnwindSafe for Inner

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/error/struct.VoltaError.html b/main/volta_core/error/struct.VoltaError.html new file mode 100644 index 000000000..ad99970de --- /dev/null +++ b/main/volta_core/error/struct.VoltaError.html @@ -0,0 +1,20 @@ +VoltaError in volta_core::error - Rust
pub struct VoltaError {
+    inner: Box<Inner>,
+}
Expand description

Error type for Volta

+

Fields§

§inner: Box<Inner>

Implementations§

source§

impl VoltaError

source

pub fn exit_code(&self) -> ExitCode

The exit code Volta should use when this error stops execution

+
source

pub fn from_source<E>(source: E, kind: ErrorKind) -> Selfwhere + E: Into<Box<dyn Error>>,

Create a new VoltaError instance including a source error

+
source

pub fn kind(&self) -> &ErrorKind

Get a reference to the ErrorKind for this error

+

Trait Implementations§

source§

impl Debug for VoltaError

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for VoltaError

source§

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

Formats the value using the given formatter. Read more
source§

impl Error for VoltaError

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<ErrorKind> for VoltaError

source§

fn from(kind: ErrorKind) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/error/trait.Context.html b/main/volta_core/error/trait.Context.html new file mode 100644 index 000000000..5997922d9 --- /dev/null +++ b/main/volta_core/error/trait.Context.html @@ -0,0 +1,9 @@ +Context in volta_core::error - Rust

Trait volta_core::error::Context

source ·
pub trait Context<T> {
+    // Required method
+    fn with_context<F>(self, f: F) -> Fallible<T>
+       where F: FnOnce() -> ErrorKind;
+}
Expand description

Trait providing the with_context method to easily convert any Result error into a VoltaError

+

Required Methods§

source

fn with_context<F>(self, f: F) -> Fallible<T>where + F: FnOnce() -> ErrorKind,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, E> Context<T> for Result<T, E>where + E: Error + 'static,

source§

fn with_context<F>(self, f: F) -> Fallible<T>where + F: FnOnce() -> ErrorKind,

Implementors§

\ No newline at end of file diff --git a/main/volta_core/error/type.Fallible.html b/main/volta_core/error/type.Fallible.html new file mode 100644 index 000000000..18f65c148 --- /dev/null +++ b/main/volta_core/error/type.Fallible.html @@ -0,0 +1,6 @@ +Fallible in volta_core::error - Rust

Type Alias volta_core::error::Fallible

source ·
pub type Fallible<T> = Result<T, VoltaError>;

Aliased Type§

enum Fallible<T> {
+    Ok(T),
+    Err(VoltaError),
+}

Variants§

§1.0.0

Ok(T)

Contains the success value

+
§1.0.0

Err(VoltaError)

Contains the error value

+
\ No newline at end of file diff --git a/main/volta_core/event/enum.EventKind.html b/main/volta_core/event/enum.EventKind.html new file mode 100644 index 000000000..b4ea2f7d7 --- /dev/null +++ b/main/volta_core/event/enum.EventKind.html @@ -0,0 +1,39 @@ +EventKind in volta_core::event - Rust
pub enum EventKind {
+    Start,
+    End {
+        exit_code: i32,
+    },
+    Error {
+        exit_code: i32,
+        error: String,
+        env: ErrorEnv,
+    },
+    ToolEnd {
+        exit_code: i32,
+    },
+    Args {
+        argv: String,
+    },
+}

Variants§

§

Start

§

End

Fields

§exit_code: i32
§

Error

Fields

§exit_code: i32
§error: String
§

ToolEnd

Fields

§exit_code: i32
§

Args

Fields

§argv: String

Implementations§

source§

impl EventKind

source

pub fn into_event(self, activity_kind: ActivityKind) -> Event

Trait Implementations§

source§

impl Debug for EventKind

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for EventKind

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for EventKind

source§

fn eq(&self, other: &EventKind) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Serialize for EventKind

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for EventKind

source§

impl StructuralEq for EventKind

source§

impl StructuralPartialEq for EventKind

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/event/fn.get_error_env.html b/main/volta_core/event/fn.get_error_env.html new file mode 100644 index 000000000..9024fd9cf --- /dev/null +++ b/main/volta_core/event/fn.get_error_env.html @@ -0,0 +1 @@ +get_error_env in volta_core::event - Rust
fn get_error_env() -> ErrorEnv
\ No newline at end of file diff --git a/main/volta_core/event/fn.unix_timestamp.html b/main/volta_core/event/fn.unix_timestamp.html new file mode 100644 index 000000000..e3700b770 --- /dev/null +++ b/main/volta_core/event/fn.unix_timestamp.html @@ -0,0 +1 @@ +unix_timestamp in volta_core::event - Rust
fn unix_timestamp() -> u64
\ No newline at end of file diff --git a/main/volta_core/event/index.html b/main/volta_core/event/index.html new file mode 100644 index 000000000..fbd39180c --- /dev/null +++ b/main/volta_core/event/index.html @@ -0,0 +1,2 @@ +volta_core::event - Rust

Module volta_core::event

source ·
Expand description

Events for the sessions in executables and shims and everything

+

Structs

Enums

Functions

\ No newline at end of file diff --git a/main/volta_core/event/sidebar-items.js b/main/volta_core/event/sidebar-items.js new file mode 100644 index 000000000..1aab7d112 --- /dev/null +++ b/main/volta_core/event/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["EventKind"],"fn":["get_error_env","unix_timestamp"],"struct":["ErrorEnv","Event","EventLog"]}; \ No newline at end of file diff --git a/main/volta_core/event/struct.ErrorEnv.html b/main/volta_core/event/struct.ErrorEnv.html new file mode 100644 index 000000000..e4569a93d --- /dev/null +++ b/main/volta_core/event/struct.ErrorEnv.html @@ -0,0 +1,29 @@ +ErrorEnv in volta_core::event - Rust

Struct volta_core::event::ErrorEnv

source ·
pub struct ErrorEnv {
+    argv: String,
+    exec_path: String,
+    path: String,
+    platform: String,
+    platform_version: String,
+}

Fields§

§argv: String§exec_path: String§path: String§platform: String§platform_version: String

Trait Implementations§

source§

impl Debug for ErrorEnv

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for ErrorEnv

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for ErrorEnv

source§

fn eq(&self, other: &ErrorEnv) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ErrorEnv

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for ErrorEnv

source§

impl StructuralEq for ErrorEnv

source§

impl StructuralPartialEq for ErrorEnv

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/event/struct.Event.html b/main/volta_core/event/struct.Event.html new file mode 100644 index 000000000..a0e90d35d --- /dev/null +++ b/main/volta_core/event/struct.Event.html @@ -0,0 +1,19 @@ +Event in volta_core::event - Rust

Struct volta_core::event::Event

source ·
pub struct Event {
+    timestamp: u64,
+    pub name: String,
+    pub event: EventKind,
+}

Fields§

§timestamp: u64§name: String§event: EventKind

Trait Implementations§

source§

impl<'de> Deserialize<'de> for Event

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Event

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/event/struct.EventLog.html b/main/volta_core/event/struct.EventLog.html new file mode 100644 index 000000000..8b513b187 --- /dev/null +++ b/main/volta_core/event/struct.EventLog.html @@ -0,0 +1,27 @@ +EventLog in volta_core::event - Rust

Struct volta_core::event::EventLog

source ·
pub struct EventLog {
+    events: Vec<Event>,
+}

Fields§

§events: Vec<Event>

Implementations§

source§

impl EventLog

source

pub fn init() -> Self

Constructs a new ‘EventLog’

+
source

pub fn add_event_start(&mut self, activity_kind: ActivityKind)

source

pub fn add_event_end( + &mut self, + activity_kind: ActivityKind, + exit_code: ExitCode +)

source

pub fn add_event_tool_end( + &mut self, + activity_kind: ActivityKind, + exit_code: i32 +)

source

pub fn add_event_error( + &mut self, + activity_kind: ActivityKind, + error: &VoltaError +)

source

pub fn add_event_args(&mut self)

source

fn add_event(&mut self, event_kind: EventKind, activity_kind: ActivityKind)

source

pub fn publish(&self, plugin: Option<&Publish>)

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/fs/fn.create_staging_dir.html b/main/volta_core/fs/fn.create_staging_dir.html new file mode 100644 index 000000000..5f1ecc8ad --- /dev/null +++ b/main/volta_core/fs/fn.create_staging_dir.html @@ -0,0 +1,2 @@ +create_staging_dir in volta_core::fs - Rust
pub fn create_staging_dir() -> Fallible<TempDir>
Expand description

Creates a staging directory in the Volta tmp directory

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.create_staging_file.html b/main/volta_core/fs/fn.create_staging_file.html new file mode 100644 index 000000000..961c68724 --- /dev/null +++ b/main/volta_core/fs/fn.create_staging_file.html @@ -0,0 +1,2 @@ +create_staging_file in volta_core::fs - Rust
pub fn create_staging_file() -> Fallible<NamedTempFile>
Expand description

Creates a NamedTempFile in the Volta tmp directory

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.dir_entry_match.html b/main/volta_core/fs/fn.dir_entry_match.html new file mode 100644 index 000000000..67d8a0ec2 --- /dev/null +++ b/main/volta_core/fs/fn.dir_entry_match.html @@ -0,0 +1,4 @@ +dir_entry_match in volta_core::fs - Rust

Function volta_core::fs::dir_entry_match

source ·
pub fn dir_entry_match<T, F>(dir: &Path, f: F) -> Result<Vec<T>>where
+    F: FnMut(&DirEntry) -> Option<T>,
Expand description

Reads the contents of a directory and returns a Vec of the matched results +from the input function

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.ok_if_not_found.html b/main/volta_core/fs/fn.ok_if_not_found.html new file mode 100644 index 000000000..29799a601 --- /dev/null +++ b/main/volta_core/fs/fn.ok_if_not_found.html @@ -0,0 +1,4 @@ +ok_if_not_found in volta_core::fs - Rust

Function volta_core::fs::ok_if_not_found

source ·
pub fn ok_if_not_found<T: Default>(err: Error) -> Result<T>
Expand description

Converts a failure because of file not found into a success.

+

Handling the error is preferred over checking if a file exists before removing it, since +that avoids a potential race condition between the check and the removal.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.read_dir_eager.html b/main/volta_core/fs/fn.read_dir_eager.html new file mode 100644 index 000000000..0b206dc0f --- /dev/null +++ b/main/volta_core/fs/fn.read_dir_eager.html @@ -0,0 +1,11 @@ +read_dir_eager in volta_core::fs - Rust

Function volta_core::fs::read_dir_eager

source ·
pub fn read_dir_eager(
+    dir: &Path
+) -> Result<impl Iterator<Item = (DirEntry, Metadata)>>
Expand description

Reads the full contents of a directory, eagerly extracting each directory entry +and its metadata and returning an iterator over them. Returns Error if any of +these steps fails.

+

This function makes it easier to write high level logic for manipulating the +contents of directories (map, filter, etc).

+

Note that this function allocates an intermediate vector of directory entries to +construct the iterator from, so if a directory is expected to be very large, it +will allocate temporary data proportional to the number of entries.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.read_file.html b/main/volta_core/fs/fn.read_file.html new file mode 100644 index 000000000..26a265e7e --- /dev/null +++ b/main/volta_core/fs/fn.read_file.html @@ -0,0 +1,2 @@ +read_file in volta_core::fs - Rust

Function volta_core::fs::read_file

source ·
pub fn read_file<P: AsRef<Path>>(path: P) -> Result<Option<String>>
Expand description

Reads a file, if it exists.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.remove_dir_if_exists.html b/main/volta_core/fs/fn.remove_dir_if_exists.html new file mode 100644 index 000000000..2979db153 --- /dev/null +++ b/main/volta_core/fs/fn.remove_dir_if_exists.html @@ -0,0 +1,3 @@ +remove_dir_if_exists in volta_core::fs - Rust
pub fn remove_dir_if_exists<P: AsRef<Path>>(path: P) -> Fallible<()>
Expand description

Removes the target directory, if it exists. If the directory doesn’t exist, that is treated as +success.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.remove_file_if_exists.html b/main/volta_core/fs/fn.remove_file_if_exists.html new file mode 100644 index 000000000..ef368108c --- /dev/null +++ b/main/volta_core/fs/fn.remove_file_if_exists.html @@ -0,0 +1,2 @@ +remove_file_if_exists in volta_core::fs - Rust
pub fn remove_file_if_exists<P: AsRef<Path>>(path: P) -> Fallible<()>
Expand description

Removes the target file, if it exists. If the file doesn’t exist, that is treated as success.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.rename.html b/main/volta_core/fs/fn.rename.html new file mode 100644 index 000000000..21019f90e --- /dev/null +++ b/main/volta_core/fs/fn.rename.html @@ -0,0 +1,6 @@ +rename in volta_core::fs - Rust

Function volta_core::fs::rename

source ·
pub fn rename<F, T>(from: F, to: T) -> Result<()>where
+    F: AsRef<Path>,
+    T: AsRef<Path>,
Expand description

Rename a file or directory to a new name, retrying if the operation fails because of permissions

+

Will retry for ~30 seconds with longer and longer delays between each, to allow for virus scan +and other automated operations to complete.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.set_executable.html b/main/volta_core/fs/fn.set_executable.html new file mode 100644 index 000000000..6d90251b7 --- /dev/null +++ b/main/volta_core/fs/fn.set_executable.html @@ -0,0 +1,2 @@ +set_executable in volta_core::fs - Rust

Function volta_core::fs::set_executable

source ·
pub fn set_executable(bin: &Path) -> Result<()>
Expand description

Ensure that a given file has ‘executable’ permissions, otherwise we won’t be able to call it

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.symlink_dir.html b/main/volta_core/fs/fn.symlink_dir.html new file mode 100644 index 000000000..ed90ec0bb --- /dev/null +++ b/main/volta_core/fs/fn.symlink_dir.html @@ -0,0 +1,4 @@ +symlink_dir in volta_core::fs - Rust

Function volta_core::fs::symlink_dir

source ·
pub fn symlink_dir<S, D>(src: S, dest: D) -> Result<()>where
+    S: AsRef<Path>,
+    D: AsRef<Path>,
Expand description

Create a directory symlink. The dst path will be a symbolic link pointing to the src path

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.symlink_file.html b/main/volta_core/fs/fn.symlink_file.html new file mode 100644 index 000000000..4fbd4147e --- /dev/null +++ b/main/volta_core/fs/fn.symlink_file.html @@ -0,0 +1,4 @@ +symlink_file in volta_core::fs - Rust

Function volta_core::fs::symlink_file

source ·
pub fn symlink_file<S, D>(src: S, dest: D) -> Result<()>where
+    S: AsRef<Path>,
+    D: AsRef<Path>,
Expand description

Create a file symlink. The dst path will be a symbolic link pointing to the src path.

+
\ No newline at end of file diff --git a/main/volta_core/fs/fn.touch.html b/main/volta_core/fs/fn.touch.html new file mode 100644 index 000000000..d6dea7cae --- /dev/null +++ b/main/volta_core/fs/fn.touch.html @@ -0,0 +1,2 @@ +touch in volta_core::fs - Rust

Function volta_core::fs::touch

source ·
pub fn touch(path: &Path) -> Result<File>
Expand description

Opens a file, creating it if it doesn’t exist

+
\ No newline at end of file diff --git a/main/volta_core/fs/index.html b/main/volta_core/fs/index.html new file mode 100644 index 000000000..3cb22d7a0 --- /dev/null +++ b/main/volta_core/fs/index.html @@ -0,0 +1,6 @@ +volta_core::fs - Rust

Module volta_core::fs

source ·
Expand description

Provides utilities for operating on the filesystem.

+

Functions

  • Creates a staging directory in the Volta tmp directory
  • Creates a NamedTempFile in the Volta tmp directory
  • Reads the contents of a directory and returns a Vec of the matched results +from the input function
  • Converts a failure because of file not found into a success.
  • Reads the full contents of a directory, eagerly extracting each directory entry +and its metadata and returning an iterator over them. Returns Error if any of +these steps fails.
  • Reads a file, if it exists.
  • Removes the target directory, if it exists. If the directory doesn’t exist, that is treated as +success.
  • Removes the target file, if it exists. If the file doesn’t exist, that is treated as success.
  • Rename a file or directory to a new name, retrying if the operation fails because of permissions
  • Ensure that a given file has ‘executable’ permissions, otherwise we won’t be able to call it
  • Create a directory symlink. The dst path will be a symbolic link pointing to the src path
  • Create a file symlink. The dst path will be a symbolic link pointing to the src path.
  • Opens a file, creating it if it doesn’t exist
\ No newline at end of file diff --git a/main/volta_core/fs/sidebar-items.js b/main/volta_core/fs/sidebar-items.js new file mode 100644 index 000000000..571238a40 --- /dev/null +++ b/main/volta_core/fs/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["create_staging_dir","create_staging_file","dir_entry_match","ok_if_not_found","read_dir_eager","read_file","remove_dir_if_exists","remove_file_if_exists","rename","set_executable","symlink_dir","symlink_file","touch"]}; \ No newline at end of file diff --git a/main/volta_core/hook/enum.Publish.html b/main/volta_core/hook/enum.Publish.html new file mode 100644 index 000000000..d8cc2af38 --- /dev/null +++ b/main/volta_core/hook/enum.Publish.html @@ -0,0 +1,26 @@ +Publish in volta_core::hook - Rust

Enum volta_core::hook::Publish

source ·
pub enum Publish {
+    Url(String),
+    Bin(String),
+}
Expand description

A hook for publishing Volta events.

+

Variants§

§

Url(String)

Reports an event by sending a POST request to a URL.

+
§

Bin(String)

Reports an event by forking a process and sending the event by IPC.

+

Trait Implementations§

source§

impl Debug for Publish

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for Publish

source§

fn eq(&self, other: &Publish) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<RawPublishHook> for Publish

§

type Error = VoltaError

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

fn try_from(raw: RawPublishHook) -> Fallible<Publish>

Performs the conversion.
source§

impl Eq for Publish

source§

impl StructuralEq for Publish

source§

impl StructuralPartialEq for Publish

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/enum.RegistryFormat.html b/main/volta_core/hook/enum.RegistryFormat.html new file mode 100644 index 000000000..dad342d37 --- /dev/null +++ b/main/volta_core/hook/enum.RegistryFormat.html @@ -0,0 +1,24 @@ +RegistryFormat in volta_core::hook - Rust
pub enum RegistryFormat {
+    Npm,
+    Github,
+}
Expand description

Format of the registry used for Yarn (Npm or Github)

+

Variants§

§

Npm

§

Github

Implementations§

Trait Implementations§

source§

impl Debug for RegistryFormat

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for RegistryFormat

source§

fn eq(&self, other: &RegistryFormat) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for RegistryFormat

source§

impl StructuralEq for RegistryFormat

source§

impl StructuralPartialEq for RegistryFormat

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/index.html b/main/volta_core/hook/index.html new file mode 100644 index 000000000..ca3afd797 --- /dev/null +++ b/main/volta_core/hook/index.html @@ -0,0 +1,2 @@ +volta_core::hook - Rust

Module volta_core::hook

source ·
Expand description

Provides types for working with Volta hooks.

+

Modules

  • serial 🔒
  • Types representing Volta Tool Hooks.

Macros

Structs

Enums

  • A hook for publishing Volta events.
  • Format of the registry used for Yarn (Npm or Github)
\ No newline at end of file diff --git a/main/volta_core/hook/macro.merge_hooks!.html b/main/volta_core/hook/macro.merge_hooks!.html new file mode 100644 index 000000000..bd52a5fdc --- /dev/null +++ b/main/volta_core/hook/macro.merge_hooks!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.merge_hooks.html...

+ + + \ No newline at end of file diff --git a/main/volta_core/hook/macro.merge_hooks.html b/main/volta_core/hook/macro.merge_hooks.html new file mode 100644 index 000000000..b9781e850 --- /dev/null +++ b/main/volta_core/hook/macro.merge_hooks.html @@ -0,0 +1,3 @@ +merge_hooks in volta_core::hook - Rust
macro_rules! merge_hooks {
+    ($self:ident, $other:ident, $field:ident) => { ... };
+}
\ No newline at end of file diff --git a/main/volta_core/hook/serial/index.html b/main/volta_core/hook/serial/index.html new file mode 100644 index 000000000..717108c04 --- /dev/null +++ b/main/volta_core/hook/serial/index.html @@ -0,0 +1 @@ +volta_core::hook::serial - Rust
\ No newline at end of file diff --git a/main/volta_core/hook/serial/sidebar-items.js b/main/volta_core/hook/serial/sidebar-items.js new file mode 100644 index 000000000..01f6f02bf --- /dev/null +++ b/main/volta_core/hook/serial/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["RawEventHooks","RawHookConfig","RawIndexHook","RawPublishHook","RawResolveHook","RawToolHooks","RawYarnHooks"]}; \ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawEventHooks.html b/main/volta_core/hook/serial/struct.RawEventHooks.html new file mode 100644 index 000000000..a7a6f4102 --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawEventHooks.html @@ -0,0 +1,17 @@ +RawEventHooks in volta_core::hook::serial - Rust
pub struct RawEventHooks {
+    pub publish: Option<RawPublishHook>,
+}

Fields§

§publish: Option<RawPublishHook>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawEventHooks

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RawEventHooks

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<RawEventHooks> for EventHooks

§

type Error = VoltaError

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

fn try_from(raw: RawEventHooks) -> Fallible<EventHooks>

Performs the conversion.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawHookConfig.html b/main/volta_core/hook/serial/struct.RawHookConfig.html new file mode 100644 index 000000000..7367b9423 --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawHookConfig.html @@ -0,0 +1,21 @@ +RawHookConfig in volta_core::hook::serial - Rust
pub struct RawHookConfig {
+    pub node: Option<RawToolHooks<Node>>,
+    pub npm: Option<RawToolHooks<Npm>>,
+    pub pnpm: Option<RawToolHooks<Pnpm>>,
+    pub yarn: Option<RawYarnHooks>,
+    pub events: Option<RawEventHooks>,
+}

Fields§

§node: Option<RawToolHooks<Node>>§npm: Option<RawToolHooks<Npm>>§pnpm: Option<RawToolHooks<Pnpm>>§yarn: Option<RawYarnHooks>§events: Option<RawEventHooks>

Implementations§

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawHookConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RawHookConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawIndexHook.html b/main/volta_core/hook/serial/struct.RawIndexHook.html new file mode 100644 index 000000000..cf1d34df3 --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawIndexHook.html @@ -0,0 +1,20 @@ +RawIndexHook in volta_core::hook::serial - Rust
pub struct RawIndexHook {
+    prefix: Option<String>,
+    template: Option<String>,
+    bin: Option<String>,
+    format: Option<String>,
+}

Fields§

§prefix: Option<String>§template: Option<String>§bin: Option<String>§format: Option<String>

Implementations§

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawIndexHook

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RawIndexHook

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawPublishHook.html b/main/volta_core/hook/serial/struct.RawPublishHook.html new file mode 100644 index 000000000..5482275fb --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawPublishHook.html @@ -0,0 +1,18 @@ +RawPublishHook in volta_core::hook::serial - Rust
pub struct RawPublishHook {
+    url: Option<String>,
+    bin: Option<String>,
+}

Fields§

§url: Option<String>§bin: Option<String>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawPublishHook

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RawPublishHook

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<RawPublishHook> for Publish

§

type Error = VoltaError

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

fn try_from(raw: RawPublishHook) -> Fallible<Publish>

Performs the conversion.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawResolveHook.html b/main/volta_core/hook/serial/struct.RawResolveHook.html new file mode 100644 index 000000000..501b8a927 --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawResolveHook.html @@ -0,0 +1,27 @@ +RawResolveHook in volta_core::hook::serial - Rust
pub struct RawResolveHook {
+    prefix: Option<String>,
+    template: Option<String>,
+    bin: Option<String>,
+}

Fields§

§prefix: Option<String>§template: Option<String>§bin: Option<String>

Implementations§

source§

impl RawResolveHook

source

fn into_hook<H, P, T, B>( + self, + to_prefix: P, + to_template: T, + to_bin: B +) -> Fallible<H>where + P: FnOnce(String) -> H, + T: FnOnce(String) -> H, + B: FnOnce(String) -> H,

source

pub fn into_distro_hook(self, base_dir: &Path) -> Fallible<DistroHook>

source

pub fn into_metadata_hook(self, base_dir: &Path) -> Fallible<MetadataHook>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawResolveHook

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RawResolveHook

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawToolHooks.html b/main/volta_core/hook/serial/struct.RawToolHooks.html new file mode 100644 index 000000000..d5e631690 --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawToolHooks.html @@ -0,0 +1,25 @@ +RawToolHooks in volta_core::hook::serial - Rust
pub struct RawToolHooks<T: Tool> {
+    pub distro: Option<RawResolveHook>,
+    pub latest: Option<RawResolveHook>,
+    pub index: Option<RawResolveHook>,
+    phantom: PhantomData<T>,
+}

Fields§

§distro: Option<RawResolveHook>§latest: Option<RawResolveHook>§index: Option<RawResolveHook>§phantom: PhantomData<T>

Implementations§

source§

impl<T: Tool> RawToolHooks<T>

source

pub fn into_tool_hooks(self, base_dir: &Path) -> Fallible<ToolHooks<T>>

Trait Implementations§

source§

impl<'de, T: Tool> Deserialize<'de> for RawToolHooks<T>

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Tool> Serialize for RawToolHooks<T>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for RawToolHooks<T>where + T: RefUnwindSafe,

§

impl<T> Send for RawToolHooks<T>where + T: Send,

§

impl<T> Sync for RawToolHooks<T>where + T: Sync,

§

impl<T> Unpin for RawToolHooks<T>where + T: Unpin,

§

impl<T> UnwindSafe for RawToolHooks<T>where + T: UnwindSafe,

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/serial/struct.RawYarnHooks.html b/main/volta_core/hook/serial/struct.RawYarnHooks.html new file mode 100644 index 000000000..79609efa8 --- /dev/null +++ b/main/volta_core/hook/serial/struct.RawYarnHooks.html @@ -0,0 +1,19 @@ +RawYarnHooks in volta_core::hook::serial - Rust
pub struct RawYarnHooks {
+    pub distro: Option<RawResolveHook>,
+    pub latest: Option<RawResolveHook>,
+    pub index: Option<RawIndexHook>,
+}

Fields§

§distro: Option<RawResolveHook>§latest: Option<RawResolveHook>§index: Option<RawIndexHook>

Implementations§

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawYarnHooks

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for RawYarnHooks

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/hook/sidebar-items.js b/main/volta_core/hook/sidebar-items.js new file mode 100644 index 000000000..646368266 --- /dev/null +++ b/main/volta_core/hook/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Publish","RegistryFormat"],"macro":["merge_hooks"],"mod":["serial","tool"],"struct":["EventHooks","HookConfig","LazyHookConfig","ToolHooks","YarnHooks"]}; \ No newline at end of file diff --git a/main/volta_core/hook/struct.EventHooks.html b/main/volta_core/hook/struct.EventHooks.html new file mode 100644 index 000000000..1a89ef1d4 --- /dev/null +++ b/main/volta_core/hook/struct.EventHooks.html @@ -0,0 +1,17 @@ +EventHooks in volta_core::hook - Rust

Struct volta_core::hook::EventHooks

source ·
pub struct EventHooks {
+    pub publish: Option<Publish>,
+}
Expand description

Volta hooks related to events.

+

Fields§

§publish: Option<Publish>

The hook for publishing events, if any.

+

Implementations§

source§

impl EventHooks

source

fn merge(self, other: Self) -> Self

Merges this EventHooks with another, giving precedence to the current instance

+

Trait Implementations§

source§

impl TryFrom<RawEventHooks> for EventHooks

§

type Error = VoltaError

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

fn try_from(raw: RawEventHooks) -> Fallible<EventHooks>

Performs the conversion.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/struct.HookConfig.html b/main/volta_core/hook/struct.HookConfig.html new file mode 100644 index 000000000..34b91df82 --- /dev/null +++ b/main/volta_core/hook/struct.HookConfig.html @@ -0,0 +1,26 @@ +HookConfig in volta_core::hook - Rust

Struct volta_core::hook::HookConfig

source ·
pub struct HookConfig {
+    node: Option<ToolHooks<Node>>,
+    npm: Option<ToolHooks<Npm>>,
+    pnpm: Option<ToolHooks<Pnpm>>,
+    yarn: Option<YarnHooks>,
+    events: Option<EventHooks>,
+}
Expand description

Volta hook configuration

+

Fields§

§node: Option<ToolHooks<Node>>§npm: Option<ToolHooks<Npm>>§pnpm: Option<ToolHooks<Pnpm>>§yarn: Option<YarnHooks>§events: Option<EventHooks>

Implementations§

source§

impl HookConfig

source

pub fn node(&self) -> Option<&ToolHooks<Node>>

source

pub fn npm(&self) -> Option<&ToolHooks<Npm>>

source

pub fn pnpm(&self) -> Option<&ToolHooks<Pnpm>>

source

pub fn yarn(&self) -> Option<&YarnHooks>

source

pub fn events(&self) -> Option<&EventHooks>

source

fn current(project: Option<&Project>) -> Fallible<Self>

Returns the current hooks, which are a merge between the user hooks and +the project hooks (if any).

+
source

fn from_paths<P, I>(paths: I) -> Fallible<Self>where + P: AsRef<Path>, + I: IntoIterator<Item = P>,

Returns the merged hooks loaded from an iterator of potential hook files

+

paths should be sorted in order of descending precedence.

+
source

fn from_file(file_path: &Path) -> Fallible<Option<Self>>

source

fn merge(self, other: Self) -> Self

Merges this HookConfig with another, giving precedence to the current instance

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/struct.LazyHookConfig.html b/main/volta_core/hook/struct.LazyHookConfig.html new file mode 100644 index 000000000..ea2c688bd --- /dev/null +++ b/main/volta_core/hook/struct.LazyHookConfig.html @@ -0,0 +1,17 @@ +LazyHookConfig in volta_core::hook - Rust
pub struct LazyHookConfig {
+    settings: OnceCell<HookConfig>,
+}
Expand description

Lazily loaded Volta hook configuration

+

Fields§

§settings: OnceCell<HookConfig>

Implementations§

source§

impl LazyHookConfig

source

pub fn init() -> LazyHookConfig

Constructs a new LazyHookConfig

+
source

pub fn get(&self, project: Option<&Project>) -> Fallible<&HookConfig>

Forces the loading of the hook configuration from both project-local and user-default hooks

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/struct.ToolHooks.html b/main/volta_core/hook/struct.ToolHooks.html new file mode 100644 index 000000000..3d1c8c2b7 --- /dev/null +++ b/main/volta_core/hook/struct.ToolHooks.html @@ -0,0 +1,27 @@ +ToolHooks in volta_core::hook - Rust

Struct volta_core::hook::ToolHooks

source ·
pub struct ToolHooks<T: Tool> {
+    pub distro: Option<DistroHook>,
+    pub latest: Option<MetadataHook>,
+    pub index: Option<MetadataHook>,
+    phantom: PhantomData<T>,
+}
Expand description

Volta hooks for an individual tool

+

Fields§

§distro: Option<DistroHook>

The hook for resolving the URL for a distro version

+
§latest: Option<MetadataHook>

The hook for resolving the URL for the latest version

+
§index: Option<MetadataHook>

The hook for resolving the Tool Index URL

+
§phantom: PhantomData<T>

Implementations§

source§

impl<T: Tool> ToolHooks<T>

source

fn merge(self, other: Self) -> Self

Extends this ToolHooks with another, giving precendence to the current instance

+

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for ToolHooks<T>where + T: RefUnwindSafe,

§

impl<T> Send for ToolHooks<T>where + T: Send,

§

impl<T> Sync for ToolHooks<T>where + T: Sync,

§

impl<T> Unpin for ToolHooks<T>where + T: Unpin,

§

impl<T> UnwindSafe for ToolHooks<T>where + T: UnwindSafe,

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/struct.YarnHooks.html b/main/volta_core/hook/struct.YarnHooks.html new file mode 100644 index 000000000..330373d4a --- /dev/null +++ b/main/volta_core/hook/struct.YarnHooks.html @@ -0,0 +1,21 @@ +YarnHooks in volta_core::hook - Rust

Struct volta_core::hook::YarnHooks

source ·
pub struct YarnHooks {
+    pub distro: Option<DistroHook>,
+    pub latest: Option<MetadataHook>,
+    pub index: Option<YarnIndexHook>,
+}
Expand description

Volta hooks for Yarn

+

Fields§

§distro: Option<DistroHook>

The hook for resolving the URL for a distro version

+
§latest: Option<MetadataHook>

The hook for resolving the URL for the latest version

+
§index: Option<YarnIndexHook>

The hook for resolving the Tool Index URL

+

Implementations§

source§

impl YarnHooks

source

fn merge(self, other: Self) -> Self

Extends this YarnHooks with another, giving precendence to the current instance

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/tool/constant.ARCH_TEMPLATE.html b/main/volta_core/hook/tool/constant.ARCH_TEMPLATE.html new file mode 100644 index 000000000..6cf22a4bb --- /dev/null +++ b/main/volta_core/hook/tool/constant.ARCH_TEMPLATE.html @@ -0,0 +1 @@ +ARCH_TEMPLATE in volta_core::hook::tool - Rust
const ARCH_TEMPLATE: &str = "{{arch}}";
\ No newline at end of file diff --git a/main/volta_core/hook/tool/constant.EXTENSION_TEMPLATE.html b/main/volta_core/hook/tool/constant.EXTENSION_TEMPLATE.html new file mode 100644 index 000000000..60561a471 --- /dev/null +++ b/main/volta_core/hook/tool/constant.EXTENSION_TEMPLATE.html @@ -0,0 +1 @@ +EXTENSION_TEMPLATE in volta_core::hook::tool - Rust
const EXTENSION_TEMPLATE: &str = "{{ext}}";
\ No newline at end of file diff --git a/main/volta_core/hook/tool/constant.FILENAME_TEMPLATE.html b/main/volta_core/hook/tool/constant.FILENAME_TEMPLATE.html new file mode 100644 index 000000000..b7a15cf5c --- /dev/null +++ b/main/volta_core/hook/tool/constant.FILENAME_TEMPLATE.html @@ -0,0 +1 @@ +FILENAME_TEMPLATE in volta_core::hook::tool - Rust
const FILENAME_TEMPLATE: &str = "{{filename}}";
\ No newline at end of file diff --git a/main/volta_core/hook/tool/constant.OS_TEMPLATE.html b/main/volta_core/hook/tool/constant.OS_TEMPLATE.html new file mode 100644 index 000000000..a4379c057 --- /dev/null +++ b/main/volta_core/hook/tool/constant.OS_TEMPLATE.html @@ -0,0 +1 @@ +OS_TEMPLATE in volta_core::hook::tool - Rust

Constant volta_core::hook::tool::OS_TEMPLATE

source ·
const OS_TEMPLATE: &str = "{{os}}";
\ No newline at end of file diff --git a/main/volta_core/hook/tool/constant.VERSION_TEMPLATE.html b/main/volta_core/hook/tool/constant.VERSION_TEMPLATE.html new file mode 100644 index 000000000..2a62d2109 --- /dev/null +++ b/main/volta_core/hook/tool/constant.VERSION_TEMPLATE.html @@ -0,0 +1 @@ +VERSION_TEMPLATE in volta_core::hook::tool - Rust
const VERSION_TEMPLATE: &str = "{{version}}";
\ No newline at end of file diff --git a/main/volta_core/hook/tool/enum.DistroHook.html b/main/volta_core/hook/tool/enum.DistroHook.html new file mode 100644 index 000000000..9f9f47a4d --- /dev/null +++ b/main/volta_core/hook/tool/enum.DistroHook.html @@ -0,0 +1,29 @@ +DistroHook in volta_core::hook::tool - Rust
pub enum DistroHook {
+    Prefix(String),
+    Template(String),
+    Bin {
+        bin: String,
+        base_path: PathBuf,
+    },
+}
Expand description

A hook for resolving the distro URL for a given tool version

+

Variants§

§

Prefix(String)

§

Template(String)

§

Bin

Fields

§base_path: PathBuf

Implementations§

source§

impl DistroHook

source

pub fn resolve(&self, version: &Version, filename: &str) -> Fallible<String>

Performs resolution of the distro URL based on the given version and file name

+

Trait Implementations§

source§

impl Debug for DistroHook

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for DistroHook

source§

fn eq(&self, other: &DistroHook) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for DistroHook

source§

impl StructuralEq for DistroHook

source§

impl StructuralPartialEq for DistroHook

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/tool/enum.MetadataHook.html b/main/volta_core/hook/tool/enum.MetadataHook.html new file mode 100644 index 000000000..190761895 --- /dev/null +++ b/main/volta_core/hook/tool/enum.MetadataHook.html @@ -0,0 +1,29 @@ +MetadataHook in volta_core::hook::tool - Rust
pub enum MetadataHook {
+    Prefix(String),
+    Template(String),
+    Bin {
+        bin: String,
+        base_path: PathBuf,
+    },
+}
Expand description

A hook for resolving the URL for metadata about a tool

+

Variants§

§

Prefix(String)

§

Template(String)

§

Bin

Fields

§base_path: PathBuf

Implementations§

source§

impl MetadataHook

source

pub fn resolve(&self, filename: &str) -> Fallible<String>

Performs resolution of the metadata URL based on the given default file name

+

Trait Implementations§

source§

impl Debug for MetadataHook

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for MetadataHook

source§

fn eq(&self, other: &MetadataHook) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for MetadataHook

source§

impl StructuralEq for MetadataHook

source§

impl StructuralPartialEq for MetadataHook

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/hook/tool/fn.calculate_extension.html b/main/volta_core/hook/tool/fn.calculate_extension.html new file mode 100644 index 000000000..a6ba13b35 --- /dev/null +++ b/main/volta_core/hook/tool/fn.calculate_extension.html @@ -0,0 +1,4 @@ +calculate_extension in volta_core::hook::tool - Rust
fn calculate_extension(filename: &str) -> Option<&str>
Expand description

Use the expected filename to determine the extension for this hook

+

This will include the multi-part tar.gz extension if it is present, otherwise it will use +the standard extension.

+
\ No newline at end of file diff --git a/main/volta_core/hook/tool/fn.execute_binary.html b/main/volta_core/hook/tool/fn.execute_binary.html new file mode 100644 index 000000000..8883002a1 --- /dev/null +++ b/main/volta_core/hook/tool/fn.execute_binary.html @@ -0,0 +1,6 @@ +execute_binary in volta_core::hook::tool - Rust
fn execute_binary(
+    bin: &str,
+    base_path: &Path,
+    extra_arg: Option<String>
+) -> Fallible<String>
Expand description

Execute a shell command and return the trimmed stdout from that command

+
\ No newline at end of file diff --git a/main/volta_core/hook/tool/index.html b/main/volta_core/hook/tool/index.html new file mode 100644 index 000000000..c86fd97ad --- /dev/null +++ b/main/volta_core/hook/tool/index.html @@ -0,0 +1,2 @@ +volta_core::hook::tool - Rust

Module volta_core::hook::tool

source ·
Expand description

Types representing Volta Tool Hooks.

+

Structs

Enums

  • A hook for resolving the distro URL for a given tool version
  • A hook for resolving the URL for metadata about a tool

Constants

Statics

Functions

  • Use the expected filename to determine the extension for this hook
  • Execute a shell command and return the trimmed stdout from that command
\ No newline at end of file diff --git a/main/volta_core/hook/tool/sidebar-items.js b/main/volta_core/hook/tool/sidebar-items.js new file mode 100644 index 000000000..4111048f0 --- /dev/null +++ b/main/volta_core/hook/tool/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["ARCH_TEMPLATE","EXTENSION_TEMPLATE","FILENAME_TEMPLATE","OS_TEMPLATE","VERSION_TEMPLATE"],"enum":["DistroHook","MetadataHook"],"fn":["calculate_extension","execute_binary"],"static":["REL_PATH","REL_PATH_PARENT"],"struct":["YarnIndexHook"]}; \ No newline at end of file diff --git a/main/volta_core/hook/tool/static.REL_PATH.html b/main/volta_core/hook/tool/static.REL_PATH.html new file mode 100644 index 000000000..97cb53024 --- /dev/null +++ b/main/volta_core/hook/tool/static.REL_PATH.html @@ -0,0 +1 @@ +REL_PATH in volta_core::hook::tool - Rust

Static volta_core::hook::tool::REL_PATH

source ·
static REL_PATH: Lazy<String>
\ No newline at end of file diff --git a/main/volta_core/hook/tool/static.REL_PATH_PARENT.html b/main/volta_core/hook/tool/static.REL_PATH_PARENT.html new file mode 100644 index 000000000..84d27648f --- /dev/null +++ b/main/volta_core/hook/tool/static.REL_PATH_PARENT.html @@ -0,0 +1 @@ +REL_PATH_PARENT in volta_core::hook::tool - Rust
static REL_PATH_PARENT: Lazy<String>
\ No newline at end of file diff --git a/main/volta_core/hook/tool/struct.YarnIndexHook.html b/main/volta_core/hook/tool/struct.YarnIndexHook.html new file mode 100644 index 000000000..1fdfc63cf --- /dev/null +++ b/main/volta_core/hook/tool/struct.YarnIndexHook.html @@ -0,0 +1,25 @@ +YarnIndexHook in volta_core::hook::tool - Rust
pub struct YarnIndexHook {
+    pub format: RegistryFormat,
+    pub metadata: MetadataHook,
+}
Expand description

A hook for resolving the URL for the Yarn index

+

Fields§

§format: RegistryFormat§metadata: MetadataHook

Implementations§

source§

impl YarnIndexHook

source

pub fn resolve(&self, filename: &str) -> Fallible<String>

Performs resolution of the metadata URL based on the given default file name

+

Trait Implementations§

source§

impl Debug for YarnIndexHook

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq for YarnIndexHook

source§

fn eq(&self, other: &YarnIndexHook) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for YarnIndexHook

source§

impl StructuralEq for YarnIndexHook

source§

impl StructuralPartialEq for YarnIndexHook

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/index.html b/main/volta_core/index.html new file mode 100644 index 000000000..3a6390bd1 --- /dev/null +++ b/main/volta_core/index.html @@ -0,0 +1,7 @@ +volta_core - Rust

Crate volta_core

source ·
Expand description

The main implementation crate for the core of Volta.

+

Modules

  • command 🔒
  • Events for the sessions in executables and shims and everything
  • Provides utilities for operating on the filesystem.
  • hook 🔒
    Provides types for working with Volta hooks.
  • Provides types for working with Volta’s inventory, the local repository +of available tool versions.
  • This module provides a custom Logger implementation for use with the log crate
  • Provides the Project type, which represents a Node project tree in +the filesystem.
  • Provides the Session type, which represents the user’s state during an +execution of a Volta tool, including their current directory, Volta +hook configuration, and the state of the local inventory.
  • Provides utilities for modifying shims for 3rd-party executables
  • The view layer of Volta, with utilities for styling command-line output.
  • Inter-process locking on the Volta directory

Constants

\ No newline at end of file diff --git a/main/volta_core/inventory/fn.node_available.html b/main/volta_core/inventory/fn.node_available.html new file mode 100644 index 000000000..2def34a48 --- /dev/null +++ b/main/volta_core/inventory/fn.node_available.html @@ -0,0 +1,2 @@ +node_available in volta_core::inventory - Rust
pub fn node_available(version: &Version) -> Fallible<bool>
Expand description

Checks if a given Node version image is available on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.node_versions.html b/main/volta_core/inventory/fn.node_versions.html new file mode 100644 index 000000000..1b33b8409 --- /dev/null +++ b/main/volta_core/inventory/fn.node_versions.html @@ -0,0 +1,2 @@ +node_versions in volta_core::inventory - Rust
pub fn node_versions() -> Fallible<BTreeSet<Version>>
Expand description

Collects a set of all Node versions fetched on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.npm_available.html b/main/volta_core/inventory/fn.npm_available.html new file mode 100644 index 000000000..437419ca0 --- /dev/null +++ b/main/volta_core/inventory/fn.npm_available.html @@ -0,0 +1,2 @@ +npm_available in volta_core::inventory - Rust
pub fn npm_available(version: &Version) -> Fallible<bool>
Expand description

Checks if a given npm version image is available on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.npm_versions.html b/main/volta_core/inventory/fn.npm_versions.html new file mode 100644 index 000000000..536c0f29e --- /dev/null +++ b/main/volta_core/inventory/fn.npm_versions.html @@ -0,0 +1,2 @@ +npm_versions in volta_core::inventory - Rust
pub fn npm_versions() -> Fallible<BTreeSet<Version>>
Expand description

Collects a set of all npm versions fetched on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.package_configs.html b/main/volta_core/inventory/fn.package_configs.html new file mode 100644 index 000000000..3951e8600 --- /dev/null +++ b/main/volta_core/inventory/fn.package_configs.html @@ -0,0 +1,2 @@ +package_configs in volta_core::inventory - Rust
pub fn package_configs() -> Fallible<BTreeSet<PackageConfig>>
Expand description

Collects a set of all Package Configs on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.pnpm_available.html b/main/volta_core/inventory/fn.pnpm_available.html new file mode 100644 index 000000000..6bc35ad2b --- /dev/null +++ b/main/volta_core/inventory/fn.pnpm_available.html @@ -0,0 +1,2 @@ +pnpm_available in volta_core::inventory - Rust
pub fn pnpm_available(version: &Version) -> Fallible<bool>
Expand description

Checks if a given pnpm version image is available on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.pnpm_versions.html b/main/volta_core/inventory/fn.pnpm_versions.html new file mode 100644 index 000000000..4e3432f39 --- /dev/null +++ b/main/volta_core/inventory/fn.pnpm_versions.html @@ -0,0 +1,2 @@ +pnpm_versions in volta_core::inventory - Rust
pub fn pnpm_versions() -> Fallible<BTreeSet<Version>>
Expand description

Collects a set of all pnpm versions fetched on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.read_versions.html b/main/volta_core/inventory/fn.read_versions.html new file mode 100644 index 000000000..395c8278e --- /dev/null +++ b/main/volta_core/inventory/fn.read_versions.html @@ -0,0 +1,3 @@ +read_versions in volta_core::inventory - Rust
fn read_versions(dir: &Path) -> Fallible<BTreeSet<Version>>
Expand description

Reads the contents of a directory and returns the set of all versions found +in the directory’s listing by parsing the directory names as semantic versions

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.yarn_available.html b/main/volta_core/inventory/fn.yarn_available.html new file mode 100644 index 000000000..d3f350469 --- /dev/null +++ b/main/volta_core/inventory/fn.yarn_available.html @@ -0,0 +1,2 @@ +yarn_available in volta_core::inventory - Rust
pub fn yarn_available(version: &Version) -> Fallible<bool>
Expand description

Checks if a given Yarn version image is available on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/fn.yarn_versions.html b/main/volta_core/inventory/fn.yarn_versions.html new file mode 100644 index 000000000..89cf734ac --- /dev/null +++ b/main/volta_core/inventory/fn.yarn_versions.html @@ -0,0 +1,2 @@ +yarn_versions in volta_core::inventory - Rust
pub fn yarn_versions() -> Fallible<BTreeSet<Version>>
Expand description

Collects a set of all Yarn versions fetched on the local machine

+
\ No newline at end of file diff --git a/main/volta_core/inventory/index.html b/main/volta_core/inventory/index.html new file mode 100644 index 000000000..54569a788 --- /dev/null +++ b/main/volta_core/inventory/index.html @@ -0,0 +1,4 @@ +volta_core::inventory - Rust

Module volta_core::inventory

source ·
Expand description

Provides types for working with Volta’s inventory, the local repository +of available tool versions.

+

Functions

  • Checks if a given Node version image is available on the local machine
  • Collects a set of all Node versions fetched on the local machine
  • Checks if a given npm version image is available on the local machine
  • Collects a set of all npm versions fetched on the local machine
  • Collects a set of all Package Configs on the local machine
  • Checks if a given pnpm version image is available on the local machine
  • Collects a set of all pnpm versions fetched on the local machine
  • Reads the contents of a directory and returns the set of all versions found +in the directory’s listing by parsing the directory names as semantic versions
  • Checks if a given Yarn version image is available on the local machine
  • Collects a set of all Yarn versions fetched on the local machine
\ No newline at end of file diff --git a/main/volta_core/inventory/sidebar-items.js b/main/volta_core/inventory/sidebar-items.js new file mode 100644 index 000000000..8f525a608 --- /dev/null +++ b/main/volta_core/inventory/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["node_available","node_versions","npm_available","npm_versions","package_configs","pnpm_available","pnpm_versions","read_versions","yarn_available","yarn_versions"]}; \ No newline at end of file diff --git a/main/volta_core/layout/fn.default_install_dir.html b/main/volta_core/layout/fn.default_install_dir.html new file mode 100644 index 000000000..1e1defc31 --- /dev/null +++ b/main/volta_core/layout/fn.default_install_dir.html @@ -0,0 +1,6 @@ +default_install_dir in volta_core::layout - Rust
fn default_install_dir() -> Fallible<PathBuf>
Expand description

Determine the binary install directory from the currently running executable

+

The volta-shim and volta binaries will be installed in the same location, so we can use the +currently running executable to find the binary install directory. Note that we need to +canonicalize the path we get from current_exe to make sure we resolve symlinks and find the +actual binary files

+
\ No newline at end of file diff --git a/main/volta_core/layout/fn.env_paths.html b/main/volta_core/layout/fn.env_paths.html new file mode 100644 index 000000000..f782b3d0c --- /dev/null +++ b/main/volta_core/layout/fn.env_paths.html @@ -0,0 +1 @@ +env_paths in volta_core::layout - Rust

Function volta_core::layout::env_paths

source ·
pub fn env_paths() -> Fallible<Vec<PathBuf>>
\ No newline at end of file diff --git a/main/volta_core/layout/fn.volta_home.html b/main/volta_core/layout/fn.volta_home.html new file mode 100644 index 000000000..207d34fc0 --- /dev/null +++ b/main/volta_core/layout/fn.volta_home.html @@ -0,0 +1 @@ +volta_home in volta_core::layout - Rust

Function volta_core::layout::volta_home

source ·
pub fn volta_home<'a>() -> Fallible<&'a VoltaHome>
\ No newline at end of file diff --git a/main/volta_core/layout/fn.volta_install.html b/main/volta_core/layout/fn.volta_install.html new file mode 100644 index 000000000..c8d252d15 --- /dev/null +++ b/main/volta_core/layout/fn.volta_install.html @@ -0,0 +1 @@ +volta_install in volta_core::layout - Rust
pub fn volta_install<'a>() -> Fallible<&'a VoltaInstall>
\ No newline at end of file diff --git a/main/volta_core/layout/index.html b/main/volta_core/layout/index.html new file mode 100644 index 000000000..9e3ede2f6 --- /dev/null +++ b/main/volta_core/layout/index.html @@ -0,0 +1 @@ +volta_core::layout - Rust

Module volta_core::layout

source ·

Modules

Statics

Functions

\ No newline at end of file diff --git a/main/volta_core/layout/sidebar-items.js b/main/volta_core/layout/sidebar-items.js new file mode 100644 index 000000000..869ff1249 --- /dev/null +++ b/main/volta_core/layout/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["default_install_dir","env_paths","volta_home","volta_install"],"mod":["unix"],"static":["VOLTA_HOME","VOLTA_INSTALL"]}; \ No newline at end of file diff --git a/main/volta_core/layout/static.VOLTA_HOME.html b/main/volta_core/layout/static.VOLTA_HOME.html new file mode 100644 index 000000000..e4981de53 --- /dev/null +++ b/main/volta_core/layout/static.VOLTA_HOME.html @@ -0,0 +1 @@ +VOLTA_HOME in volta_core::layout - Rust
static VOLTA_HOME: OnceCell<VoltaHome>
\ No newline at end of file diff --git a/main/volta_core/layout/static.VOLTA_INSTALL.html b/main/volta_core/layout/static.VOLTA_INSTALL.html new file mode 100644 index 000000000..c8f9deeab --- /dev/null +++ b/main/volta_core/layout/static.VOLTA_INSTALL.html @@ -0,0 +1 @@ +VOLTA_INSTALL in volta_core::layout - Rust
static VOLTA_INSTALL: OnceCell<VoltaInstall>
\ No newline at end of file diff --git a/main/volta_core/layout/unix/fn.default_home_dir.html b/main/volta_core/layout/unix/fn.default_home_dir.html new file mode 100644 index 000000000..c5dfc46d9 --- /dev/null +++ b/main/volta_core/layout/unix/fn.default_home_dir.html @@ -0,0 +1 @@ +default_home_dir in volta_core::layout::unix - Rust
pub(super) fn default_home_dir() -> Fallible<PathBuf>
\ No newline at end of file diff --git a/main/volta_core/layout/unix/fn.env_paths.html b/main/volta_core/layout/unix/fn.env_paths.html new file mode 100644 index 000000000..8179129ef --- /dev/null +++ b/main/volta_core/layout/unix/fn.env_paths.html @@ -0,0 +1 @@ +env_paths in volta_core::layout::unix - Rust

Function volta_core::layout::unix::env_paths

source ·
pub fn env_paths() -> Fallible<Vec<PathBuf>>
\ No newline at end of file diff --git a/main/volta_core/layout/unix/index.html b/main/volta_core/layout/unix/index.html new file mode 100644 index 000000000..99b94f76c --- /dev/null +++ b/main/volta_core/layout/unix/index.html @@ -0,0 +1 @@ +volta_core::layout::unix - Rust
\ No newline at end of file diff --git a/main/volta_core/layout/unix/sidebar-items.js b/main/volta_core/layout/unix/sidebar-items.js new file mode 100644 index 000000000..7d04799bf --- /dev/null +++ b/main/volta_core/layout/unix/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["default_home_dir","env_paths"]}; \ No newline at end of file diff --git a/main/volta_core/log/constant.ALLOWED_PREFIXES.html b/main/volta_core/log/constant.ALLOWED_PREFIXES.html new file mode 100644 index 000000000..679adbcd3 --- /dev/null +++ b/main/volta_core/log/constant.ALLOWED_PREFIXES.html @@ -0,0 +1 @@ +ALLOWED_PREFIXES in volta_core::log - Rust
const ALLOWED_PREFIXES: [&str; 5];
\ No newline at end of file diff --git a/main/volta_core/log/constant.ERROR_PREFIX.html b/main/volta_core/log/constant.ERROR_PREFIX.html new file mode 100644 index 000000000..3a5c1f5e1 --- /dev/null +++ b/main/volta_core/log/constant.ERROR_PREFIX.html @@ -0,0 +1 @@ +ERROR_PREFIX in volta_core::log - Rust

Constant volta_core::log::ERROR_PREFIX

source ·
const ERROR_PREFIX: &str = "error:";
\ No newline at end of file diff --git a/main/volta_core/log/constant.MIGRATION_ERROR_PREFIX.html b/main/volta_core/log/constant.MIGRATION_ERROR_PREFIX.html new file mode 100644 index 000000000..45f3a9357 --- /dev/null +++ b/main/volta_core/log/constant.MIGRATION_ERROR_PREFIX.html @@ -0,0 +1 @@ +MIGRATION_ERROR_PREFIX in volta_core::log - Rust
const MIGRATION_ERROR_PREFIX: &str = "Volta update error:";
\ No newline at end of file diff --git a/main/volta_core/log/constant.MIGRATION_WARNING_PREFIX.html b/main/volta_core/log/constant.MIGRATION_WARNING_PREFIX.html new file mode 100644 index 000000000..29c97245c --- /dev/null +++ b/main/volta_core/log/constant.MIGRATION_WARNING_PREFIX.html @@ -0,0 +1 @@ +MIGRATION_WARNING_PREFIX in volta_core::log - Rust
const MIGRATION_WARNING_PREFIX: &str = "Volta update warning:";
\ No newline at end of file diff --git a/main/volta_core/log/constant.SHIM_ERROR_PREFIX.html b/main/volta_core/log/constant.SHIM_ERROR_PREFIX.html new file mode 100644 index 000000000..191bd4e55 --- /dev/null +++ b/main/volta_core/log/constant.SHIM_ERROR_PREFIX.html @@ -0,0 +1 @@ +SHIM_ERROR_PREFIX in volta_core::log - Rust
const SHIM_ERROR_PREFIX: &str = "Volta error:";
\ No newline at end of file diff --git a/main/volta_core/log/constant.SHIM_WARNING_PREFIX.html b/main/volta_core/log/constant.SHIM_WARNING_PREFIX.html new file mode 100644 index 000000000..9907fc1a7 --- /dev/null +++ b/main/volta_core/log/constant.SHIM_WARNING_PREFIX.html @@ -0,0 +1 @@ +SHIM_WARNING_PREFIX in volta_core::log - Rust
const SHIM_WARNING_PREFIX: &str = "Volta warning:";
\ No newline at end of file diff --git a/main/volta_core/log/constant.VOLTA_LOGLEVEL.html b/main/volta_core/log/constant.VOLTA_LOGLEVEL.html new file mode 100644 index 000000000..941a889f7 --- /dev/null +++ b/main/volta_core/log/constant.VOLTA_LOGLEVEL.html @@ -0,0 +1 @@ +VOLTA_LOGLEVEL in volta_core::log - Rust

Constant volta_core::log::VOLTA_LOGLEVEL

source ·
const VOLTA_LOGLEVEL: &str = "VOLTA_LOGLEVEL";
\ No newline at end of file diff --git a/main/volta_core/log/constant.WARNING_PREFIX.html b/main/volta_core/log/constant.WARNING_PREFIX.html new file mode 100644 index 000000000..5a708be63 --- /dev/null +++ b/main/volta_core/log/constant.WARNING_PREFIX.html @@ -0,0 +1 @@ +WARNING_PREFIX in volta_core::log - Rust

Constant volta_core::log::WARNING_PREFIX

source ·
const WARNING_PREFIX: &str = "warning:";
\ No newline at end of file diff --git a/main/volta_core/log/constant.WRAP_INDENT.html b/main/volta_core/log/constant.WRAP_INDENT.html new file mode 100644 index 000000000..75634d784 --- /dev/null +++ b/main/volta_core/log/constant.WRAP_INDENT.html @@ -0,0 +1 @@ +WRAP_INDENT in volta_core::log - Rust

Constant volta_core::log::WRAP_INDENT

source ·
const WRAP_INDENT: &str = "    ";
\ No newline at end of file diff --git a/main/volta_core/log/enum.LogContext.html b/main/volta_core/log/enum.LogContext.html new file mode 100644 index 000000000..0205aace3 --- /dev/null +++ b/main/volta_core/log/enum.LogContext.html @@ -0,0 +1,20 @@ +LogContext in volta_core::log - Rust
pub enum LogContext {
+    Volta,
+    Shim,
+    Migration,
+}
Expand description

Represents the context from which the logger was created

+

Variants§

§

Volta

Log messages from the volta executable

+
§

Shim

Log messages from one of the shims

+
§

Migration

Log messages from the migration

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/log/enum.LogVerbosity.html b/main/volta_core/log/enum.LogVerbosity.html new file mode 100644 index 000000000..bfb01354c --- /dev/null +++ b/main/volta_core/log/enum.LogVerbosity.html @@ -0,0 +1,19 @@ +LogVerbosity in volta_core::log - Rust
pub enum LogVerbosity {
+    Quiet,
+    Default,
+    Verbose,
+    VeryVerbose,
+}
Expand description

Represents the level of verbosity that was requested by the user

+

Variants§

§

Quiet

§

Default

§

Verbose

§

VeryVerbose

Trait Implementations§

source§

impl Clone for LogVerbosity

source§

fn clone(&self) -> LogVerbosity

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LogVerbosity

source§

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

Formats the value using the given formatter. Read more
source§

impl Copy for LogVerbosity

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/log/fn.level_from_env.html b/main/volta_core/log/fn.level_from_env.html new file mode 100644 index 000000000..f2f72e1d0 --- /dev/null +++ b/main/volta_core/log/fn.level_from_env.html @@ -0,0 +1,6 @@ +level_from_env in volta_core::log - Rust

Function volta_core::log::level_from_env

source ·
fn level_from_env() -> LevelFilter
Expand description

Determines the correct logging level based on the environment +If VOLTA_LOGLEVEL is set to a valid level, we use that +If not, we check the current stdout to determine whether it is a TTY or not +If it is a TTY, we use Info +If it is NOT a TTY, we use Error as we don’t want to show warnings when running as a script

+
\ No newline at end of file diff --git a/main/volta_core/log/fn.wrap_content.html b/main/volta_core/log/fn.wrap_content.html new file mode 100644 index 000000000..56012a2e7 --- /dev/null +++ b/main/volta_core/log/fn.wrap_content.html @@ -0,0 +1,6 @@ +wrap_content in volta_core::log - Rust

Function volta_core::log::wrap_content

source ·
fn wrap_content<D>(prefix: &str, content: &D) -> Stringwhere
+    D: Display,
Expand description

Wraps the supplied content to the terminal width, if we are in a terminal. +If not, returns the content as a String

+

Note: Uses the supplied prefix to calculate the terminal width, but then removes +it so that it can be styled (style characters are counted against the wrapped width)

+
\ No newline at end of file diff --git a/main/volta_core/log/index.html b/main/volta_core/log/index.html new file mode 100644 index 000000000..718f18fd4 --- /dev/null +++ b/main/volta_core/log/index.html @@ -0,0 +1,7 @@ +volta_core::log - Rust

Module volta_core::log

source ·
Expand description

This module provides a custom Logger implementation for use with the log crate

+

Structs

Enums

  • Represents the context from which the logger was created
  • Represents the level of verbosity that was requested by the user

Constants

Functions

  • Determines the correct logging level based on the environment +If VOLTA_LOGLEVEL is set to a valid level, we use that +If not, we check the current stdout to determine whether it is a TTY or not +If it is a TTY, we use Info +If it is NOT a TTY, we use Error as we don’t want to show warnings when running as a script
  • Wraps the supplied content to the terminal width, if we are in a terminal. +If not, returns the content as a String
\ No newline at end of file diff --git a/main/volta_core/log/sidebar-items.js b/main/volta_core/log/sidebar-items.js new file mode 100644 index 000000000..ca9a92041 --- /dev/null +++ b/main/volta_core/log/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["ALLOWED_PREFIXES","ERROR_PREFIX","MIGRATION_ERROR_PREFIX","MIGRATION_WARNING_PREFIX","SHIM_ERROR_PREFIX","SHIM_WARNING_PREFIX","VOLTA_LOGLEVEL","WARNING_PREFIX","WRAP_INDENT"],"enum":["LogContext","LogVerbosity"],"fn":["level_from_env","wrap_content"],"struct":["Logger"]}; \ No newline at end of file diff --git a/main/volta_core/log/struct.Logger.html b/main/volta_core/log/struct.Logger.html new file mode 100644 index 000000000..dbb4c8c7d --- /dev/null +++ b/main/volta_core/log/struct.Logger.html @@ -0,0 +1,24 @@ +Logger in volta_core::log - Rust

Struct volta_core::log::Logger

source ·
pub struct Logger {
+    context: LogContext,
+    level: LevelFilter,
+}

Fields§

§context: LogContext§level: LevelFilter

Implementations§

source§

impl Logger

source

pub fn init( + context: LogContext, + verbosity: LogVerbosity +) -> Result<(), SetLoggerError>

Initialize the global logger with a Logger instance +Will use the requested level of Verbosity +If set to Default, will use the environment to determine the level of verbosity

+
source

fn new(context: LogContext, verbosity: LogVerbosity) -> Self

source

fn log_error<D>(&self, message: &D)where + D: Display,

source

fn log_warning<D>(&self, message: &D)where + D: Display,

Trait Implementations§

source§

impl Log for Logger

source§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be +logged. Read more
source§

fn log(&self, record: &Record<'_>)

Logs the Record. Read more
source§

fn flush(&self)

Flushes any buffered records. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/monitor/fn.send_events.html b/main/volta_core/monitor/fn.send_events.html new file mode 100644 index 000000000..fdac9869a --- /dev/null +++ b/main/volta_core/monitor/fn.send_events.html @@ -0,0 +1,2 @@ +send_events in volta_core::monitor - Rust
pub fn send_events(command: &str, events: &[Event])
Expand description

Send event to the spawned command process

+
\ No newline at end of file diff --git a/main/volta_core/monitor/fn.spawn_process.html b/main/volta_core/monitor/fn.spawn_process.html new file mode 100644 index 000000000..f635e7bcd --- /dev/null +++ b/main/volta_core/monitor/fn.spawn_process.html @@ -0,0 +1 @@ +spawn_process in volta_core::monitor - Rust
fn spawn_process(command: &str, tempfile_path: Option<PathBuf>) -> Option<Child>
\ No newline at end of file diff --git a/main/volta_core/monitor/fn.write_events_file.html b/main/volta_core/monitor/fn.write_events_file.html new file mode 100644 index 000000000..87204edb9 --- /dev/null +++ b/main/volta_core/monitor/fn.write_events_file.html @@ -0,0 +1 @@ +write_events_file in volta_core::monitor - Rust
fn write_events_file(events_json: String) -> Option<PathBuf>
\ No newline at end of file diff --git a/main/volta_core/monitor/index.html b/main/volta_core/monitor/index.html new file mode 100644 index 000000000..4de94669c --- /dev/null +++ b/main/volta_core/monitor/index.html @@ -0,0 +1 @@ +volta_core::monitor - Rust

Module volta_core::monitor

source ·

Functions

\ No newline at end of file diff --git a/main/volta_core/monitor/sidebar-items.js b/main/volta_core/monitor/sidebar-items.js new file mode 100644 index 000000000..89099076a --- /dev/null +++ b/main/volta_core/monitor/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["send_events","spawn_process","write_events_file"]}; \ No newline at end of file diff --git a/main/volta_core/platform/enum.InheritOption.html b/main/volta_core/platform/enum.InheritOption.html new file mode 100644 index 000000000..c2fc218b3 --- /dev/null +++ b/main/volta_core/platform/enum.InheritOption.html @@ -0,0 +1,26 @@ +InheritOption in volta_core::platform - Rust
pub enum InheritOption<T> {
+    Some(T),
+    None,
+    Inherit,
+}
Expand description

Represents 3 possible states: Having a value, not having a value, and inheriting a value

+

Variants§

§

Some(T)

§

None

§

Inherit

Implementations§

source§

impl<T> InheritOption<T>

source

pub fn map<U, F>(self, f: F) -> InheritOption<U>where + F: FnOnce(T) -> U,

Applies a function to the contained value (if any)

+
source

pub fn inherit(self, other: Option<T>) -> Option<T>

Converts the InheritOption into a regular Option by inheriting from the provided value if needed

+

Trait Implementations§

source§

impl<T: Clone> Clone for InheritOption<T>

source§

fn clone(&self) -> InheritOption<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Default for InheritOption<T>

source§

fn default() -> InheritOption<T>

Returns the “default value” for a type. Read more
source§

impl<T> From<InheritOption<T>> for Option<T>

source§

fn from(base: InheritOption<T>) -> Option<T>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for InheritOption<T>where + T: RefUnwindSafe,

§

impl<T> Send for InheritOption<T>where + T: Send,

§

impl<T> Sync for InheritOption<T>where + T: Sync,

§

impl<T> Unpin for InheritOption<T>where + T: Unpin,

§

impl<T> UnwindSafe for InheritOption<T>where + T: UnwindSafe,

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/enum.Source.html b/main/volta_core/platform/enum.Source.html new file mode 100644 index 000000000..0a67525da --- /dev/null +++ b/main/volta_core/platform/enum.Source.html @@ -0,0 +1,24 @@ +Source in volta_core::platform - Rust
pub enum Source {
+    Default,
+    Project,
+    Binary,
+    CommandLine,
+}
Expand description

The source with which a version is associated

+

Variants§

§

Default

Represents a version from the user default platform

+
§

Project

Represents a version from a project manifest

+
§

Binary

Represents a version from a pinned Binary platform

+
§

CommandLine

Represents a version from the command line (via volta run)

+

Trait Implementations§

source§

impl Clone for Source

source§

fn clone(&self) -> Source

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Display for Source

source§

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

Formats the value using the given formatter. Read more
source§

impl Copy for Source

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/fn.build_path_error.html b/main/volta_core/platform/fn.build_path_error.html new file mode 100644 index 000000000..b49acd22b --- /dev/null +++ b/main/volta_core/platform/fn.build_path_error.html @@ -0,0 +1 @@ +build_path_error in volta_core::platform - Rust
fn build_path_error() -> ErrorKind
\ No newline at end of file diff --git a/main/volta_core/platform/image/index.html b/main/volta_core/platform/image/index.html new file mode 100644 index 000000000..a57975fc3 --- /dev/null +++ b/main/volta_core/platform/image/index.html @@ -0,0 +1 @@ +volta_core::platform::image - Rust

Module volta_core::platform::image

source ·

Structs

\ No newline at end of file diff --git a/main/volta_core/platform/image/sidebar-items.js b/main/volta_core/platform/image/sidebar-items.js new file mode 100644 index 000000000..0a842a22f --- /dev/null +++ b/main/volta_core/platform/image/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Image"]}; \ No newline at end of file diff --git a/main/volta_core/platform/image/struct.Image.html b/main/volta_core/platform/image/struct.Image.html new file mode 100644 index 000000000..5c3197792 --- /dev/null +++ b/main/volta_core/platform/image/struct.Image.html @@ -0,0 +1,26 @@ +Image in volta_core::platform::image - Rust
pub struct Image {
+    pub node: Sourced<Version>,
+    pub npm: Option<Sourced<Version>>,
+    pub pnpm: Option<Sourced<Version>>,
+    pub yarn: Option<Sourced<Version>>,
+}
Expand description

A platform image.

+

Fields§

§node: Sourced<Version>

The pinned version of Node.

+
§npm: Option<Sourced<Version>>

The custom version of npm, if any. None represents using the npm that is bundled with Node

+
§pnpm: Option<Sourced<Version>>

The pinned version of pnpm, if any.

+
§yarn: Option<Sourced<Version>>

The pinned version of Yarn, if any.

+

Implementations§

source§

impl Image

source

fn bins(&self) -> Fallible<Vec<PathBuf>>

source

pub fn path(&self) -> Fallible<OsString>

Produces a modified version of the current PATH environment variable that +will find toolchain executables (Node, npm, pnpm, Yarn) in the installation directories +for the given versions instead of in the Volta shim directory.

+
source

pub fn resolve_npm(&self) -> Fallible<Sourced<Version>>

Determines the sourced version of npm that will be available, resolving the version bundled with Node, if needed

+

Auto Trait Implementations§

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/index.html b/main/volta_core/platform/index.html new file mode 100644 index 000000000..0e7c4ca31 --- /dev/null +++ b/main/volta_core/platform/index.html @@ -0,0 +1,2 @@ +volta_core::platform - Rust

Module volta_core::platform

source ·

Modules

Structs

  • Represents a (maybe) platform with values from the command line
  • A platform image.
  • Represents a real Platform, with Versions pulled from one or more PlatformSpecs
  • Represents the specification of a single Platform, regardless of the source
  • A lightweight namespace type representing the system environment, i.e. the environment +with Volta removed.

Enums

  • Represents 3 possible states: Having a value, not having a value, and inheriting a value
  • The source with which a version is associated

Functions

\ No newline at end of file diff --git a/main/volta_core/platform/sidebar-items.js b/main/volta_core/platform/sidebar-items.js new file mode 100644 index 000000000..74e77115e --- /dev/null +++ b/main/volta_core/platform/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["InheritOption","Source"],"fn":["build_path_error"],"mod":["image","system"],"struct":["CliPlatform","Image","Platform","PlatformSpec","Sourced","System"]}; \ No newline at end of file diff --git a/main/volta_core/platform/struct.CliPlatform.html b/main/volta_core/platform/struct.CliPlatform.html new file mode 100644 index 000000000..6cf5d71e4 --- /dev/null +++ b/main/volta_core/platform/struct.CliPlatform.html @@ -0,0 +1,21 @@ +CliPlatform in volta_core::platform - Rust
pub struct CliPlatform {
+    pub node: Option<Version>,
+    pub npm: InheritOption<Version>,
+    pub pnpm: InheritOption<Version>,
+    pub yarn: InheritOption<Version>,
+}
Expand description

Represents a (maybe) platform with values from the command line

+

Fields§

§node: Option<Version>§npm: InheritOption<Version>§pnpm: InheritOption<Version>§yarn: InheritOption<Version>

Implementations§

source§

impl CliPlatform

source

pub fn merge(self, base: Platform) -> Platform

Merges the CliPlatform with a Platform, inheriting from the base where needed

+

Trait Implementations§

source§

impl Clone for CliPlatform

source§

fn clone(&self) -> CliPlatform

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl From<CliPlatform> for Option<Platform>

source§

fn from(base: CliPlatform) -> Option<Platform>

Converts the CliPlatform into a possible Platform without a base from which to inherit

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/struct.Image.html b/main/volta_core/platform/struct.Image.html new file mode 100644 index 000000000..a23b65e5d --- /dev/null +++ b/main/volta_core/platform/struct.Image.html @@ -0,0 +1,26 @@ +Image in volta_core::platform - Rust

Struct volta_core::platform::Image

source ·
pub struct Image {
+    pub node: Sourced<Version>,
+    pub npm: Option<Sourced<Version>>,
+    pub pnpm: Option<Sourced<Version>>,
+    pub yarn: Option<Sourced<Version>>,
+}
Expand description

A platform image.

+

Fields§

§node: Sourced<Version>

The pinned version of Node.

+
§npm: Option<Sourced<Version>>

The custom version of npm, if any. None represents using the npm that is bundled with Node

+
§pnpm: Option<Sourced<Version>>

The pinned version of pnpm, if any.

+
§yarn: Option<Sourced<Version>>

The pinned version of Yarn, if any.

+

Implementations§

source§

impl Image

source

fn bins(&self) -> Fallible<Vec<PathBuf>>

source

pub fn path(&self) -> Fallible<OsString>

Produces a modified version of the current PATH environment variable that +will find toolchain executables (Node, npm, pnpm, Yarn) in the installation directories +for the given versions instead of in the Volta shim directory.

+
source

pub fn resolve_npm(&self) -> Fallible<Sourced<Version>>

Determines the sourced version of npm that will be available, resolving the version bundled with Node, if needed

+

Auto Trait Implementations§

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/struct.Platform.html b/main/volta_core/platform/struct.Platform.html new file mode 100644 index 000000000..aa97e209e --- /dev/null +++ b/main/volta_core/platform/struct.Platform.html @@ -0,0 +1,33 @@ +Platform in volta_core::platform - Rust
pub struct Platform {
+    pub node: Sourced<Version>,
+    pub npm: Option<Sourced<Version>>,
+    pub pnpm: Option<Sourced<Version>>,
+    pub yarn: Option<Sourced<Version>>,
+}
Expand description

Represents a real Platform, with Versions pulled from one or more PlatformSpecs

+

Fields§

§node: Sourced<Version>§npm: Option<Sourced<Version>>§pnpm: Option<Sourced<Version>>§yarn: Option<Sourced<Version>>

Implementations§

source§

impl Platform

source

pub fn current(session: &mut Session) -> Fallible<Option<Self>>

Returns the user’s currently active platform, if any

+

Active platform is determined by first looking at the Project Platform

+
    +
  • If there is a project platform then we use it +
      +
    • If there is no pnpm/Yarn version in the project platform, we pull +pnpm/Yarn from the default platform if available, and merge the two +platforms into a final one
    • +
    +
  • +
  • If there is no Project platform, then we use the user Default Platform
  • +
+
source

pub fn checkout(self, session: &mut Session) -> Fallible<Image>

Check out a Platform into a fully-realized Image

+

This will ensure that all necessary tools are fetched and available for execution

+

Trait Implementations§

source§

impl Clone for Platform

source§

fn clone(&self) -> Platform

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/struct.PlatformSpec.html b/main/volta_core/platform/struct.PlatformSpec.html new file mode 100644 index 000000000..375153eef --- /dev/null +++ b/main/volta_core/platform/struct.PlatformSpec.html @@ -0,0 +1,37 @@ +PlatformSpec in volta_core::platform - Rust
pub struct PlatformSpec {
+    pub node: Version,
+    pub npm: Option<Version>,
+    pub pnpm: Option<Version>,
+    pub yarn: Option<Version>,
+}
Expand description

Represents the specification of a single Platform, regardless of the source

+

Fields§

§node: Version§npm: Option<Version>§pnpm: Option<Version>§yarn: Option<Version>

Implementations§

source§

impl PlatformSpec

source

pub fn as_default(&self) -> Platform

Convert this PlatformSpec into a Platform with all sources set to Default

+
source

pub fn as_project(&self) -> Platform

Convert this PlatformSpec into a Platform with all sources set to Project

+
source

pub fn as_binary(&self) -> Platform

Convert this PlatformSpec into a Platform with all sources set to Binary

+

Trait Implementations§

source§

impl Clone for PlatformSpec

source§

fn clone(&self) -> PlatformSpec

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Ord for PlatformSpec

source§

fn cmp(&self, other: &PlatformSpec) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for PlatformSpec

source§

fn eq(&self, other: &PlatformSpec) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PlatformSpec

source§

fn partial_cmp(&self, other: &PlatformSpec) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl TryFrom<PartialPlatform> for PlatformSpec

§

type Error = VoltaError

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

fn try_from(partial: PartialPlatform) -> Fallible<PlatformSpec>

Performs the conversion.
source§

impl Eq for PlatformSpec

source§

impl StructuralEq for PlatformSpec

source§

impl StructuralPartialEq for PlatformSpec

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/struct.Sourced.html b/main/volta_core/platform/struct.Sourced.html new file mode 100644 index 000000000..ba6f64b52 --- /dev/null +++ b/main/volta_core/platform/struct.Sourced.html @@ -0,0 +1,23 @@ +Sourced in volta_core::platform - Rust
pub struct Sourced<T> {
+    pub value: T,
+    pub source: Source,
+}

Fields§

§value: T§source: Source

Implementations§

source§

impl<T> Sourced<T>

source

pub fn with_default(value: T) -> Self

source

pub fn with_project(value: T) -> Self

source

pub fn with_binary(value: T) -> Self

source

pub fn with_command_line(value: T) -> Self

source§

impl<T> Sourced<T>

source

pub fn as_ref(&self) -> Sourced<&T>

source§

impl<T> Sourced<&T>where + T: Clone,

source

pub fn cloned(self) -> Sourced<T>

Trait Implementations§

source§

impl<T> Clone for Sourced<T>where + T: Clone,

source§

fn clone(&self) -> Sourced<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Sourced<T>where + T: RefUnwindSafe,

§

impl<T> Send for Sourced<T>where + T: Send,

§

impl<T> Sync for Sourced<T>where + T: Sync,

§

impl<T> Unpin for Sourced<T>where + T: Unpin,

§

impl<T> UnwindSafe for Sourced<T>where + T: UnwindSafe,

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/struct.System.html b/main/volta_core/platform/struct.System.html new file mode 100644 index 000000000..303ccad90 --- /dev/null +++ b/main/volta_core/platform/struct.System.html @@ -0,0 +1,17 @@ +System in volta_core::platform - Rust

Struct volta_core::platform::System

source ·
pub struct System;
Expand description

A lightweight namespace type representing the system environment, i.e. the environment +with Volta removed.

+

Implementations§

source§

impl System

source

pub fn path() -> Fallible<OsString>

Produces a modified version of the current PATH environment variable that +removes the Volta shims and binaries, to use for running system node and +executables.

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/platform/system/index.html b/main/volta_core/platform/system/index.html new file mode 100644 index 000000000..bc4857c19 --- /dev/null +++ b/main/volta_core/platform/system/index.html @@ -0,0 +1,2 @@ +volta_core::platform::system - Rust

Module volta_core::platform::system

source ·

Structs

  • A lightweight namespace type representing the system environment, i.e. the environment +with Volta removed.
\ No newline at end of file diff --git a/main/volta_core/platform/system/sidebar-items.js b/main/volta_core/platform/system/sidebar-items.js new file mode 100644 index 000000000..385d8d867 --- /dev/null +++ b/main/volta_core/platform/system/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["System"]}; \ No newline at end of file diff --git a/main/volta_core/platform/system/struct.System.html b/main/volta_core/platform/system/struct.System.html new file mode 100644 index 000000000..178ebf205 --- /dev/null +++ b/main/volta_core/platform/system/struct.System.html @@ -0,0 +1,17 @@ +System in volta_core::platform::system - Rust
pub struct System;
Expand description

A lightweight namespace type representing the system environment, i.e. the environment +with Volta removed.

+

Implementations§

source§

impl System

source

pub fn path() -> Fallible<OsString>

Produces a modified version of the current PATH environment variable that +removes the Volta shims and binaries, to use for running system node and +executables.

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/project/fn.find_closest_root.html b/main/volta_core/project/fn.find_closest_root.html new file mode 100644 index 000000000..088f24be0 --- /dev/null +++ b/main/volta_core/project/fn.find_closest_root.html @@ -0,0 +1,2 @@ +find_closest_root in volta_core::project - Rust
pub(crate) fn find_closest_root(dir: PathBuf) -> Option<PathBuf>
Expand description

Starts at base_dir and walks up the directory tree until a package.json file is found

+
\ No newline at end of file diff --git a/main/volta_core/project/fn.is_dependency.html b/main/volta_core/project/fn.is_dependency.html new file mode 100644 index 000000000..b9c11416b --- /dev/null +++ b/main/volta_core/project/fn.is_dependency.html @@ -0,0 +1 @@ +is_dependency in volta_core::project - Rust
fn is_dependency(dir: &Path) -> bool
\ No newline at end of file diff --git a/main/volta_core/project/fn.is_node_modules.html b/main/volta_core/project/fn.is_node_modules.html new file mode 100644 index 000000000..9c646e06c --- /dev/null +++ b/main/volta_core/project/fn.is_node_modules.html @@ -0,0 +1 @@ +is_node_modules in volta_core::project - Rust
fn is_node_modules(dir: &Path) -> bool
\ No newline at end of file diff --git a/main/volta_core/project/fn.is_node_root.html b/main/volta_core/project/fn.is_node_root.html new file mode 100644 index 000000000..9825f2569 --- /dev/null +++ b/main/volta_core/project/fn.is_node_root.html @@ -0,0 +1 @@ +is_node_root in volta_core::project - Rust
fn is_node_root(dir: &Path) -> bool
\ No newline at end of file diff --git a/main/volta_core/project/fn.is_project_root.html b/main/volta_core/project/fn.is_project_root.html new file mode 100644 index 000000000..128f800bb --- /dev/null +++ b/main/volta_core/project/fn.is_project_root.html @@ -0,0 +1 @@ +is_project_root in volta_core::project - Rust
fn is_project_root(dir: &Path) -> bool
\ No newline at end of file diff --git a/main/volta_core/project/index.html b/main/volta_core/project/index.html new file mode 100644 index 000000000..20daf169d --- /dev/null +++ b/main/volta_core/project/index.html @@ -0,0 +1,3 @@ +volta_core::project - Rust

Module volta_core::project

source ·
Expand description

Provides the Project type, which represents a Node project tree in +the filesystem.

+

Modules

Structs

Functions

\ No newline at end of file diff --git a/main/volta_core/project/serial/enum.ManifestKey.html b/main/volta_core/project/serial/enum.ManifestKey.html new file mode 100644 index 000000000..2d5ac2678 --- /dev/null +++ b/main/volta_core/project/serial/enum.ManifestKey.html @@ -0,0 +1,18 @@ +ManifestKey in volta_core::project::serial - Rust
pub(super) enum ManifestKey {
+    Node,
+    Npm,
+    Pnpm,
+    Yarn,
+}

Variants§

§

Node

§

Npm

§

Pnpm

§

Yarn

Trait Implementations§

source§

impl Display for ManifestKey

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/project/serial/fn.update_manifest.html b/main/volta_core/project/serial/fn.update_manifest.html new file mode 100644 index 000000000..9dcdb7b01 --- /dev/null +++ b/main/volta_core/project/serial/fn.update_manifest.html @@ -0,0 +1,8 @@ +update_manifest in volta_core::project::serial - Rust
pub(super) fn update_manifest(
+    file: &Path,
+    key: ManifestKey,
+    value: Option<&Version>
+) -> Fallible<()>
Expand description

Updates the volta hash in the specified manifest with the given key and value

+

Will create the volta hash if it isn’t already present

+

If the value is None, will remove the key from the hash

+
\ No newline at end of file diff --git a/main/volta_core/project/serial/index.html b/main/volta_core/project/serial/index.html new file mode 100644 index 000000000..9e0868edc --- /dev/null +++ b/main/volta_core/project/serial/index.html @@ -0,0 +1 @@ +volta_core::project::serial - Rust

Module volta_core::project::serial

source ·

Structs

Enums

Functions

  • Updates the volta hash in the specified manifest with the given key and value

Type Aliases

\ No newline at end of file diff --git a/main/volta_core/project/serial/sidebar-items.js b/main/volta_core/project/serial/sidebar-items.js new file mode 100644 index 000000000..d7f7b0812 --- /dev/null +++ b/main/volta_core/project/serial/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ManifestKey"],"fn":["update_manifest"],"struct":["Manifest","RawManifest","ToolchainSpec"],"type":["DependencyMapIterator"]}; \ No newline at end of file diff --git a/main/volta_core/project/serial/struct.Manifest.html b/main/volta_core/project/serial/struct.Manifest.html new file mode 100644 index 000000000..47d3d4238 --- /dev/null +++ b/main/volta_core/project/serial/struct.Manifest.html @@ -0,0 +1,16 @@ +Manifest in volta_core::project::serial - Rust
pub(super) struct Manifest {
+    pub dependency_maps: Chain<IntoIter<HashMap<String, String>>, IntoIter<HashMap<String, String>>>,
+    pub platform: Option<PartialPlatform>,
+    pub extends: Option<PathBuf>,
+}

Fields§

§dependency_maps: Chain<IntoIter<HashMap<String, String>>, IntoIter<HashMap<String, String>>>§platform: Option<PartialPlatform>§extends: Option<PathBuf>

Implementations§

source§

impl Manifest

source

pub fn from_file(file: &Path) -> Fallible<Self>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/project/serial/struct.RawManifest.html b/main/volta_core/project/serial/struct.RawManifest.html new file mode 100644 index 000000000..207a784f9 --- /dev/null +++ b/main/volta_core/project/serial/struct.RawManifest.html @@ -0,0 +1,18 @@ +RawManifest in volta_core::project::serial - Rust
struct RawManifest {
+    dependencies: Option<HashMap<String, String>>,
+    dev_dependencies: Option<HashMap<String, String>>,
+    volta: Option<ToolchainSpec>,
+}

Fields§

§dependencies: Option<HashMap<String, String>>§dev_dependencies: Option<HashMap<String, String>>§volta: Option<ToolchainSpec>

Implementations§

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawManifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/project/serial/struct.ToolchainSpec.html b/main/volta_core/project/serial/struct.ToolchainSpec.html new file mode 100644 index 000000000..ff0ce4446 --- /dev/null +++ b/main/volta_core/project/serial/struct.ToolchainSpec.html @@ -0,0 +1,22 @@ +ToolchainSpec in volta_core::project::serial - Rust
struct ToolchainSpec {
+    node: Option<String>,
+    npm: Option<String>,
+    pnpm: Option<String>,
+    yarn: Option<String>,
+    extends: Option<PathBuf>,
+}

Fields§

§node: Option<String>§npm: Option<String>§pnpm: Option<String>§yarn: Option<String>§extends: Option<PathBuf>

Implementations§

source§

impl ToolchainSpec

source

fn parse_split(self) -> Fallible<(PartialPlatform, Option<PathBuf>)>

Moves the tool versions into a PartialPlatform and returns that along with the extends value

+

Trait Implementations§

source§

impl Default for ToolchainSpec

source§

fn default() -> ToolchainSpec

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for ToolchainSpec

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for ToolchainSpec

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/project/serial/type.DependencyMapIterator.html b/main/volta_core/project/serial/type.DependencyMapIterator.html new file mode 100644 index 000000000..f5e59ba20 --- /dev/null +++ b/main/volta_core/project/serial/type.DependencyMapIterator.html @@ -0,0 +1,4 @@ +DependencyMapIterator in volta_core::project::serial - Rust
pub type DependencyMapIterator = Chain<IntoIter<HashMap<String, String>>, IntoIter<HashMap<String, String>>>;

Aliased Type§

struct DependencyMapIterator {
+    a: Option<IntoIter<HashMap<String, String>>>,
+    b: Option<IntoIter<HashMap<String, String>>>,
+}

Fields§

§a: Option<IntoIter<HashMap<String, String>>>§b: Option<IntoIter<HashMap<String, String>>>
\ No newline at end of file diff --git a/main/volta_core/project/sidebar-items.js b/main/volta_core/project/sidebar-items.js new file mode 100644 index 000000000..402a6337d --- /dev/null +++ b/main/volta_core/project/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["find_closest_root","is_dependency","is_node_modules","is_node_root","is_project_root"],"mod":["serial"],"struct":["LazyProject","PartialPlatform","Project"]}; \ No newline at end of file diff --git a/main/volta_core/project/struct.LazyProject.html b/main/volta_core/project/struct.LazyProject.html new file mode 100644 index 000000000..b05301a6f --- /dev/null +++ b/main/volta_core/project/struct.LazyProject.html @@ -0,0 +1,15 @@ +LazyProject in volta_core::project - Rust
pub struct LazyProject {
+    project: OnceCell<Option<Project>>,
+}
Expand description

A lazily loaded Project

+

Fields§

§project: OnceCell<Option<Project>>

Implementations§

source§

impl LazyProject

source

pub fn init() -> Self

source

pub fn get(&self) -> Fallible<Option<&Project>>

source

pub fn get_mut(&mut self) -> Fallible<Option<&mut Project>>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/project/struct.PartialPlatform.html b/main/volta_core/project/struct.PartialPlatform.html new file mode 100644 index 000000000..047219a8e --- /dev/null +++ b/main/volta_core/project/struct.PartialPlatform.html @@ -0,0 +1,17 @@ +PartialPlatform in volta_core::project - Rust
struct PartialPlatform {
+    node: Option<Version>,
+    npm: Option<Version>,
+    pnpm: Option<Version>,
+    yarn: Option<Version>,
+}

Fields§

§node: Option<Version>§npm: Option<Version>§pnpm: Option<Version>§yarn: Option<Version>

Implementations§

Trait Implementations§

source§

impl TryFrom<PartialPlatform> for PlatformSpec

§

type Error = VoltaError

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

fn try_from(partial: PartialPlatform) -> Fallible<PlatformSpec>

Performs the conversion.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/project/struct.Project.html b/main/volta_core/project/struct.Project.html new file mode 100644 index 000000000..f7692dc79 --- /dev/null +++ b/main/volta_core/project/struct.Project.html @@ -0,0 +1,33 @@ +Project in volta_core::project - Rust

Struct volta_core::project::Project

source ·
pub struct Project {
+    manifest_file: PathBuf,
+    workspace_manifests: IndexSet<PathBuf>,
+    dependencies: ChainMap<String, String>,
+    platform: Option<PlatformSpec>,
+}
Expand description

A Node project workspace in the filesystem

+

Fields§

§manifest_file: PathBuf§workspace_manifests: IndexSet<PathBuf>§dependencies: ChainMap<String, String>§platform: Option<PlatformSpec>

Implementations§

source§

impl Project

source

fn for_current_dir() -> Fallible<Option<Self>>

Creates an optional Project instance from the current directory

+
source

fn for_dir(base_dir: PathBuf) -> Fallible<Option<Self>>

Creates an optional Project instance from the specified directory

+

Will search ancestors to find a package.json and use that as the root of the project

+
source

fn from_file(manifest_file: PathBuf) -> Fallible<Self>

Creates a Project instance from the given package manifest file (package.json)

+
source

pub fn manifest_file(&self) -> &Path

Returns a reference to the manifest file for the current project

+
source

pub fn workspace_roots(&self) -> impl Iterator<Item = &Path>

Returns an iterator of paths to all of the workspace roots

+
source

pub fn platform(&self) -> Option<&PlatformSpec>

Returns a reference to the Project’s PlatformSpec, if available

+
source

pub fn has_direct_dependency(&self, dependency: &str) -> bool

Returns true if the project dependency map contains the specified dependency

+
source

pub fn has_direct_bin(&self, bin_name: &OsStr) -> Fallible<bool>

Returns true if the input binary name is a direct dependency of the input project

+
source

pub fn find_bin<P: AsRef<Path>>(&self, bin_name: P) -> Option<PathBuf>

Searches the project roots to find the path to a project-local binary file

+
source

pub fn needs_yarn_run(&self) -> bool

Yarn projects that are using PnP or pnpm linker need to use yarn run.

+
source

pub fn pin_node(&mut self, version: Version) -> Fallible<()>

Pins the Node version in this project’s manifest file

+
source

pub fn pin_npm(&mut self, version: Option<Version>) -> Fallible<()>

Pins the npm version in this project’s manifest file

+
source

pub fn pin_pnpm(&mut self, version: Option<Version>) -> Fallible<()>

Pins the pnpm version in this project’s manifest file

+
source

pub fn pin_yarn(&mut self, version: Option<Version>) -> Fallible<()>

Pins the Yarn version in this project’s manifest file

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/binary/fn.command.html b/main/volta_core/run/binary/fn.command.html new file mode 100644 index 000000000..b4e58e207 --- /dev/null +++ b/main/volta_core/run/binary/fn.command.html @@ -0,0 +1,7 @@ +command in volta_core::run::binary - Rust

Function volta_core::run::binary::command

source ·
pub(super) fn command(
+    exe: &OsStr,
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
Expand description

Determine the correct command to run for a 3rd-party binary

+

Will detect if we should delegate to the project-local version or use the default version

+
\ No newline at end of file diff --git a/main/volta_core/run/binary/fn.default_execution_context.html b/main/volta_core/run/binary/fn.default_execution_context.html new file mode 100644 index 000000000..5905b90ce --- /dev/null +++ b/main/volta_core/run/binary/fn.default_execution_context.html @@ -0,0 +1,6 @@ +default_execution_context in volta_core::run::binary - Rust
pub(super) fn default_execution_context(
+    tool: String,
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for a default binary

+
\ No newline at end of file diff --git a/main/volta_core/run/binary/fn.local_execution_context.html b/main/volta_core/run/binary/fn.local_execution_context.html new file mode 100644 index 000000000..b06852567 --- /dev/null +++ b/main/volta_core/run/binary/fn.local_execution_context.html @@ -0,0 +1,6 @@ +local_execution_context in volta_core::run::binary - Rust
pub(super) fn local_execution_context(
+    tool: String,
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for a project-local binary

+
\ No newline at end of file diff --git a/main/volta_core/run/binary/fn.shared_module_path.html b/main/volta_core/run/binary/fn.shared_module_path.html new file mode 100644 index 000000000..a0adf0a5b --- /dev/null +++ b/main/volta_core/run/binary/fn.shared_module_path.html @@ -0,0 +1,3 @@ +shared_module_path in volta_core::run::binary - Rust
fn shared_module_path() -> Fallible<OsString>
Expand description

Determine the value for NODE_PATH, with the shared lib directory prepended

+

This will ensure that global bins can require other global libs

+
\ No newline at end of file diff --git a/main/volta_core/run/binary/index.html b/main/volta_core/run/binary/index.html new file mode 100644 index 000000000..1c46773f1 --- /dev/null +++ b/main/volta_core/run/binary/index.html @@ -0,0 +1 @@ +volta_core::run::binary - Rust

Module volta_core::run::binary

source ·

Structs

  • Information about the location and execution context of default binaries

Functions

  • command 🔒
    Determine the correct command to run for a 3rd-party binary
  • Determine the execution context (PATH and failure error message) for a default binary
  • Determine the execution context (PATH and failure error message) for a project-local binary
  • Determine the value for NODE_PATH, with the shared lib directory prepended
\ No newline at end of file diff --git a/main/volta_core/run/binary/sidebar-items.js b/main/volta_core/run/binary/sidebar-items.js new file mode 100644 index 000000000..c651337c2 --- /dev/null +++ b/main/volta_core/run/binary/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["command","default_execution_context","local_execution_context","shared_module_path"],"struct":["DefaultBinary"]}; \ No newline at end of file diff --git a/main/volta_core/run/binary/struct.DefaultBinary.html b/main/volta_core/run/binary/struct.DefaultBinary.html new file mode 100644 index 000000000..8735049c1 --- /dev/null +++ b/main/volta_core/run/binary/struct.DefaultBinary.html @@ -0,0 +1,27 @@ +DefaultBinary in volta_core::run::binary - Rust
pub struct DefaultBinary {
+    pub bin_path: PathBuf,
+    pub platform: Platform,
+}
Expand description

Information about the location and execution context of default binaries

+

Fetched from the config files in the Volta directory, represents the binary that is executed +when the user is outside of a project that has the given bin as a dependency.

+

Fields§

§bin_path: PathBuf§platform: Platform

Implementations§

source§

impl DefaultBinary

source

pub fn from_config( + bin_config: BinConfig, + session: &mut Session +) -> Fallible<Self>

source

pub fn from_name( + tool_name: &OsStr, + session: &mut Session +) -> Fallible<Option<Self>>

Load information about a default binary by name, if available

+

A None response here means that the tool information couldn’t be found. Either the tool +name is not a valid UTF-8 string, or the tool config doesn’t exist.

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/constant.RECURSION_ENV_VAR.html b/main/volta_core/run/constant.RECURSION_ENV_VAR.html new file mode 100644 index 000000000..d670d548b --- /dev/null +++ b/main/volta_core/run/constant.RECURSION_ENV_VAR.html @@ -0,0 +1,9 @@ +RECURSION_ENV_VAR in volta_core::run - Rust
const RECURSION_ENV_VAR: &str = "_VOLTA_TOOL_RECURSION";
Expand description

Environment variable set internally when a shim has been executed and the context evaluated

+

This is set when executing a shim command. If this is already, then the built-in shims (Node, +npm, npx, pnpm and Yarn) will assume that the context has already been evaluated & the PATH has +already been modified, so they will use the pass-through behavior.

+

Shims should only be called recursively when the environment is misconfigured, so this will +prevent infinite recursion as the pass-through logic removes the shim directory from the PATH.

+

Note: This is explicitly removed when calling a command through volta run, as that will +never happen due to the Volta environment.

+
\ No newline at end of file diff --git a/main/volta_core/run/constant.VOLTA_BYPASS.html b/main/volta_core/run/constant.VOLTA_BYPASS.html new file mode 100644 index 000000000..f14b73e9b --- /dev/null +++ b/main/volta_core/run/constant.VOLTA_BYPASS.html @@ -0,0 +1 @@ +VOLTA_BYPASS in volta_core::run - Rust

Constant volta_core::run::VOLTA_BYPASS

source ·
const VOLTA_BYPASS: &str = "VOLTA_BYPASS";
\ No newline at end of file diff --git a/main/volta_core/run/executor/enum.Executor.html b/main/volta_core/run/executor/enum.Executor.html new file mode 100644 index 000000000..f75e6fce0 --- /dev/null +++ b/main/volta_core/run/executor/enum.Executor.html @@ -0,0 +1,22 @@ +Executor in volta_core::run::executor - Rust
pub enum Executor {
+    Tool(Box<ToolCommand>),
+    PackageInstall(Box<PackageInstallCommand>),
+    PackageLink(Box<PackageLinkCommand>),
+    PackageUpgrade(Box<PackageUpgradeCommand>),
+    InternalInstall(Box<InternalInstallCommand>),
+    Uninstall(Box<UninstallCommand>),
+    Multiple(Vec<Executor>),
+}

Variants§

§

Tool(Box<ToolCommand>)

§

PackageInstall(Box<PackageInstallCommand>)

§

PackageUpgrade(Box<PackageUpgradeCommand>)

§

InternalInstall(Box<InternalInstallCommand>)

§

Uninstall(Box<UninstallCommand>)

§

Multiple(Vec<Executor>)

Implementations§

source§

impl Executor

source

pub fn envs<K, V, S>(&mut self, envs: &HashMap<K, V, S>)where + K: AsRef<OsStr>, + V: AsRef<OsStr>,

source

pub fn cli_platform(&mut self, cli: CliPlatform)

source

pub fn execute(self, session: &mut Session) -> Fallible<ExitStatus>

Trait Implementations§

source§

impl From<InternalInstallCommand> for Executor

source§

fn from(cmd: InternalInstallCommand) -> Self

Converts to this type from the input type.
source§

impl From<PackageInstallCommand> for Executor

source§

fn from(cmd: PackageInstallCommand) -> Self

Converts to this type from the input type.
source§

impl From<PackageLinkCommand> for Executor

source§

fn from(cmd: PackageLinkCommand) -> Self

Converts to this type from the input type.
source§

impl From<PackageUpgradeCommand> for Executor

source§

fn from(cmd: PackageUpgradeCommand) -> Self

Converts to this type from the input type.
source§

impl From<ToolCommand> for Executor

source§

fn from(cmd: ToolCommand) -> Self

Converts to this type from the input type.
source§

impl From<UninstallCommand> for Executor

source§

fn from(cmd: UninstallCommand) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Executor>> for Executor

source§

fn from(executors: Vec<Executor>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/enum.ToolKind.html b/main/volta_core/run/executor/enum.ToolKind.html new file mode 100644 index 000000000..8cad74e99 --- /dev/null +++ b/main/volta_core/run/executor/enum.ToolKind.html @@ -0,0 +1,22 @@ +ToolKind in volta_core::run::executor - Rust
pub enum ToolKind {
+    Node,
+    Npm,
+    Npx,
+    Pnpm,
+    Yarn,
+    ProjectLocalBinary(String),
+    DefaultBinary(String),
+    Bypass(String),
+}
Expand description

The kind of tool being executed, used to determine the correct execution context

+

Variants§

§

Node

§

Npm

§

Npx

§

Pnpm

§

Yarn

§

ProjectLocalBinary(String)

§

DefaultBinary(String)

§

Bypass(String)

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/index.html b/main/volta_core/run/executor/index.html new file mode 100644 index 000000000..11a8e8d68 --- /dev/null +++ b/main/volta_core/run/executor/index.html @@ -0,0 +1 @@ +volta_core::run::executor - Rust

Module volta_core::run::executor

source ·

Structs

Enums

  • The kind of tool being executed, used to determine the correct execution context
\ No newline at end of file diff --git a/main/volta_core/run/executor/sidebar-items.js b/main/volta_core/run/executor/sidebar-items.js new file mode 100644 index 000000000..4ed8d0169 --- /dev/null +++ b/main/volta_core/run/executor/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Executor","ToolKind"],"struct":["InternalInstallCommand","PackageInstallCommand","PackageLinkCommand","PackageUpgradeCommand","ToolCommand","UninstallCommand"]}; \ No newline at end of file diff --git a/main/volta_core/run/executor/struct.InternalInstallCommand.html b/main/volta_core/run/executor/struct.InternalInstallCommand.html new file mode 100644 index 000000000..00b4efa71 --- /dev/null +++ b/main/volta_core/run/executor/struct.InternalInstallCommand.html @@ -0,0 +1,18 @@ +InternalInstallCommand in volta_core::run::executor - Rust
pub struct InternalInstallCommand {
+    tool: Spec,
+}
Expand description

Executor for running an internal install (installing Node, npm, pnpm or Yarn using the volta install logic)

+

Note: This is not intended to be used for Package installs. Those should go through the +PackageInstallCommand above, to more seamlessly integrate with the package manager

+

Fields§

§tool: Spec

Implementations§

source§

impl InternalInstallCommand

source

pub fn new(tool: Spec) -> Self

source

fn execute(self, session: &mut Session) -> Fallible<ExitStatus>

Runs the install, using Volta’s internal install logic for the appropriate tool

+

Trait Implementations§

source§

impl From<InternalInstallCommand> for Executor

source§

fn from(cmd: InternalInstallCommand) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/struct.PackageInstallCommand.html b/main/volta_core/run/executor/struct.PackageInstallCommand.html new file mode 100644 index 000000000..246c4cb56 --- /dev/null +++ b/main/volta_core/run/executor/struct.PackageInstallCommand.html @@ -0,0 +1,41 @@ +PackageInstallCommand in volta_core::run::executor - Rust
pub struct PackageInstallCommand {
+    command: Command,
+    installer: DirectInstall,
+    platform: Platform,
+}
Expand description

Process builder for launching a package install command (e.g. npm install --global)

+

This will use a DirectInstall instance to modify the command before running to point it to +the Volta directory. It will also complete the install, writing config files and shims

+

Fields§

§command: Command

The command that will ultimately be executed

+
§installer: DirectInstall

The installer that modifies the command as necessary and provides the completion method

+
§platform: Platform

The platform to use when running the command.

+

Implementations§

source§

impl PackageInstallCommand

source

pub fn new<A, S>( + args: A, + platform: Platform, + manager: PackageManager +) -> Fallible<Self>where + A: IntoIterator<Item = S>, + S: AsRef<OsStr>,

source

pub fn envs<E, K, V>(&mut self, envs: E)where + E: IntoIterator<Item = (K, V)>, + K: AsRef<OsStr>, + V: AsRef<OsStr>,

Adds or updates environment variables that the command will use

+
source

pub fn cli_platform(&mut self, cli: CliPlatform)

Updates the Platform for the command to include values from the command-line

+
source

pub fn execute(self, session: &mut Session) -> Fallible<ExitStatus>

Runs the install command, applying the necessary modifications to install into the Volta +data directory

+

Trait Implementations§

source§

impl From<PackageInstallCommand> for Executor

source§

fn from(cmd: PackageInstallCommand) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/struct.PackageLinkCommand.html b/main/volta_core/run/executor/struct.PackageLinkCommand.html new file mode 100644 index 000000000..dbaa9124e --- /dev/null +++ b/main/volta_core/run/executor/struct.PackageLinkCommand.html @@ -0,0 +1,36 @@ +PackageLinkCommand in volta_core::run::executor - Rust
pub struct PackageLinkCommand {
+    command: Command,
+    tool: String,
+    platform: Platform,
+}
Expand description

Process builder for launching a npm link <package> command

+

This will set the appropriate environment variables to ensure that the linked package can be +found.

+

Fields§

§command: Command

The command that will ultimately be executed

+
§tool: String

The tool the user wants to link

+
§platform: Platform

The platform to use when running the command

+

Implementations§

source§

impl PackageLinkCommand

source

pub fn new<A, S>(args: A, platform: Platform, tool: String) -> Selfwhere + A: IntoIterator<Item = S>, + S: AsRef<OsStr>,

source

pub fn envs<E, K, V>(&mut self, envs: E)where + E: IntoIterator<Item = (K, V)>, + K: AsRef<OsStr>, + V: AsRef<OsStr>,

Adds or updates environment variables that the command will use

+
source

pub fn cli_platform(&mut self, cli: CliPlatform)

Updates the Platform for the command to include values from the command-line

+
source

pub fn execute(self, session: &mut Session) -> Fallible<ExitStatus>

Runs the link command, applying the necessary modifications to pull from the Volta data +directory.

+

This will also check for some common failure cases and alert the user

+
source

fn check_linked_package(&self, session: &mut Session) -> Fallible<()>

Check for possible failure cases with the linked package: +- The package is not found as a global +- The package exists, but was linked using a different package manager +- The package is using a different version of Node than the current project (warning)

+

Trait Implementations§

source§

impl From<PackageLinkCommand> for Executor

source§

fn from(cmd: PackageLinkCommand) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/struct.PackageUpgradeCommand.html b/main/volta_core/run/executor/struct.PackageUpgradeCommand.html new file mode 100644 index 000000000..c6a9aab1b --- /dev/null +++ b/main/volta_core/run/executor/struct.PackageUpgradeCommand.html @@ -0,0 +1,38 @@ +PackageUpgradeCommand in volta_core::run::executor - Rust
pub struct PackageUpgradeCommand {
+    command: Command,
+    upgrader: InPlaceUpgrade,
+    platform: Platform,
+}
Expand description

Process builder for launching a global package upgrade command (e.g. npm update -g)

+

This will use an InPlaceUpgrade instance to modify the command and point at the appropriate +image directory. It will also complete the install, writing any updated configs and shims

+

Fields§

§command: Command

The command that will ultimately be executed

+
§upgrader: InPlaceUpgrade

Helper utility to modify the command and provide the completion method

+
§platform: Platform

The platform to run the command under

+

Implementations§

source§

impl PackageUpgradeCommand

source

pub fn new<A, S>( + args: A, + package: String, + platform: Platform, + manager: PackageManager +) -> Fallible<Self>where + A: IntoIterator<Item = S>, + S: AsRef<OsStr>,

source

pub fn envs<E, K, V>(&mut self, envs: E)where + E: IntoIterator<Item = (K, V)>, + K: AsRef<OsStr>, + V: AsRef<OsStr>,

Adds or updates environment variables that the command will use

+
source

pub fn cli_platform(&mut self, cli: CliPlatform)

Updates the Platform for the command to include values from the command-line

+
source

pub fn execute(self, session: &mut Session) -> Fallible<ExitStatus>

Runs the upgrade command, applying the necessary modifications to point at the Volta image +directory

+

Will also check for common failure cases, such as non-existant package or wrong package +manager

+

Trait Implementations§

source§

impl From<PackageUpgradeCommand> for Executor

source§

fn from(cmd: PackageUpgradeCommand) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/struct.ToolCommand.html b/main/volta_core/run/executor/struct.ToolCommand.html new file mode 100644 index 000000000..2f2848cd3 --- /dev/null +++ b/main/volta_core/run/executor/struct.ToolCommand.html @@ -0,0 +1,36 @@ +ToolCommand in volta_core::run::executor - Rust
pub struct ToolCommand {
+    command: Command,
+    platform: Option<Platform>,
+    kind: ToolKind,
+}
Expand description

Process builder for launching a Volta-managed tool

+

Tracks the Platform as well as what kind of tool is being executed, to allow individual tools +to customize the behavior before execution.

+

Fields§

§command: Command§platform: Option<Platform>§kind: ToolKind

Implementations§

source§

impl ToolCommand

source

pub fn new<E, A, S>( + exe: E, + args: A, + platform: Option<Platform>, + kind: ToolKind +) -> Selfwhere + E: AsRef<OsStr>, + A: IntoIterator<Item = S>, + S: AsRef<OsStr>,

source

pub fn envs<E, K, V>(&mut self, envs: E)where + E: IntoIterator<Item = (K, V)>, + K: AsRef<OsStr>, + V: AsRef<OsStr>,

Adds or updates environment variables that the command will use

+
source

pub fn env<K, V>(&mut self, key: K, value: V)where + K: AsRef<OsStr>, + V: AsRef<OsStr>,

Adds or updates a single environment variable that the command will use

+
source

pub fn cli_platform(&mut self, cli: CliPlatform)

Updates the Platform for the command to include values from the command-line

+
source

pub fn execute(self, session: &mut Session) -> Fallible<ExitStatus>

Runs the command, returning the ExitStatus if it successfully launches

+

Trait Implementations§

source§

impl From<ToolCommand> for Executor

source§

fn from(cmd: ToolCommand) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/executor/struct.UninstallCommand.html b/main/volta_core/run/executor/struct.UninstallCommand.html new file mode 100644 index 000000000..e535d2d0d --- /dev/null +++ b/main/volta_core/run/executor/struct.UninstallCommand.html @@ -0,0 +1,18 @@ +UninstallCommand in volta_core::run::executor - Rust
pub struct UninstallCommand {
+    tool: Spec,
+}
Expand description

Executor for running a tool uninstall command.

+

This will use the volta uninstall logic to correctly ensure that the package is fully +uninstalled

+

Fields§

§tool: Spec

Implementations§

source§

impl UninstallCommand

source

pub fn new(tool: Spec) -> Self

source

fn execute(self) -> Fallible<ExitStatus>

Runs the uninstall with Volta’s internal uninstall logic

+

Trait Implementations§

source§

impl From<UninstallCommand> for Executor

source§

fn from(cmd: UninstallCommand) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/fn.debug_active_image.html b/main/volta_core/run/fn.debug_active_image.html new file mode 100644 index 000000000..8039ed9d8 --- /dev/null +++ b/main/volta_core/run/fn.debug_active_image.html @@ -0,0 +1,2 @@ +debug_active_image in volta_core::run - Rust
fn debug_active_image(image: &Image)
Expand description

Write a debug message with the full image that will be used to execute a command

+
\ No newline at end of file diff --git a/main/volta_core/run/fn.debug_no_platform.html b/main/volta_core/run/fn.debug_no_platform.html new file mode 100644 index 000000000..35b201427 --- /dev/null +++ b/main/volta_core/run/fn.debug_no_platform.html @@ -0,0 +1,2 @@ +debug_no_platform in volta_core::run - Rust
fn debug_no_platform()
Expand description

Write a debug message that there is no platform available

+
\ No newline at end of file diff --git a/main/volta_core/run/fn.execute_shim.html b/main/volta_core/run/fn.execute_shim.html new file mode 100644 index 000000000..743129dcb --- /dev/null +++ b/main/volta_core/run/fn.execute_shim.html @@ -0,0 +1,2 @@ +execute_shim in volta_core::run - Rust

Function volta_core::run::execute_shim

source ·
pub fn execute_shim(session: &mut Session) -> Fallible<ExitStatus>
Expand description

Execute a shim command, based on the command-line arguments to the current process

+
\ No newline at end of file diff --git a/main/volta_core/run/fn.execute_tool.html b/main/volta_core/run/fn.execute_tool.html new file mode 100644 index 000000000..49d4e7fda --- /dev/null +++ b/main/volta_core/run/fn.execute_tool.html @@ -0,0 +1,10 @@ +execute_tool in volta_core::run - Rust

Function volta_core::run::execute_tool

source ·
pub fn execute_tool<K, V, S>(
+    exe: &OsStr,
+    args: &[OsString],
+    envs: &HashMap<K, V, S>,
+    cli: CliPlatform,
+    session: &mut Session
+) -> Fallible<ExitStatus>where
+    K: AsRef<OsStr>,
+    V: AsRef<OsStr>,
Expand description

Execute a tool with the provided arguments

+
\ No newline at end of file diff --git a/main/volta_core/run/fn.format_tool_version.html b/main/volta_core/run/fn.format_tool_version.html new file mode 100644 index 000000000..dc3ae31b2 --- /dev/null +++ b/main/volta_core/run/fn.format_tool_version.html @@ -0,0 +1 @@ +format_tool_version in volta_core::run - Rust
fn format_tool_version(version: &Sourced<Version>) -> String
\ No newline at end of file diff --git a/main/volta_core/run/fn.get_executor.html b/main/volta_core/run/fn.get_executor.html new file mode 100644 index 000000000..bfed0ce82 --- /dev/null +++ b/main/volta_core/run/fn.get_executor.html @@ -0,0 +1,6 @@ +get_executor in volta_core::run - Rust

Function volta_core::run::get_executor

source ·
fn get_executor(
+    exe: &OsStr,
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
Expand description

Get the appropriate Tool command, based on the requested executable and arguments

+
\ No newline at end of file diff --git a/main/volta_core/run/fn.get_tool_name.html b/main/volta_core/run/fn.get_tool_name.html new file mode 100644 index 000000000..ff0f183d8 --- /dev/null +++ b/main/volta_core/run/fn.get_tool_name.html @@ -0,0 +1,2 @@ +get_tool_name in volta_core::run - Rust

Function volta_core::run::get_tool_name

source ·
fn get_tool_name(args: &mut ArgsOs) -> Fallible<OsString>
Expand description

Determine the name of the command to run by inspecting the first argument to the active process

+
\ No newline at end of file diff --git a/main/volta_core/run/fn.tool_name_from_file_name.html b/main/volta_core/run/fn.tool_name_from_file_name.html new file mode 100644 index 000000000..397b203d5 --- /dev/null +++ b/main/volta_core/run/fn.tool_name_from_file_name.html @@ -0,0 +1 @@ +tool_name_from_file_name in volta_core::run - Rust
fn tool_name_from_file_name(file_name: &OsStr) -> OsString
\ No newline at end of file diff --git a/main/volta_core/run/index.html b/main/volta_core/run/index.html new file mode 100644 index 000000000..64551fe0f --- /dev/null +++ b/main/volta_core/run/index.html @@ -0,0 +1 @@ +volta_core::run - Rust

Module volta_core::run

source ·

Modules

Constants

Functions

\ No newline at end of file diff --git a/main/volta_core/run/node/fn.command.html b/main/volta_core/run/node/fn.command.html new file mode 100644 index 000000000..304fea571 --- /dev/null +++ b/main/volta_core/run/node/fn.command.html @@ -0,0 +1,5 @@ +command in volta_core::run::node - Rust

Function volta_core::run::node::command

source ·
pub(super) fn command(
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
Expand description

Build a ToolCommand for Node

+
\ No newline at end of file diff --git a/main/volta_core/run/node/fn.execution_context.html b/main/volta_core/run/node/fn.execution_context.html new file mode 100644 index 000000000..3aa5d9ff5 --- /dev/null +++ b/main/volta_core/run/node/fn.execution_context.html @@ -0,0 +1,5 @@ +execution_context in volta_core::run::node - Rust
pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for Node

+
\ No newline at end of file diff --git a/main/volta_core/run/node/index.html b/main/volta_core/run/node/index.html new file mode 100644 index 000000000..bc18425b5 --- /dev/null +++ b/main/volta_core/run/node/index.html @@ -0,0 +1 @@ +volta_core::run::node - Rust

Module volta_core::run::node

source ·

Functions

  • command 🔒
    Build a ToolCommand for Node
  • Determine the execution context (PATH and failure error message) for Node
\ No newline at end of file diff --git a/main/volta_core/run/node/sidebar-items.js b/main/volta_core/run/node/sidebar-items.js new file mode 100644 index 000000000..9713b8b3c --- /dev/null +++ b/main/volta_core/run/node/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["command","execution_context"]}; \ No newline at end of file diff --git a/main/volta_core/run/npm/fn.command.html b/main/volta_core/run/npm/fn.command.html new file mode 100644 index 000000000..138f0c861 --- /dev/null +++ b/main/volta_core/run/npm/fn.command.html @@ -0,0 +1,10 @@ +command in volta_core::run::npm - Rust

Function volta_core::run::npm::command

source ·
pub(super) fn command(
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
Expand description

Build an Executor for npm

+

If the command is a global install or uninstall and we have a default platform available, then +we will use custom logic to ensure that the package is correctly installed / uninstalled in the +Volta directory.

+

If the command is not a global install / uninstall or we don’t have a default platform, then +we will allow npm to execute the command as usual.

+
\ No newline at end of file diff --git a/main/volta_core/run/npm/fn.current_project_name.html b/main/volta_core/run/npm/fn.current_project_name.html new file mode 100644 index 000000000..bcd34e9cf --- /dev/null +++ b/main/volta_core/run/npm/fn.current_project_name.html @@ -0,0 +1,2 @@ +current_project_name in volta_core::run::npm - Rust
fn current_project_name(session: &mut Session) -> Option<String>
Expand description

Determine the name of the current project, if possible

+
\ No newline at end of file diff --git a/main/volta_core/run/npm/fn.execution_context.html b/main/volta_core/run/npm/fn.execution_context.html new file mode 100644 index 000000000..9584eaf1d --- /dev/null +++ b/main/volta_core/run/npm/fn.execution_context.html @@ -0,0 +1,5 @@ +execution_context in volta_core::run::npm - Rust
pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for npm

+
\ No newline at end of file diff --git a/main/volta_core/run/npm/index.html b/main/volta_core/run/npm/index.html new file mode 100644 index 000000000..ceaca58de --- /dev/null +++ b/main/volta_core/run/npm/index.html @@ -0,0 +1 @@ +volta_core::run::npm - Rust

Module volta_core::run::npm

source ·

Functions

\ No newline at end of file diff --git a/main/volta_core/run/npm/sidebar-items.js b/main/volta_core/run/npm/sidebar-items.js new file mode 100644 index 000000000..2231b135b --- /dev/null +++ b/main/volta_core/run/npm/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["command","current_project_name","execution_context"]}; \ No newline at end of file diff --git a/main/volta_core/run/npx/fn.command.html b/main/volta_core/run/npx/fn.command.html new file mode 100644 index 000000000..da9bc8645 --- /dev/null +++ b/main/volta_core/run/npx/fn.command.html @@ -0,0 +1,5 @@ +command in volta_core::run::npx - Rust

Function volta_core::run::npx::command

source ·
pub(super) fn command(
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
Expand description

Build a ToolCommand for npx

+
\ No newline at end of file diff --git a/main/volta_core/run/npx/fn.execution_context.html b/main/volta_core/run/npx/fn.execution_context.html new file mode 100644 index 000000000..37b33e790 --- /dev/null +++ b/main/volta_core/run/npx/fn.execution_context.html @@ -0,0 +1,5 @@ +execution_context in volta_core::run::npx - Rust
pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for npx

+
\ No newline at end of file diff --git a/main/volta_core/run/npx/index.html b/main/volta_core/run/npx/index.html new file mode 100644 index 000000000..ced867c1b --- /dev/null +++ b/main/volta_core/run/npx/index.html @@ -0,0 +1 @@ +volta_core::run::npx - Rust

Module volta_core::run::npx

source ·

Statics

Functions

  • command 🔒
    Build a ToolCommand for npx
  • Determine the execution context (PATH and failure error message) for npx
\ No newline at end of file diff --git a/main/volta_core/run/npx/sidebar-items.js b/main/volta_core/run/npx/sidebar-items.js new file mode 100644 index 000000000..a5b59fa4c --- /dev/null +++ b/main/volta_core/run/npx/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["command","execution_context"],"static":["REQUIRED_NPM_VERSION"]}; \ No newline at end of file diff --git a/main/volta_core/run/npx/static.REQUIRED_NPM_VERSION.html b/main/volta_core/run/npx/static.REQUIRED_NPM_VERSION.html new file mode 100644 index 000000000..5e6683d14 --- /dev/null +++ b/main/volta_core/run/npx/static.REQUIRED_NPM_VERSION.html @@ -0,0 +1 @@ +REQUIRED_NPM_VERSION in volta_core::run::npx - Rust
static REQUIRED_NPM_VERSION: Lazy<Version>
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.NPM_INSTALL_ALIASES.html b/main/volta_core/run/parser/constant.NPM_INSTALL_ALIASES.html new file mode 100644 index 000000000..9da949ca3 --- /dev/null +++ b/main/volta_core/run/parser/constant.NPM_INSTALL_ALIASES.html @@ -0,0 +1,2 @@ +NPM_INSTALL_ALIASES in volta_core::run::parser - Rust
const NPM_INSTALL_ALIASES: [&str; 12];
Expand description

Aliases that npm supports for the ‘install’ command

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.NPM_LINK_ALIASES.html b/main/volta_core/run/parser/constant.NPM_LINK_ALIASES.html new file mode 100644 index 000000000..ff387e742 --- /dev/null +++ b/main/volta_core/run/parser/constant.NPM_LINK_ALIASES.html @@ -0,0 +1,2 @@ +NPM_LINK_ALIASES in volta_core::run::parser - Rust
const NPM_LINK_ALIASES: [&str; 2];
Expand description

Aliases that npm supports for the ‘link’ command

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.NPM_UNINSTALL_ALIASES.html b/main/volta_core/run/parser/constant.NPM_UNINSTALL_ALIASES.html new file mode 100644 index 000000000..532e4decb --- /dev/null +++ b/main/volta_core/run/parser/constant.NPM_UNINSTALL_ALIASES.html @@ -0,0 +1,2 @@ +NPM_UNINSTALL_ALIASES in volta_core::run::parser - Rust
const NPM_UNINSTALL_ALIASES: [&str; 5];
Expand description

Aliases that npm supports for the ‘uninstall’ command

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.NPM_UPDATE_ALIASES.html b/main/volta_core/run/parser/constant.NPM_UPDATE_ALIASES.html new file mode 100644 index 000000000..854768a6b --- /dev/null +++ b/main/volta_core/run/parser/constant.NPM_UPDATE_ALIASES.html @@ -0,0 +1,2 @@ +NPM_UPDATE_ALIASES in volta_core::run::parser - Rust
const NPM_UPDATE_ALIASES: [&str; 4];
Expand description

Aliases that npm supports for the update command

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.PNPM_LINK_ALIASES.html b/main/volta_core/run/parser/constant.PNPM_LINK_ALIASES.html new file mode 100644 index 000000000..4ff796f9f --- /dev/null +++ b/main/volta_core/run/parser/constant.PNPM_LINK_ALIASES.html @@ -0,0 +1,3 @@ +PNPM_LINK_ALIASES in volta_core::run::parser - Rust
const PNPM_LINK_ALIASES: [&str; 2];
Expand description

Aliases that pnpm supports for the ‘link’ command +see: https://pnpm.io/cli/link

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.PNPM_UNINSTALL_ALIASES.html b/main/volta_core/run/parser/constant.PNPM_UNINSTALL_ALIASES.html new file mode 100644 index 000000000..4fdcf86b9 --- /dev/null +++ b/main/volta_core/run/parser/constant.PNPM_UNINSTALL_ALIASES.html @@ -0,0 +1,3 @@ +PNPM_UNINSTALL_ALIASES in volta_core::run::parser - Rust
const PNPM_UNINSTALL_ALIASES: [&str; 4];
Expand description

Aliases that pnpm supports for the ‘remove’ command, +see: https://pnpm.io/cli/remove

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.PNPM_UPDATE_ALIASES.html b/main/volta_core/run/parser/constant.PNPM_UPDATE_ALIASES.html new file mode 100644 index 000000000..6562f3237 --- /dev/null +++ b/main/volta_core/run/parser/constant.PNPM_UPDATE_ALIASES.html @@ -0,0 +1,3 @@ +PNPM_UPDATE_ALIASES in volta_core::run::parser - Rust
const PNPM_UPDATE_ALIASES: [&str; 3];
Expand description

Aliases that pnpm supports for the ‘update’ command, +see: https://pnpm.io/cli/update

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/constant.UNSAFE_GLOBAL.html b/main/volta_core/run/parser/constant.UNSAFE_GLOBAL.html new file mode 100644 index 000000000..5212add40 --- /dev/null +++ b/main/volta_core/run/parser/constant.UNSAFE_GLOBAL.html @@ -0,0 +1 @@ +UNSAFE_GLOBAL in volta_core::run::parser - Rust
const UNSAFE_GLOBAL: &str = "VOLTA_UNSAFE_GLOBAL";
\ No newline at end of file diff --git a/main/volta_core/run/parser/enum.CommandArg.html b/main/volta_core/run/parser/enum.CommandArg.html new file mode 100644 index 000000000..21ce2f665 --- /dev/null +++ b/main/volta_core/run/parser/enum.CommandArg.html @@ -0,0 +1,22 @@ +CommandArg in volta_core::run::parser - Rust
pub enum CommandArg<'a> {
+    Global(GlobalCommand<'a>),
+    Intercepted(InterceptedCommand<'a>),
+    Standard,
+}

Variants§

§

Global(GlobalCommand<'a>)

§

Intercepted(InterceptedCommand<'a>)

§

Standard

Implementations§

source§

impl<'a> CommandArg<'a>

source

pub fn for_npm<S>(args: &'a [S]) -> Selfwhere + S: AsRef<OsStr>,

Parse the given set of arguments to see if they correspond to an intercepted npm command

+
source

pub fn for_pnpm<S>(args: &'a [S]) -> CommandArg<'a>where + S: AsRef<OsStr>,

Parse the given set of arguments to see if they correspond to an intercepted pnpm command

+
source

pub fn for_yarn<S>(args: &'a [S]) -> Selfwhere + S: AsRef<OsStr>,

Parse the given set of arguments to see if they correspond to an intercepted Yarn command

+

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for CommandArg<'a>

§

impl<'a> Send for CommandArg<'a>

§

impl<'a> Sync for CommandArg<'a>

§

impl<'a> Unpin for CommandArg<'a>

§

impl<'a> UnwindSafe for CommandArg<'a>

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/parser/enum.GlobalCommand.html b/main/volta_core/run/parser/enum.GlobalCommand.html new file mode 100644 index 000000000..ac34ceaeb --- /dev/null +++ b/main/volta_core/run/parser/enum.GlobalCommand.html @@ -0,0 +1,16 @@ +GlobalCommand in volta_core::run::parser - Rust
pub enum GlobalCommand<'a> {
+    Install(InstallArgs<'a>),
+    Uninstall(UninstallArgs<'a>),
+    Upgrade(UpgradeArgs<'a>),
+}

Variants§

§

Install(InstallArgs<'a>)

§

Uninstall(UninstallArgs<'a>)

§

Upgrade(UpgradeArgs<'a>)

Implementations§

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for GlobalCommand<'a>

§

impl<'a> Send for GlobalCommand<'a>

§

impl<'a> Sync for GlobalCommand<'a>

§

impl<'a> Unpin for GlobalCommand<'a>

§

impl<'a> UnwindSafe for GlobalCommand<'a>

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/parser/enum.InterceptedCommand.html b/main/volta_core/run/parser/enum.InterceptedCommand.html new file mode 100644 index 000000000..b9dcb898e --- /dev/null +++ b/main/volta_core/run/parser/enum.InterceptedCommand.html @@ -0,0 +1,16 @@ +InterceptedCommand in volta_core::run::parser - Rust
pub enum InterceptedCommand<'a> {
+    Link(LinkArgs<'a>),
+    Unlink,
+}
Expand description

An intercepted local command

+

Variants§

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/parser/fn.has_global_without_prefix.html b/main/volta_core/run/parser/fn.has_global_without_prefix.html new file mode 100644 index 000000000..33b258fa9 --- /dev/null +++ b/main/volta_core/run/parser/fn.has_global_without_prefix.html @@ -0,0 +1,7 @@ +has_global_without_prefix in volta_core::run::parser - Rust
fn has_global_without_prefix<A>(args: &[A]) -> boolwhere
+    A: AsRef<OsStr>,
Expand description

Check if the provided argument list includes a global flag and doesn’t have a prefix setting

+

For our interception, we only want to intercept global commands. Additionally, if the user +passes a prefix setting, that will override the logic we use to redirect the install, so our +process won’t work and will cause an error. We should avoid intercepting in those cases since +a command with an explicit prefix is something beyond the “standard” global install anyway.

+
\ No newline at end of file diff --git a/main/volta_core/run/parser/fn.is_flag.html b/main/volta_core/run/parser/fn.is_flag.html new file mode 100644 index 000000000..a05716f72 --- /dev/null +++ b/main/volta_core/run/parser/fn.is_flag.html @@ -0,0 +1,2 @@ +is_flag in volta_core::run::parser - Rust

Function volta_core::run::parser::is_flag

source ·
fn is_flag<A>(arg: &A) -> boolwhere
+    A: AsRef<OsStr>,
\ No newline at end of file diff --git a/main/volta_core/run/parser/fn.is_positional.html b/main/volta_core/run/parser/fn.is_positional.html new file mode 100644 index 000000000..975b9e4cf --- /dev/null +++ b/main/volta_core/run/parser/fn.is_positional.html @@ -0,0 +1,2 @@ +is_positional in volta_core::run::parser - Rust
fn is_positional<A>(arg: &A) -> boolwhere
+    A: AsRef<OsStr>,
\ No newline at end of file diff --git a/main/volta_core/run/parser/index.html b/main/volta_core/run/parser/index.html new file mode 100644 index 000000000..8da04b34a --- /dev/null +++ b/main/volta_core/run/parser/index.html @@ -0,0 +1,4 @@ +volta_core::run::parser - Rust

Module volta_core::run::parser

source ·

Structs

  • The arguments passed to a global install command
  • The arguments passed to an npm link command
  • The list of tools passed to an uninstall command
  • The list of tools passed to an upgrade command

Enums

Constants

Functions

\ No newline at end of file diff --git a/main/volta_core/run/parser/sidebar-items.js b/main/volta_core/run/parser/sidebar-items.js new file mode 100644 index 000000000..89c27d63e --- /dev/null +++ b/main/volta_core/run/parser/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["NPM_INSTALL_ALIASES","NPM_LINK_ALIASES","NPM_UNINSTALL_ALIASES","NPM_UPDATE_ALIASES","PNPM_LINK_ALIASES","PNPM_UNINSTALL_ALIASES","PNPM_UPDATE_ALIASES","UNSAFE_GLOBAL"],"enum":["CommandArg","GlobalCommand","InterceptedCommand"],"fn":["has_global_without_prefix","is_flag","is_positional"],"struct":["InstallArgs","LinkArgs","UninstallArgs","UpgradeArgs"]}; \ No newline at end of file diff --git a/main/volta_core/run/parser/struct.InstallArgs.html b/main/volta_core/run/parser/struct.InstallArgs.html new file mode 100644 index 000000000..351ba1c33 --- /dev/null +++ b/main/volta_core/run/parser/struct.InstallArgs.html @@ -0,0 +1,24 @@ +InstallArgs in volta_core::run::parser - Rust
pub struct InstallArgs<'a> {
+    manager: PackageManager,
+    common_args: Vec<&'a OsStr>,
+    tools: Vec<&'a OsStr>,
+}
Expand description

The arguments passed to a global install command

+

Fields§

§manager: PackageManager

The package manager being used

+
§common_args: Vec<&'a OsStr>

Common arguments that apply to each tool (e.g. flags)

+
§tools: Vec<&'a OsStr>

The individual tool arguments

+

Implementations§

source§

impl InstallArgs<'_>

source

pub fn executor(self, platform_spec: &PlatformSpec) -> Fallible<Executor>

Convert these global install arguments into an executor for the command

+

If there are multiple packages specified to install, then they will be broken out into +individual commands and run separately. That allows us to keep Volta’s sandboxing for each +package while still supporting the ability to install multiple packages at once.

+

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for InstallArgs<'a>

§

impl<'a> Send for InstallArgs<'a>

§

impl<'a> Sync for InstallArgs<'a>

§

impl<'a> Unpin for InstallArgs<'a>

§

impl<'a> UnwindSafe for InstallArgs<'a>

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/parser/struct.LinkArgs.html b/main/volta_core/run/parser/struct.LinkArgs.html new file mode 100644 index 000000000..6a6e6190b --- /dev/null +++ b/main/volta_core/run/parser/struct.LinkArgs.html @@ -0,0 +1,22 @@ +LinkArgs in volta_core::run::parser - Rust

Struct volta_core::run::parser::LinkArgs

source ·
pub struct LinkArgs<'a> {
+    common_args: Vec<&'a OsStr>,
+    tools: Vec<&'a OsStr>,
+}
Expand description

The arguments passed to an npm link command

+

Fields§

§common_args: Vec<&'a OsStr>

The common arguments that apply to each tool

+
§tools: Vec<&'a OsStr>

The list of tools to link (if any)

+

Implementations§

source§

impl LinkArgs<'_>

source

pub fn executor( + self, + platform: Platform, + project_name: Option<String> +) -> Fallible<Executor>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for LinkArgs<'a>

§

impl<'a> Send for LinkArgs<'a>

§

impl<'a> Sync for LinkArgs<'a>

§

impl<'a> Unpin for LinkArgs<'a>

§

impl<'a> UnwindSafe for LinkArgs<'a>

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/parser/struct.UninstallArgs.html b/main/volta_core/run/parser/struct.UninstallArgs.html new file mode 100644 index 000000000..9a6c3b5af --- /dev/null +++ b/main/volta_core/run/parser/struct.UninstallArgs.html @@ -0,0 +1,17 @@ +UninstallArgs in volta_core::run::parser - Rust
pub struct UninstallArgs<'a> {
+    tools: Vec<&'a OsStr>,
+}
Expand description

The list of tools passed to an uninstall command

+

Fields§

§tools: Vec<&'a OsStr>

Implementations§

source§

impl UninstallArgs<'_>

source

pub fn executor(self) -> Fallible<Executor>

Convert the tools into an executor for the uninstall command

+

Since the packages are sandboxed, each needs to be uninstalled separately

+

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for UninstallArgs<'a>

§

impl<'a> Send for UninstallArgs<'a>

§

impl<'a> Sync for UninstallArgs<'a>

§

impl<'a> Unpin for UninstallArgs<'a>

§

impl<'a> UnwindSafe for UninstallArgs<'a>

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/parser/struct.UpgradeArgs.html b/main/volta_core/run/parser/struct.UpgradeArgs.html new file mode 100644 index 000000000..6fa3d9c5a --- /dev/null +++ b/main/volta_core/run/parser/struct.UpgradeArgs.html @@ -0,0 +1,29 @@ +UpgradeArgs in volta_core::run::parser - Rust
pub struct UpgradeArgs<'a> {
+    manager: PackageManager,
+    common_args: Vec<&'a OsStr>,
+    tools: Vec<&'a OsStr>,
+}
Expand description

The list of tools passed to an upgrade command

+

Fields§

§manager: PackageManager

The package manager being used

+
§common_args: Vec<&'a OsStr>

Common arguments that apply to each tool (e.g. flags)

+
§tools: Vec<&'a OsStr>

The individual tool arguments

+

Implementations§

source§

impl UpgradeArgs<'_>

source

pub fn executor(self, platform_spec: &PlatformSpec) -> Fallible<Executor>

Convert these global upgrade arguments into an executor for the command

+

If there are multiple packages specified to upgrade, then they will be broken out into +individual commands and run separately. If no packages are specified, then we will upgrade +all installed packages that were installed with the same package manager.

+
source

fn executor_all_packages( + self, + platform_spec: &PlatformSpec +) -> Fallible<Executor>

Build an executor to upgrade all global packages that were installed with the same +package manager as we are currently running.

+

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for UpgradeArgs<'a>

§

impl<'a> Send for UpgradeArgs<'a>

§

impl<'a> Sync for UpgradeArgs<'a>

§

impl<'a> Unpin for UpgradeArgs<'a>

§

impl<'a> UnwindSafe for UpgradeArgs<'a>

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/run/pnpm/fn.command.html b/main/volta_core/run/pnpm/fn.command.html new file mode 100644 index 000000000..0e472aa65 --- /dev/null +++ b/main/volta_core/run/pnpm/fn.command.html @@ -0,0 +1,4 @@ +command in volta_core::run::pnpm - Rust

Function volta_core::run::pnpm::command

source ·
pub(super) fn command(
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
\ No newline at end of file diff --git a/main/volta_core/run/pnpm/fn.execution_context.html b/main/volta_core/run/pnpm/fn.execution_context.html new file mode 100644 index 000000000..babb64a6a --- /dev/null +++ b/main/volta_core/run/pnpm/fn.execution_context.html @@ -0,0 +1,5 @@ +execution_context in volta_core::run::pnpm - Rust
pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for pnpm

+
\ No newline at end of file diff --git a/main/volta_core/run/pnpm/fn.validate_platform_pnpm.html b/main/volta_core/run/pnpm/fn.validate_platform_pnpm.html new file mode 100644 index 000000000..feb7e57bf --- /dev/null +++ b/main/volta_core/run/pnpm/fn.validate_platform_pnpm.html @@ -0,0 +1 @@ +validate_platform_pnpm in volta_core::run::pnpm - Rust
fn validate_platform_pnpm(platform: &Platform) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/run/pnpm/index.html b/main/volta_core/run/pnpm/index.html new file mode 100644 index 000000000..2bb469ac8 --- /dev/null +++ b/main/volta_core/run/pnpm/index.html @@ -0,0 +1 @@ +volta_core::run::pnpm - Rust

Module volta_core::run::pnpm

source ·

Functions

\ No newline at end of file diff --git a/main/volta_core/run/pnpm/sidebar-items.js b/main/volta_core/run/pnpm/sidebar-items.js new file mode 100644 index 000000000..e3e722b3f --- /dev/null +++ b/main/volta_core/run/pnpm/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["command","execution_context","validate_platform_pnpm"]}; \ No newline at end of file diff --git a/main/volta_core/run/sidebar-items.js b/main/volta_core/run/sidebar-items.js new file mode 100644 index 000000000..86c30cc46 --- /dev/null +++ b/main/volta_core/run/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["RECURSION_ENV_VAR","VOLTA_BYPASS"],"fn":["debug_active_image","debug_no_platform","execute_shim","execute_tool","format_tool_version","get_executor","get_tool_name","tool_name_from_file_name"],"mod":["binary","executor","node","npm","npx","parser","pnpm","yarn"]}; \ No newline at end of file diff --git a/main/volta_core/run/yarn/fn.command.html b/main/volta_core/run/yarn/fn.command.html new file mode 100644 index 000000000..201789de4 --- /dev/null +++ b/main/volta_core/run/yarn/fn.command.html @@ -0,0 +1,10 @@ +command in volta_core::run::yarn - Rust

Function volta_core::run::yarn::command

source ·
pub(super) fn command(
+    args: &[OsString],
+    session: &mut Session
+) -> Fallible<Executor>
Expand description

Build an Executor for Yarn

+

If the command is a global add or remove and we have a default platform available, then we will +use custom logic to ensure that the package is correctly installed / uninstalled in the Volta +directory.

+

If the command is not a global add / remove or we don’t have a default platform, then +we will allow Yarn to execute the command as usual.

+
\ No newline at end of file diff --git a/main/volta_core/run/yarn/fn.execution_context.html b/main/volta_core/run/yarn/fn.execution_context.html new file mode 100644 index 000000000..cfc1124ed --- /dev/null +++ b/main/volta_core/run/yarn/fn.execution_context.html @@ -0,0 +1,5 @@ +execution_context in volta_core::run::yarn - Rust
pub(super) fn execution_context(
+    platform: Option<Platform>,
+    session: &mut Session
+) -> Fallible<(OsString, ErrorKind)>
Expand description

Determine the execution context (PATH and failure error message) for Yarn

+
\ No newline at end of file diff --git a/main/volta_core/run/yarn/fn.validate_platform_yarn.html b/main/volta_core/run/yarn/fn.validate_platform_yarn.html new file mode 100644 index 000000000..4c5971d80 --- /dev/null +++ b/main/volta_core/run/yarn/fn.validate_platform_yarn.html @@ -0,0 +1 @@ +validate_platform_yarn in volta_core::run::yarn - Rust
fn validate_platform_yarn(platform: &Platform) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/run/yarn/index.html b/main/volta_core/run/yarn/index.html new file mode 100644 index 000000000..6e879dfd9 --- /dev/null +++ b/main/volta_core/run/yarn/index.html @@ -0,0 +1 @@ +volta_core::run::yarn - Rust

Module volta_core::run::yarn

source ·

Functions

\ No newline at end of file diff --git a/main/volta_core/run/yarn/sidebar-items.js b/main/volta_core/run/yarn/sidebar-items.js new file mode 100644 index 000000000..8ad0a3214 --- /dev/null +++ b/main/volta_core/run/yarn/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["command","execution_context","validate_platform_yarn"]}; \ No newline at end of file diff --git a/main/volta_core/session/enum.ActivityKind.html b/main/volta_core/session/enum.ActivityKind.html new file mode 100644 index 000000000..943c6a55f --- /dev/null +++ b/main/volta_core/session/enum.ActivityKind.html @@ -0,0 +1,53 @@ +ActivityKind in volta_core::session - Rust
pub enum ActivityKind {
+
Show 23 variants Fetch, + Install, + Uninstall, + List, + Current, + Default, + Pin, + Node, + Npm, + Npx, + Pnpm, + Yarn, + Volta, + Tool, + Help, + Version, + Binary, + Shim, + Completions, + Which, + Setup, + Run, + Args, +
}

Variants§

§

Fetch

§

Install

§

Uninstall

§

List

§

Current

§

Default

§

Pin

§

Node

§

Npm

§

Npx

§

Pnpm

§

Yarn

§

Volta

§

Tool

§

Help

§

Version

§

Binary

§

Shim

§

Completions

§

Which

§

Setup

§

Run

§

Args

Trait Implementations§

source§

impl Clone for ActivityKind

source§

fn clone(&self) -> ActivityKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Display for ActivityKind

source§

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

Formats the value using the given formatter. Read more
source§

impl Ord for ActivityKind

source§

fn cmp(&self, other: &ActivityKind) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for ActivityKind

source§

fn eq(&self, other: &ActivityKind) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ActivityKind

source§

fn partial_cmp(&self, other: &ActivityKind) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Copy for ActivityKind

source§

impl Eq for ActivityKind

source§

impl StructuralEq for ActivityKind

source§

impl StructuralPartialEq for ActivityKind

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/session/index.html b/main/volta_core/session/index.html new file mode 100644 index 000000000..615ca9c76 --- /dev/null +++ b/main/volta_core/session/index.html @@ -0,0 +1,6 @@ +volta_core::session - Rust

Module volta_core::session

source ·
Expand description

Provides the Session type, which represents the user’s state during an +execution of a Volta tool, including their current directory, Volta +hook configuration, and the state of the local inventory.

+

Structs

  • Represents the user’s state during an execution of a Volta tool. The session +encapsulates a number of aspects of the environment in which the tool was +invoked, including:

Enums

\ No newline at end of file diff --git a/main/volta_core/session/sidebar-items.js b/main/volta_core/session/sidebar-items.js new file mode 100644 index 000000000..fa42d74fe --- /dev/null +++ b/main/volta_core/session/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ActivityKind"],"struct":["Session"]}; \ No newline at end of file diff --git a/main/volta_core/session/struct.Session.html b/main/volta_core/session/struct.Session.html new file mode 100644 index 000000000..c97e8a57b --- /dev/null +++ b/main/volta_core/session/struct.Session.html @@ -0,0 +1,46 @@ +Session in volta_core::session - Rust

Struct volta_core::session::Session

source ·
pub struct Session {
+    hooks: LazyHookConfig,
+    toolchain: LazyToolchain,
+    project: LazyProject,
+    event_log: EventLog,
+}
Expand description

Represents the user’s state during an execution of a Volta tool. The session +encapsulates a number of aspects of the environment in which the tool was +invoked, including:

+
    +
  • the current directory
  • +
  • the Node project tree that contains the current directory (if any)
  • +
  • the Volta hook configuration
  • +
  • the inventory of locally-fetched Volta tools
  • +
+

Fields§

§hooks: LazyHookConfig§toolchain: LazyToolchain§project: LazyProject§event_log: EventLog

Implementations§

source§

impl Session

source

pub fn init() -> Session

Constructs a new Session.

+
source

pub fn project(&self) -> Fallible<Option<&Project>>

Produces a reference to the current Node project, if any.

+
source

pub fn project_mut(&mut self) -> Fallible<Option<&mut Project>>

Produces a mutable reference to the current Node project, if any.

+
source

pub fn default_platform(&self) -> Fallible<Option<&PlatformSpec>>

Returns the user’s default platform, if any

+
source

pub fn project_platform(&self) -> Fallible<Option<&PlatformSpec>>

Returns the current project’s pinned platform image, if any.

+
source

pub fn toolchain(&self) -> Fallible<&Toolchain>

Produces a reference to the current toolchain (default platform specification)

+
source

pub fn toolchain_mut(&mut self) -> Fallible<&mut Toolchain>

Produces a mutable reference to the current toolchain

+
source

pub fn hooks(&self) -> Fallible<&HookConfig>

Produces a reference to the hook configuration

+
source

pub fn add_event_start(&mut self, activity_kind: ActivityKind)

source

pub fn add_event_end( + &mut self, + activity_kind: ActivityKind, + exit_code: ExitCode +)

source

pub fn add_event_tool_end( + &mut self, + activity_kind: ActivityKind, + exit_code: i32 +)

source

pub fn add_event_error( + &mut self, + activity_kind: ActivityKind, + error: &VoltaError +)

source

fn publish_to_event_log(self)

source

pub fn exit(self, code: ExitCode) -> !

source

pub fn exit_tool(self, code: i32) -> !

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/shim/enum.ShimResult.html b/main/volta_core/shim/enum.ShimResult.html new file mode 100644 index 000000000..5dff57368 --- /dev/null +++ b/main/volta_core/shim/enum.ShimResult.html @@ -0,0 +1,25 @@ +ShimResult in volta_core::shim - Rust
pub enum ShimResult {
+    Created,
+    AlreadyExists,
+    Deleted,
+    DoesntExist,
+}

Variants§

§

Created

§

AlreadyExists

§

Deleted

§

DoesntExist

Trait Implementations§

source§

impl PartialEq for ShimResult

source§

fn eq(&self, other: &ShimResult) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Eq for ShimResult

source§

impl StructuralEq for ShimResult

source§

impl StructuralPartialEq for ShimResult

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/shim/fn.create.html b/main/volta_core/shim/fn.create.html new file mode 100644 index 000000000..bc794a725 --- /dev/null +++ b/main/volta_core/shim/fn.create.html @@ -0,0 +1 @@ +create in volta_core::shim - Rust

Function volta_core::shim::create

source ·
pub fn create(shim_name: &str) -> Fallible<ShimResult>
\ No newline at end of file diff --git a/main/volta_core/shim/fn.delete.html b/main/volta_core/shim/fn.delete.html new file mode 100644 index 000000000..40a077ab2 --- /dev/null +++ b/main/volta_core/shim/fn.delete.html @@ -0,0 +1 @@ +delete in volta_core::shim - Rust

Function volta_core::shim::delete

source ·
pub fn delete(shim_name: &str) -> Fallible<ShimResult>
\ No newline at end of file diff --git a/main/volta_core/shim/fn.get_shim_list_deduped.html b/main/volta_core/shim/fn.get_shim_list_deduped.html new file mode 100644 index 000000000..122ce26a2 --- /dev/null +++ b/main/volta_core/shim/fn.get_shim_list_deduped.html @@ -0,0 +1 @@ +get_shim_list_deduped in volta_core::shim - Rust
fn get_shim_list_deduped(dir: &Path) -> Fallible<HashSet<String>>
\ No newline at end of file diff --git a/main/volta_core/shim/fn.regenerate_shims_for_dir.html b/main/volta_core/shim/fn.regenerate_shims_for_dir.html new file mode 100644 index 000000000..7f14f61cc --- /dev/null +++ b/main/volta_core/shim/fn.regenerate_shims_for_dir.html @@ -0,0 +1 @@ +regenerate_shims_for_dir in volta_core::shim - Rust
pub fn regenerate_shims_for_dir(dir: &Path) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/shim/index.html b/main/volta_core/shim/index.html new file mode 100644 index 000000000..cbe50a958 --- /dev/null +++ b/main/volta_core/shim/index.html @@ -0,0 +1,2 @@ +volta_core::shim - Rust

Module volta_core::shim

source ·
Expand description

Provides utilities for modifying shims for 3rd-party executables

+

Modules

  • platform 🔒
    Unix-specific shim utilities

Enums

Functions

\ No newline at end of file diff --git a/main/volta_core/shim/platform/fn.create.html b/main/volta_core/shim/platform/fn.create.html new file mode 100644 index 000000000..575bb81f5 --- /dev/null +++ b/main/volta_core/shim/platform/fn.create.html @@ -0,0 +1 @@ +create in volta_core::shim::platform - Rust

Function volta_core::shim::platform::create

source ·
pub fn create(shim_name: &str) -> Fallible<ShimResult>
\ No newline at end of file diff --git a/main/volta_core/shim/platform/fn.entry_to_shim_name.html b/main/volta_core/shim/platform/fn.entry_to_shim_name.html new file mode 100644 index 000000000..1134b8d08 --- /dev/null +++ b/main/volta_core/shim/platform/fn.entry_to_shim_name.html @@ -0,0 +1,3 @@ +entry_to_shim_name in volta_core::shim::platform - Rust
pub fn entry_to_shim_name(
+    (entry, metadata): (DirEntry, Metadata)
+) -> Option<String>
\ No newline at end of file diff --git a/main/volta_core/shim/platform/index.html b/main/volta_core/shim/platform/index.html new file mode 100644 index 000000000..c8aae9c26 --- /dev/null +++ b/main/volta_core/shim/platform/index.html @@ -0,0 +1,5 @@ +volta_core::shim::platform - Rust

Module volta_core::shim::platform

source ·
Expand description

Unix-specific shim utilities

+

On macOS and Linux, creating a shim involves creating a symlink to the volta-shim +executable. Additionally, filtering the shims from directory entries means looking +for symlinks and ignoring the actual binaries

+

Functions

\ No newline at end of file diff --git a/main/volta_core/shim/platform/sidebar-items.js b/main/volta_core/shim/platform/sidebar-items.js new file mode 100644 index 000000000..bbd498fb2 --- /dev/null +++ b/main/volta_core/shim/platform/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["create","entry_to_shim_name"]}; \ No newline at end of file diff --git a/main/volta_core/shim/sidebar-items.js b/main/volta_core/shim/sidebar-items.js new file mode 100644 index 000000000..5e6a92ad9 --- /dev/null +++ b/main/volta_core/shim/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["ShimResult"],"fn":["create","delete","get_shim_list_deduped","regenerate_shims_for_dir"],"mod":["platform"]}; \ No newline at end of file diff --git a/main/volta_core/sidebar-items.js b/main/volta_core/sidebar-items.js new file mode 100644 index 000000000..4d3505828 --- /dev/null +++ b/main/volta_core/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["VOLTA_FEATURE_PNPM"],"mod":["command","error","event","fs","hook","inventory","layout","log","monitor","platform","project","run","session","shim","signal","style","sync","tool","toolchain","version"]}; \ No newline at end of file diff --git a/main/volta_core/signal/constant.INTERRUPTED_EXIT_CODE.html b/main/volta_core/signal/constant.INTERRUPTED_EXIT_CODE.html new file mode 100644 index 000000000..cde9f905f --- /dev/null +++ b/main/volta_core/signal/constant.INTERRUPTED_EXIT_CODE.html @@ -0,0 +1 @@ +INTERRUPTED_EXIT_CODE in volta_core::signal - Rust
const INTERRUPTED_EXIT_CODE: i32 = 130;
\ No newline at end of file diff --git a/main/volta_core/signal/fn.pass_control_to_shim.html b/main/volta_core/signal/fn.pass_control_to_shim.html new file mode 100644 index 000000000..4f6491990 --- /dev/null +++ b/main/volta_core/signal/fn.pass_control_to_shim.html @@ -0,0 +1 @@ +pass_control_to_shim in volta_core::signal - Rust
pub fn pass_control_to_shim()
\ No newline at end of file diff --git a/main/volta_core/signal/fn.setup_signal_handler.html b/main/volta_core/signal/fn.setup_signal_handler.html new file mode 100644 index 000000000..972f13498 --- /dev/null +++ b/main/volta_core/signal/fn.setup_signal_handler.html @@ -0,0 +1 @@ +setup_signal_handler in volta_core::signal - Rust
pub fn setup_signal_handler()
\ No newline at end of file diff --git a/main/volta_core/signal/index.html b/main/volta_core/signal/index.html new file mode 100644 index 000000000..add1dfa49 --- /dev/null +++ b/main/volta_core/signal/index.html @@ -0,0 +1 @@ +volta_core::signal - Rust
\ No newline at end of file diff --git a/main/volta_core/signal/sidebar-items.js b/main/volta_core/signal/sidebar-items.js new file mode 100644 index 000000000..771789584 --- /dev/null +++ b/main/volta_core/signal/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["INTERRUPTED_EXIT_CODE"],"fn":["pass_control_to_shim","setup_signal_handler"],"static":["SHIM_HAS_CONTROL"]}; \ No newline at end of file diff --git a/main/volta_core/signal/static.SHIM_HAS_CONTROL.html b/main/volta_core/signal/static.SHIM_HAS_CONTROL.html new file mode 100644 index 000000000..32c82ffbf --- /dev/null +++ b/main/volta_core/signal/static.SHIM_HAS_CONTROL.html @@ -0,0 +1 @@ +SHIM_HAS_CONTROL in volta_core::signal - Rust
static SHIM_HAS_CONTROL: AtomicBool
\ No newline at end of file diff --git a/main/volta_core/style/constant.MAX_PROGRESS_WIDTH.html b/main/volta_core/style/constant.MAX_PROGRESS_WIDTH.html new file mode 100644 index 000000000..147fb498a --- /dev/null +++ b/main/volta_core/style/constant.MAX_PROGRESS_WIDTH.html @@ -0,0 +1 @@ +MAX_PROGRESS_WIDTH in volta_core::style - Rust
const MAX_PROGRESS_WIDTH: usize = 40;
\ No newline at end of file diff --git a/main/volta_core/style/constant.MAX_WIDTH.html b/main/volta_core/style/constant.MAX_WIDTH.html new file mode 100644 index 000000000..288f27d02 --- /dev/null +++ b/main/volta_core/style/constant.MAX_WIDTH.html @@ -0,0 +1 @@ +MAX_WIDTH in volta_core::style - Rust

Constant volta_core::style::MAX_WIDTH

source ·
pub const MAX_WIDTH: usize = 100;
\ No newline at end of file diff --git a/main/volta_core/style/fn.action_str.html b/main/volta_core/style/fn.action_str.html new file mode 100644 index 000000000..a3eba3e39 --- /dev/null +++ b/main/volta_core/style/fn.action_str.html @@ -0,0 +1,2 @@ +action_str in volta_core::style - Rust

Function volta_core::style::action_str

source ·
fn action_str(origin: Origin) -> &'static str
Expand description

Determines the string to display based on the Origin of the operation.

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.format_error_cause.html b/main/volta_core/style/fn.format_error_cause.html new file mode 100644 index 000000000..37767df6c --- /dev/null +++ b/main/volta_core/style/fn.format_error_cause.html @@ -0,0 +1,2 @@ +format_error_cause in volta_core::style - Rust
pub(crate) fn format_error_cause(inner: &dyn Error) -> String
Expand description

Format the underlying cause of an error

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.note_prefix.html b/main/volta_core/style/fn.note_prefix.html new file mode 100644 index 000000000..a8e5efc56 --- /dev/null +++ b/main/volta_core/style/fn.note_prefix.html @@ -0,0 +1,2 @@ +note_prefix in volta_core::style - Rust

Function volta_core::style::note_prefix

source ·
pub fn note_prefix() -> StyledObject<&'static str>
Expand description

Generate the styled prefix for a note

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.progress_bar.html b/main/volta_core/style/fn.progress_bar.html new file mode 100644 index 000000000..97e777bdd --- /dev/null +++ b/main/volta_core/style/fn.progress_bar.html @@ -0,0 +1,5 @@ +progress_bar in volta_core::style - Rust

Function volta_core::style::progress_bar

source ·
pub fn progress_bar(origin: Origin, details: &str, len: u64) -> ProgressBar
Expand description

Constructs a command-line progress bar based on the specified Origin enum +(e.g., Origin::Remote), details string (e.g., "v1.23.4"), and logical +length (i.e., the number of logical progress steps in the process being +visualized by the progress bar).

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.progress_spinner.html b/main/volta_core/style/fn.progress_spinner.html new file mode 100644 index 000000000..c0b8e0df6 --- /dev/null +++ b/main/volta_core/style/fn.progress_spinner.html @@ -0,0 +1,4 @@ +progress_spinner in volta_core::style - Rust
pub fn progress_spinner<S>(message: S) -> ProgressBarwhere
+    S: Into<Cow<'static, str>>,
Expand description

Constructs a command-line progress spinner with the specified “message” +string. The spinner is ticked by default every 50ms.

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.success_prefix.html b/main/volta_core/style/fn.success_prefix.html new file mode 100644 index 000000000..bf3572c17 --- /dev/null +++ b/main/volta_core/style/fn.success_prefix.html @@ -0,0 +1,2 @@ +success_prefix in volta_core::style - Rust
pub fn success_prefix() -> StyledObject<&'static str>
Expand description

Generate the styled prefix for a success message

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.text_width.html b/main/volta_core/style/fn.text_width.html new file mode 100644 index 000000000..cfaf1ea8a --- /dev/null +++ b/main/volta_core/style/fn.text_width.html @@ -0,0 +1,2 @@ +text_width in volta_core::style - Rust

Function volta_core::style::text_width

source ·
pub fn text_width() -> Option<usize>
Expand description

Get the width of the terminal, limited to a maximum of MAX_WIDTH

+
\ No newline at end of file diff --git a/main/volta_core/style/fn.tool_version.html b/main/volta_core/style/fn.tool_version.html new file mode 100644 index 000000000..fb0b70576 --- /dev/null +++ b/main/volta_core/style/fn.tool_version.html @@ -0,0 +1,3 @@ +tool_version in volta_core::style - Rust

Function volta_core::style::tool_version

source ·
pub fn tool_version<N, V>(name: N, version: V) -> Stringwhere
+    N: Display + Sized,
+    V: Display + Sized,
\ No newline at end of file diff --git a/main/volta_core/style/index.html b/main/volta_core/style/index.html new file mode 100644 index 000000000..6bac0f421 --- /dev/null +++ b/main/volta_core/style/index.html @@ -0,0 +1,6 @@ +volta_core::style - Rust

Module volta_core::style

source ·
Expand description

The view layer of Volta, with utilities for styling command-line output.

+

Constants

Functions

  • action_str 🔒
    Determines the string to display based on the Origin of the operation.
  • Format the underlying cause of an error
  • Generate the styled prefix for a note
  • Constructs a command-line progress bar based on the specified Origin enum +(e.g., Origin::Remote), details string (e.g., "v1.23.4"), and logical +length (i.e., the number of logical progress steps in the process being +visualized by the progress bar).
  • Constructs a command-line progress spinner with the specified “message” +string. The spinner is ticked by default every 50ms.
  • Generate the styled prefix for a success message
  • Get the width of the terminal, limited to a maximum of MAX_WIDTH
\ No newline at end of file diff --git a/main/volta_core/style/sidebar-items.js b/main/volta_core/style/sidebar-items.js new file mode 100644 index 000000000..a3db17d59 --- /dev/null +++ b/main/volta_core/style/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["MAX_PROGRESS_WIDTH","MAX_WIDTH"],"fn":["action_str","format_error_cause","note_prefix","progress_bar","progress_spinner","success_prefix","text_width","tool_version"]}; \ No newline at end of file diff --git a/main/volta_core/sync/constant.LOCK_FILE.html b/main/volta_core/sync/constant.LOCK_FILE.html new file mode 100644 index 000000000..72cd8b60c --- /dev/null +++ b/main/volta_core/sync/constant.LOCK_FILE.html @@ -0,0 +1 @@ +LOCK_FILE in volta_core::sync - Rust

Constant volta_core::sync::LOCK_FILE

source ·
const LOCK_FILE: &str = "volta.lock";
\ No newline at end of file diff --git a/main/volta_core/sync/index.html b/main/volta_core/sync/index.html new file mode 100644 index 000000000..d21860100 --- /dev/null +++ b/main/volta_core/sync/index.html @@ -0,0 +1,22 @@ +volta_core::sync - Rust

Module volta_core::sync

source ·
Expand description

Inter-process locking on the Volta directory

+

To avoid issues where multiple separate invocations of Volta modify the +data directory simultaneously, we provide a locking mechanism that only +allows a single process to modify the directory at a time.

+

However, within a single process, we may attempt to lock the directory in +different code paths. For example, when installing a package we require a +lock, however we also may need to install Node, which requires a lock as +well. To avoid deadlocks in those situations, we track the state of the +lock globally:

+
    +
  • If a lock is requested and no locks are active, then we acquire a file +lock on the volta.lock file and initialize the state with a count of 1
  • +
  • If a lock already exists, then we increment the count of active locks
  • +
  • When a lock is no longer needed, we decrement the count of active locks
  • +
  • When the last lock is released, we release the file lock and clear the +global lock state.
  • +
+

This allows multiple code paths to request a lock and not worry about +potential deadlocks, while still preventing multiple processes from making +concurrent changes.

+

Structs

  • LockState 🔒
    The current state of locks for this process.
  • An RAII implementation of a process lock on the Volta directory. A given Volta process can have +multiple active locks, but only one process can have any locks at a time.

Constants

Statics

\ No newline at end of file diff --git a/main/volta_core/sync/sidebar-items.js b/main/volta_core/sync/sidebar-items.js new file mode 100644 index 000000000..cc4faa1bc --- /dev/null +++ b/main/volta_core/sync/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["LOCK_FILE"],"static":["LOCK_STATE"],"struct":["LockState","VoltaLock"]}; \ No newline at end of file diff --git a/main/volta_core/sync/static.LOCK_STATE.html b/main/volta_core/sync/static.LOCK_STATE.html new file mode 100644 index 000000000..eb8186a25 --- /dev/null +++ b/main/volta_core/sync/static.LOCK_STATE.html @@ -0,0 +1 @@ +LOCK_STATE in volta_core::sync - Rust

Static volta_core::sync::LOCK_STATE

source ·
static LOCK_STATE: Lazy<Mutex<Option<LockState>>>
\ No newline at end of file diff --git a/main/volta_core/sync/struct.LockState.html b/main/volta_core/sync/struct.LockState.html new file mode 100644 index 000000000..e4fd378f8 --- /dev/null +++ b/main/volta_core/sync/struct.LockState.html @@ -0,0 +1,20 @@ +LockState in volta_core::sync - Rust

Struct volta_core::sync::LockState

source ·
struct LockState {
+    file: File,
+    count: usize,
+}
Expand description

The current state of locks for this process.

+

Note: To ensure thread safety within this process, we enclose the +state in a Mutex. This Mutex and it’s associated locks are separate +from the overall process lock and are only used to ensure the count +is accurately maintained within a given process.

+

Fields§

§file: File§count: usize

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/sync/struct.VoltaLock.html b/main/volta_core/sync/struct.VoltaLock.html new file mode 100644 index 000000000..4910e3ee5 --- /dev/null +++ b/main/volta_core/sync/struct.VoltaLock.html @@ -0,0 +1,18 @@ +VoltaLock in volta_core::sync - Rust

Struct volta_core::sync::VoltaLock

source ·
pub struct VoltaLock {
+    _private: PhantomData<()>,
+}
Expand description

An RAII implementation of a process lock on the Volta directory. A given Volta process can have +multiple active locks, but only one process can have any locks at a time.

+

Once all of the VoltaLock objects go out of scope, the lock will be released to other +processes.

+

Fields§

§_private: PhantomData<()>

Implementations§

Trait Implementations§

source§

impl Drop for VoltaLock

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/constant.PATH_VAR_NAME.html b/main/volta_core/tool/constant.PATH_VAR_NAME.html new file mode 100644 index 000000000..78a7816ee --- /dev/null +++ b/main/volta_core/tool/constant.PATH_VAR_NAME.html @@ -0,0 +1 @@ +PATH_VAR_NAME in volta_core::tool - Rust

Constant volta_core::tool::PATH_VAR_NAME

source ·
const PATH_VAR_NAME: &str = "PATH";
\ No newline at end of file diff --git a/main/volta_core/tool/enum.FetchStatus.html b/main/volta_core/tool/enum.FetchStatus.html new file mode 100644 index 000000000..4006601d9 --- /dev/null +++ b/main/volta_core/tool/enum.FetchStatus.html @@ -0,0 +1,17 @@ +FetchStatus in volta_core::tool - Rust
enum FetchStatus {
+    AlreadyFetched,
+    FetchNeeded(Option<VoltaLock>),
+}
Expand description

Represents the result of checking if a tool is available locally or not

+

If a fetch is required, will include an exclusive lock on the Volta directory where possible

+

Variants§

§

AlreadyFetched

§

FetchNeeded(Option<VoltaLock>)

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/enum.Spec.html b/main/volta_core/tool/enum.Spec.html new file mode 100644 index 000000000..66b18066e --- /dev/null +++ b/main/volta_core/tool/enum.Spec.html @@ -0,0 +1,47 @@ +Spec in volta_core::tool - Rust

Enum volta_core::tool::Spec

source ·
pub enum Spec {
+    Node(VersionSpec),
+    Npm(VersionSpec),
+    Pnpm(VersionSpec),
+    Yarn(VersionSpec),
+    Package(String, VersionSpec),
+}
Expand description

Specification for a tool and its associated version.

+

Variants§

Implementations§

source§

impl Spec

Methods for parsing a Spec out of string values

+
source

pub fn from_str_and_version(tool_name: &str, version: VersionSpec) -> Self

source

pub fn try_from_str(tool_spec: &str) -> Fallible<Self>

Try to parse a tool and version from a string like `[@].

+
source

pub fn from_strings<T>(tool_strs: &[T], action: &str) -> Fallible<Vec<Spec>>where + T: AsRef<str>,

Get a valid, sorted Vec<Spec> given a Vec<String>.

+

Accounts for the following error conditions:

+
    +
  • volta install node 12, where the user intended to install node@12 +but used syntax like in nodenv or nvm
  • +
  • invalid version specs
  • +
+

Returns a listed sorted so that if node is included in the list, it is +always first.

+
source

fn check_args<T>(args: &[T], action: &str) -> Fallible<()>where + T: AsRef<str>,

Check the args for the bad patterns of

+
    +
  • volta install <number>
  • +
  • volta install <tool> <number>
  • +
+
source

fn sort_comparator(left: &Spec, right: &Spec) -> Ordering

Compare Specs for sorting when converting from strings

+

We want to preserve the original order as much as possible, so we treat tools in +the same tool category as equal. We still need to pull Node to the front of the +list, followed by Npm, pnpm, Yarn, and then Packages last.

+
source§

impl Spec

source

pub fn resolve(self, session: &mut Session) -> Fallible<Box<dyn Tool>>

Resolve a tool spec into a fully realized Tool that can be fetched

+
source

pub fn uninstall(self) -> Fallible<()>

Uninstall a tool, removing it from the local inventory

+

This is implemented on Spec, instead of Resolved, because there is currently no need to +resolve the specific version before uninstalling a tool.

+
source

pub fn name(&self) -> &str

The name of the tool, without the version, used for messaging

+

Trait Implementations§

source§

impl Debug for Spec

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for Spec

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnwindSafe for Spec

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/fn.check_fetched.html b/main/volta_core/tool/fn.check_fetched.html new file mode 100644 index 000000000..e8a9eba4a --- /dev/null +++ b/main/volta_core/tool/fn.check_fetched.html @@ -0,0 +1,9 @@ +check_fetched in volta_core::tool - Rust

Function volta_core::tool::check_fetched

source ·
fn check_fetched<F>(already_fetched: F) -> Fallible<FetchStatus>where
+    F: Fn() -> Fallible<bool>,
Expand description

Uses the supplied already_fetched predicate to determine if a tool is available or not.

+

This uses double-checking logic, to correctly handle concurrent fetch requests:

+
    +
  • If already_fetched indicates that a fetch is needed, we acquire an exclusive lock on the Volta directory
  • +
  • Then, we check again, to confirm that no other process completed the fetch while we waited for the lock
  • +
+

Note: If acquiring the lock fails, we proceed anyway, since the fetch is still necessary.

+
\ No newline at end of file diff --git a/main/volta_core/tool/fn.check_shim_reachable.html b/main/volta_core/tool/fn.check_shim_reachable.html new file mode 100644 index 000000000..cb112e072 --- /dev/null +++ b/main/volta_core/tool/fn.check_shim_reachable.html @@ -0,0 +1,3 @@ +check_shim_reachable in volta_core::tool - Rust
pub fn check_shim_reachable(shim_name: &str)
Expand description

Check if a newly-installed shim is first on the PATH. If it isn’t, we want to inform the user +that they’ll want to move it to the start of PATH to make sure things work as expected.

+
\ No newline at end of file diff --git a/main/volta_core/tool/fn.debug_already_fetched.html b/main/volta_core/tool/fn.debug_already_fetched.html new file mode 100644 index 000000000..3a54ef839 --- /dev/null +++ b/main/volta_core/tool/fn.debug_already_fetched.html @@ -0,0 +1 @@ +debug_already_fetched in volta_core::tool - Rust
fn debug_already_fetched<T: Display>(tool: T)
\ No newline at end of file diff --git a/main/volta_core/tool/fn.download_tool_error.html b/main/volta_core/tool/fn.download_tool_error.html new file mode 100644 index 000000000..68d501a91 --- /dev/null +++ b/main/volta_core/tool/fn.download_tool_error.html @@ -0,0 +1,4 @@ +download_tool_error in volta_core::tool - Rust
fn download_tool_error(
+    tool: Spec,
+    from_url: impl AsRef<str>
+) -> impl FnOnce() -> ErrorKind
\ No newline at end of file diff --git a/main/volta_core/tool/fn.find_expected_shim_dir.html b/main/volta_core/tool/fn.find_expected_shim_dir.html new file mode 100644 index 000000000..291e40c7c --- /dev/null +++ b/main/volta_core/tool/fn.find_expected_shim_dir.html @@ -0,0 +1,3 @@ +find_expected_shim_dir in volta_core::tool - Rust
fn find_expected_shim_dir(_shim_name: &str) -> Option<PathBuf>
Expand description

Locate the base directory for the relevant shim in the Volta directories.

+

On Unix, all of the shims, including the default ones, are installed in VoltaHome::shim_dir

+
\ No newline at end of file diff --git a/main/volta_core/tool/fn.info_fetched.html b/main/volta_core/tool/fn.info_fetched.html new file mode 100644 index 000000000..20163bd97 --- /dev/null +++ b/main/volta_core/tool/fn.info_fetched.html @@ -0,0 +1 @@ +info_fetched in volta_core::tool - Rust

Function volta_core::tool::info_fetched

source ·
fn info_fetched<T: Display>(tool: T)
\ No newline at end of file diff --git a/main/volta_core/tool/fn.info_installed.html b/main/volta_core/tool/fn.info_installed.html new file mode 100644 index 000000000..f2885a5a9 --- /dev/null +++ b/main/volta_core/tool/fn.info_installed.html @@ -0,0 +1 @@ +info_installed in volta_core::tool - Rust
fn info_installed<T: Display>(tool: T)
\ No newline at end of file diff --git a/main/volta_core/tool/fn.info_pinned.html b/main/volta_core/tool/fn.info_pinned.html new file mode 100644 index 000000000..dd86959fc --- /dev/null +++ b/main/volta_core/tool/fn.info_pinned.html @@ -0,0 +1 @@ +info_pinned in volta_core::tool - Rust

Function volta_core::tool::info_pinned

source ·
fn info_pinned<T: Display>(tool: T)
\ No newline at end of file diff --git a/main/volta_core/tool/fn.info_project_version.html b/main/volta_core/tool/fn.info_project_version.html new file mode 100644 index 000000000..b0b879bca --- /dev/null +++ b/main/volta_core/tool/fn.info_project_version.html @@ -0,0 +1,3 @@ +info_project_version in volta_core::tool - Rust
fn info_project_version<P, D>(project_version: P, default_version: D)where
+    P: Display,
+    D: Display,
\ No newline at end of file diff --git a/main/volta_core/tool/fn.registry_fetch_error.html b/main/volta_core/tool/fn.registry_fetch_error.html new file mode 100644 index 000000000..179d9ae06 --- /dev/null +++ b/main/volta_core/tool/fn.registry_fetch_error.html @@ -0,0 +1,4 @@ +registry_fetch_error in volta_core::tool - Rust
fn registry_fetch_error(
+    tool: impl AsRef<str>,
+    from_url: impl AsRef<str>
+) -> impl FnOnce() -> ErrorKind
\ No newline at end of file diff --git a/main/volta_core/tool/index.html b/main/volta_core/tool/index.html new file mode 100644 index 000000000..b8eebae57 --- /dev/null +++ b/main/volta_core/tool/index.html @@ -0,0 +1,2 @@ +volta_core::tool - Rust

Module volta_core::tool

source ·

Re-exports

Modules

Structs

Enums

  • Represents the result of checking if a tool is available locally or not
  • Specification for a tool and its associated version.

Constants

Traits

  • Trait representing all of the actions that can be taken with a tool

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/node/constant.NODE_DISTRO_ARCH.html b/main/volta_core/tool/node/constant.NODE_DISTRO_ARCH.html new file mode 100644 index 000000000..b2dcbca2e --- /dev/null +++ b/main/volta_core/tool/node/constant.NODE_DISTRO_ARCH.html @@ -0,0 +1,2 @@ +NODE_DISTRO_ARCH in volta_core::tool::node - Rust
pub const NODE_DISTRO_ARCH: &str = "x64";
Expand description

The architecture component of a Node distro filename

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/constant.NODE_DISTRO_EXTENSION.html b/main/volta_core/tool/node/constant.NODE_DISTRO_EXTENSION.html new file mode 100644 index 000000000..88880a887 --- /dev/null +++ b/main/volta_core/tool/node/constant.NODE_DISTRO_EXTENSION.html @@ -0,0 +1,2 @@ +NODE_DISTRO_EXTENSION in volta_core::tool::node - Rust
pub const NODE_DISTRO_EXTENSION: &str = "tar.gz";
Expand description

The extension for Node distro files

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/constant.NODE_DISTRO_IDENTIFIER.html b/main/volta_core/tool/node/constant.NODE_DISTRO_IDENTIFIER.html new file mode 100644 index 000000000..8be1fff35 --- /dev/null +++ b/main/volta_core/tool/node/constant.NODE_DISTRO_IDENTIFIER.html @@ -0,0 +1,2 @@ +NODE_DISTRO_IDENTIFIER in volta_core::tool::node - Rust
pub const NODE_DISTRO_IDENTIFIER: &str = "linux-x64";
Expand description

The file identifier in the Node index files array

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/constant.NODE_DISTRO_OS.html b/main/volta_core/tool/node/constant.NODE_DISTRO_OS.html new file mode 100644 index 000000000..7c2c89404 --- /dev/null +++ b/main/volta_core/tool/node/constant.NODE_DISTRO_OS.html @@ -0,0 +1,2 @@ +NODE_DISTRO_OS in volta_core::tool::node - Rust
pub const NODE_DISTRO_OS: &str = "linux";
Expand description

The OS component of a Node distro filename

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.determine_remote_url.html b/main/volta_core/tool/node/fetch/fn.determine_remote_url.html new file mode 100644 index 000000000..49288b493 --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.determine_remote_url.html @@ -0,0 +1,5 @@ +determine_remote_url in volta_core::tool::node::fetch - Rust
fn determine_remote_url(
+    version: &Version,
+    hooks: Option<&ToolHooks<Node>>
+) -> Fallible<String>
Expand description

Determine the remote URL to download from, using the hooks if available

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.fetch.html b/main/volta_core/tool/node/fetch/fn.fetch.html new file mode 100644 index 000000000..fc467acee --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.fetch.html @@ -0,0 +1,4 @@ +fetch in volta_core::tool::node::fetch - Rust

Function volta_core::tool::node::fetch::fetch

source ·
pub fn fetch(
+    version: &Version,
+    hooks: Option<&ToolHooks<Node>>
+) -> Fallible<NodeVersion>
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.fetch_remote_distro.html b/main/volta_core/tool/node/fetch/fn.fetch_remote_distro.html new file mode 100644 index 000000000..90799cec7 --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.fetch_remote_distro.html @@ -0,0 +1,6 @@ +fetch_remote_distro in volta_core::tool::node::fetch - Rust
fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path
+) -> Fallible<Box<dyn Archive>>
Expand description

Fetch the distro archive from the internet

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.load_cached_distro.html b/main/volta_core/tool/node/fetch/fn.load_cached_distro.html new file mode 100644 index 000000000..0cddaa4ca --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.load_cached_distro.html @@ -0,0 +1,3 @@ +load_cached_distro in volta_core::tool::node::fetch - Rust
fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>>
Expand description

Return the archive if it is valid. It may have been corrupted or interrupted in the middle of +downloading.

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.load_default_npm_version.html b/main/volta_core/tool/node/fetch/fn.load_default_npm_version.html new file mode 100644 index 000000000..9a99f8d27 --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.load_default_npm_version.html @@ -0,0 +1,2 @@ +load_default_npm_version in volta_core::tool::node::fetch - Rust
pub fn load_default_npm_version(node: &Version) -> Fallible<Version>
Expand description

Load the local npm version file to determine the default npm version for a given version of Node

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.npm_manifest_path.html b/main/volta_core/tool/node/fetch/fn.npm_manifest_path.html new file mode 100644 index 000000000..d2e1d7201 --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.npm_manifest_path.html @@ -0,0 +1 @@ +npm_manifest_path in volta_core::tool::node::fetch - Rust
fn npm_manifest_path(version: &Version) -> PathBuf
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.public_node_server_root.html b/main/volta_core/tool/node/fetch/fn.public_node_server_root.html new file mode 100644 index 000000000..9cf8eb7a8 --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.public_node_server_root.html @@ -0,0 +1 @@ +public_node_server_root in volta_core::tool::node::fetch - Rust
fn public_node_server_root() -> String
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.save_default_npm_version.html b/main/volta_core/tool/node/fetch/fn.save_default_npm_version.html new file mode 100644 index 000000000..6a67e5cdd --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.save_default_npm_version.html @@ -0,0 +1,2 @@ +save_default_npm_version in volta_core::tool::node::fetch - Rust
fn save_default_npm_version(node: &Version, npm: &Version) -> Fallible<()>
Expand description

Save the default npm version to the filesystem for a given version of Node

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/fn.unpack_archive.html b/main/volta_core/tool/node/fetch/fn.unpack_archive.html new file mode 100644 index 000000000..d3e806599 --- /dev/null +++ b/main/volta_core/tool/node/fetch/fn.unpack_archive.html @@ -0,0 +1,5 @@ +unpack_archive in volta_core::tool::node::fetch - Rust
fn unpack_archive(
+    archive: Box<dyn Archive>,
+    version: &Version
+) -> Fallible<NodeVersion>
Expand description

Unpack the node archive into the image directory so that it is ready for use

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/index.html b/main/volta_core/tool/node/fetch/index.html new file mode 100644 index 000000000..44369f05b --- /dev/null +++ b/main/volta_core/tool/node/fetch/index.html @@ -0,0 +1,3 @@ +volta_core::tool::node::fetch - Rust

Module volta_core::tool::node::fetch

source ·
Expand description

Provides fetcher for Node distributions

+

Structs

  • Manifest 🔒
    The portion of npm’s package.json file that we care about

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/sidebar-items.js b/main/volta_core/tool/node/fetch/sidebar-items.js new file mode 100644 index 000000000..50322691a --- /dev/null +++ b/main/volta_core/tool/node/fetch/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["determine_remote_url","fetch","fetch_remote_distro","load_cached_distro","load_default_npm_version","npm_manifest_path","public_node_server_root","save_default_npm_version","unpack_archive"],"struct":["Manifest"]}; \ No newline at end of file diff --git a/main/volta_core/tool/node/fetch/struct.Manifest.html b/main/volta_core/tool/node/fetch/struct.Manifest.html new file mode 100644 index 000000000..b4b140fe7 --- /dev/null +++ b/main/volta_core/tool/node/fetch/struct.Manifest.html @@ -0,0 +1,18 @@ +Manifest in volta_core::tool::node::fetch - Rust
struct Manifest {
+    version: String,
+}
Expand description

The portion of npm’s package.json file that we care about

+

Fields§

§version: String

Implementations§

source§

impl Manifest

source

fn version(path: &Path) -> Fallible<Version>

Parse the version out of a package.json file

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for Manifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/node/fn.load_default_npm_version.html b/main/volta_core/tool/node/fn.load_default_npm_version.html new file mode 100644 index 000000000..91edc4003 --- /dev/null +++ b/main/volta_core/tool/node/fn.load_default_npm_version.html @@ -0,0 +1,2 @@ +load_default_npm_version in volta_core::tool::node - Rust
pub fn load_default_npm_version(node: &Version) -> Fallible<Version>
Expand description

Load the local npm version file to determine the default npm version for a given version of Node

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/fn.resolve.html b/main/volta_core/tool/node/fn.resolve.html new file mode 100644 index 000000000..de4dc591b --- /dev/null +++ b/main/volta_core/tool/node/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::node - Rust

Function volta_core::tool::node::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/node/index.html b/main/volta_core/tool/node/index.html new file mode 100644 index 000000000..83be2241c --- /dev/null +++ b/main/volta_core/tool/node/index.html @@ -0,0 +1,3 @@ +volta_core::tool::node - Rust

Module volta_core::tool::node

source ·

Modules

  • fetch 🔒
    Provides fetcher for Node distributions
  • metadata 🔒
  • resolve 🔒
    Provides resolution of Node requirements into specific versions, using the NodeJS index

Structs

  • The Tool implementation for fetching and installing Node
  • A full Node version including not just the version of Node itself +but also the specific version of npm installed globally with that +Node installation.

Constants

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/fn.lts_version_serde.html b/main/volta_core/tool/node/metadata/fn.lts_version_serde.html new file mode 100644 index 000000000..864dc0142 --- /dev/null +++ b/main/volta_core/tool/node/metadata/fn.lts_version_serde.html @@ -0,0 +1,2 @@ +lts_version_serde in volta_core::tool::node::metadata - Rust
fn lts_version_serde<'de, D>(deserializer: D) -> Result<bool, D::Error>where
+    D: Deserializer<'de>,
\ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/index.html b/main/volta_core/tool/node/metadata/index.html new file mode 100644 index 000000000..11a26186d --- /dev/null +++ b/main/volta_core/tool/node/metadata/index.html @@ -0,0 +1 @@ +volta_core::tool::node::metadata - Rust
\ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/sidebar-items.js b/main/volta_core/tool/node/metadata/sidebar-items.js new file mode 100644 index 000000000..f348aab45 --- /dev/null +++ b/main/volta_core/tool/node/metadata/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["lts_version_serde"],"struct":["NodeEntry","NodeIndex","RawNodeEntry","RawNodeIndex"]}; \ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/struct.NodeEntry.html b/main/volta_core/tool/node/metadata/struct.NodeEntry.html new file mode 100644 index 000000000..ceac5c7f4 --- /dev/null +++ b/main/volta_core/tool/node/metadata/struct.NodeEntry.html @@ -0,0 +1,15 @@ +NodeEntry in volta_core::tool::node::metadata - Rust
pub struct NodeEntry {
+    pub version: Version,
+    pub lts: bool,
+}

Fields§

§version: Version§lts: bool

Trait Implementations§

source§

impl Debug for NodeEntry

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/struct.NodeIndex.html b/main/volta_core/tool/node/metadata/struct.NodeIndex.html new file mode 100644 index 000000000..9afd816e7 --- /dev/null +++ b/main/volta_core/tool/node/metadata/struct.NodeIndex.html @@ -0,0 +1,15 @@ +NodeIndex in volta_core::tool::node::metadata - Rust
pub struct NodeIndex {
+    pub(super) entries: Vec<NodeEntry>,
+}
Expand description

The index of the public Node server.

+

Fields§

§entries: Vec<NodeEntry>

Trait Implementations§

source§

impl From<RawNodeIndex> for NodeIndex

source§

fn from(raw: RawNodeIndex) -> NodeIndex

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/struct.RawNodeEntry.html b/main/volta_core/tool/node/metadata/struct.RawNodeEntry.html new file mode 100644 index 000000000..6506751a9 --- /dev/null +++ b/main/volta_core/tool/node/metadata/struct.RawNodeEntry.html @@ -0,0 +1,19 @@ +RawNodeEntry in volta_core::tool::node::metadata - Rust
pub struct RawNodeEntry {
+    version: Version,
+    npm: Option<Version>,
+    files: HashSet<String>,
+    lts: bool,
+}

Fields§

§version: Version§npm: Option<Version>§files: HashSet<String>§lts: bool

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawNodeEntry

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/node/metadata/struct.RawNodeIndex.html b/main/volta_core/tool/node/metadata/struct.RawNodeIndex.html new file mode 100644 index 000000000..cb472cb32 --- /dev/null +++ b/main/volta_core/tool/node/metadata/struct.RawNodeIndex.html @@ -0,0 +1,14 @@ +RawNodeIndex in volta_core::tool::node::metadata - Rust
pub struct RawNodeIndex(Vec<RawNodeEntry>);

Tuple Fields§

§0: Vec<RawNodeEntry>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawNodeIndex

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<RawNodeIndex> for NodeIndex

source§

fn from(raw: RawNodeIndex) -> NodeIndex

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.match_node_version.html b/main/volta_core/tool/node/resolve/fn.match_node_version.html new file mode 100644 index 000000000..ac617d286 --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.match_node_version.html @@ -0,0 +1,4 @@ +match_node_version in volta_core::tool::node::resolve - Rust
fn match_node_version(
+    url: &str,
+    predicate: impl Fn(&NodeEntry) -> bool
+) -> Fallible<Option<Version>>
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.max_age.html b/main/volta_core/tool/node/resolve/fn.max_age.html new file mode 100644 index 000000000..0716d1c6f --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.max_age.html @@ -0,0 +1,2 @@ +max_age in volta_core::tool::node::resolve - Rust

Function volta_core::tool::node::resolve::max_age

source ·
fn max_age(headers: &HeaderMap) -> Duration
Expand description

Get the cache max-age of an HTTP response.

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.public_node_version_index.html b/main/volta_core/tool/node/resolve/fn.public_node_version_index.html new file mode 100644 index 000000000..491dbdf72 --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.public_node_version_index.html @@ -0,0 +1,2 @@ +public_node_version_index in volta_core::tool::node::resolve - Rust
fn public_node_version_index() -> String
Expand description

Returns the URL of the index of available Node versions on the public Node server.

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.read_cached_opt.html b/main/volta_core/tool/node/resolve/fn.read_cached_opt.html new file mode 100644 index 000000000..51a0e5ff5 --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.read_cached_opt.html @@ -0,0 +1,2 @@ +read_cached_opt in volta_core::tool::node::resolve - Rust
fn read_cached_opt(url: &str) -> Fallible<Option<RawNodeIndex>>
Expand description

Reads a public index from the Node cache, if it exists and hasn’t expired.

+
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.resolve.html b/main/volta_core/tool/node/resolve/fn.resolve.html new file mode 100644 index 000000000..a72439d9b --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::node::resolve - Rust

Function volta_core::tool::node::resolve::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.resolve_latest.html b/main/volta_core/tool/node/resolve/fn.resolve_latest.html new file mode 100644 index 000000000..d17b6f371 --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.resolve_latest.html @@ -0,0 +1 @@ +resolve_latest in volta_core::tool::node::resolve - Rust
fn resolve_latest(hooks: Option<&ToolHooks<Node>>) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.resolve_lts.html b/main/volta_core/tool/node/resolve/fn.resolve_lts.html new file mode 100644 index 000000000..fb1da1dee --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.resolve_lts.html @@ -0,0 +1 @@ +resolve_lts in volta_core::tool::node::resolve - Rust
fn resolve_lts(hooks: Option<&ToolHooks<Node>>) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.resolve_node_versions.html b/main/volta_core/tool/node/resolve/fn.resolve_node_versions.html new file mode 100644 index 000000000..e22ff8918 --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.resolve_node_versions.html @@ -0,0 +1 @@ +resolve_node_versions in volta_core::tool::node::resolve - Rust
fn resolve_node_versions(url: &str) -> Fallible<RawNodeIndex>
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/fn.resolve_semver.html b/main/volta_core/tool/node/resolve/fn.resolve_semver.html new file mode 100644 index 000000000..b2433a882 --- /dev/null +++ b/main/volta_core/tool/node/resolve/fn.resolve_semver.html @@ -0,0 +1,4 @@ +resolve_semver in volta_core::tool::node::resolve - Rust
fn resolve_semver(
+    matching: Range,
+    hooks: Option<&ToolHooks<Node>>
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/index.html b/main/volta_core/tool/node/resolve/index.html new file mode 100644 index 000000000..9f528238e --- /dev/null +++ b/main/volta_core/tool/node/resolve/index.html @@ -0,0 +1,2 @@ +volta_core::tool::node::resolve - Rust

Module volta_core::tool::node::resolve

source ·
Expand description

Provides resolution of Node requirements into specific versions, using the NodeJS index

+

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/node/resolve/sidebar-items.js b/main/volta_core/tool/node/resolve/sidebar-items.js new file mode 100644 index 000000000..e329bdef3 --- /dev/null +++ b/main/volta_core/tool/node/resolve/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["match_node_version","max_age","public_node_version_index","read_cached_opt","resolve","resolve_latest","resolve_lts","resolve_node_versions","resolve_semver"]}; \ No newline at end of file diff --git a/main/volta_core/tool/node/sidebar-items.js b/main/volta_core/tool/node/sidebar-items.js new file mode 100644 index 000000000..abc26d2fc --- /dev/null +++ b/main/volta_core/tool/node/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["NODE_DISTRO_ARCH","NODE_DISTRO_EXTENSION","NODE_DISTRO_IDENTIFIER","NODE_DISTRO_OS"],"fn":["load_default_npm_version","resolve"],"mod":["fetch","metadata","resolve"],"struct":["Node","NodeVersion"]}; \ No newline at end of file diff --git a/main/volta_core/tool/node/struct.Node.html b/main/volta_core/tool/node/struct.Node.html new file mode 100644 index 000000000..528747ba7 --- /dev/null +++ b/main/volta_core/tool/node/struct.Node.html @@ -0,0 +1,19 @@ +Node in volta_core::tool::node - Rust

Struct volta_core::tool::node::Node

source ·
pub struct Node {
+    pub(super) version: Version,
+}
Expand description

The Tool implementation for fetching and installing Node

+

Fields§

§version: Version

Implementations§

source§

impl Node

source

pub fn new(version: Version) -> Self

source

pub fn archive_basename(version: &Version) -> String

source

pub fn archive_filename(version: &Version) -> String

source

pub(crate) fn ensure_fetched( + &self, + session: &mut Session +) -> Fallible<NodeVersion>

Trait Implementations§

source§

impl Display for Node

source§

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

Formats the value using the given formatter. Read more
source§

impl Tool for Node

source§

fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory
source§

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine
source§

fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

Auto Trait Implementations§

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnwindSafe for Node

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/node/struct.NodeVersion.html b/main/volta_core/tool/node/struct.NodeVersion.html new file mode 100644 index 000000000..6e365ef8b --- /dev/null +++ b/main/volta_core/tool/node/struct.NodeVersion.html @@ -0,0 +1,22 @@ +NodeVersion in volta_core::tool::node - Rust
pub struct NodeVersion {
+    pub runtime: Version,
+    pub npm: Version,
+}
Expand description

A full Node version including not just the version of Node itself +but also the specific version of npm installed globally with that +Node installation.

+

Fields§

§runtime: Version

The version of Node itself.

+
§npm: Version

The npm version globally installed with the Node distro.

+

Trait Implementations§

source§

impl Clone for NodeVersion

source§

fn clone(&self) -> NodeVersion

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for NodeVersion

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for NodeVersion

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/fn.determine_remote_url.html b/main/volta_core/tool/npm/fetch/fn.determine_remote_url.html new file mode 100644 index 000000000..e50cd9906 --- /dev/null +++ b/main/volta_core/tool/npm/fetch/fn.determine_remote_url.html @@ -0,0 +1,5 @@ +determine_remote_url in volta_core::tool::npm::fetch - Rust
fn determine_remote_url(
+    version: &Version,
+    hooks: Option<&ToolHooks<Npm>>
+) -> Fallible<String>
Expand description

Determine the remote URL to download from, using the hooks if avaialble

+
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/fn.fetch.html b/main/volta_core/tool/npm/fetch/fn.fetch.html new file mode 100644 index 000000000..c2ac63633 --- /dev/null +++ b/main/volta_core/tool/npm/fetch/fn.fetch.html @@ -0,0 +1 @@ +fetch in volta_core::tool::npm::fetch - Rust

Function volta_core::tool::npm::fetch::fetch

source ·
pub fn fetch(version: &Version, hooks: Option<&ToolHooks<Npm>>) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/fn.fetch_remote_distro.html b/main/volta_core/tool/npm/fetch/fn.fetch_remote_distro.html new file mode 100644 index 000000000..f7d81dc6c --- /dev/null +++ b/main/volta_core/tool/npm/fetch/fn.fetch_remote_distro.html @@ -0,0 +1,6 @@ +fetch_remote_distro in volta_core::tool::npm::fetch - Rust
fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path
+) -> Fallible<Box<dyn Archive>>
Expand description

Fetch the distro archive from the internet

+
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/fn.load_cached_distro.html b/main/volta_core/tool/npm/fetch/fn.load_cached_distro.html new file mode 100644 index 000000000..c26b9fa4c --- /dev/null +++ b/main/volta_core/tool/npm/fetch/fn.load_cached_distro.html @@ -0,0 +1,4 @@ +load_cached_distro in volta_core::tool::npm::fetch - Rust
fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>>
Expand description

Return the archive if it is valid. It may have been corrupted or interrupted in the middle of +downloading. +ISSUE(#134) - verify checksum

+
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/fn.overwrite_launcher.html b/main/volta_core/tool/npm/fetch/fn.overwrite_launcher.html new file mode 100644 index 000000000..76f2a045a --- /dev/null +++ b/main/volta_core/tool/npm/fetch/fn.overwrite_launcher.html @@ -0,0 +1,2 @@ +overwrite_launcher in volta_core::tool::npm::fetch - Rust
fn overwrite_launcher(base_path: &Path, tool: &str) -> Fallible<()>
Expand description

Overwrite the launcher script

+
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/fn.unpack_archive.html b/main/volta_core/tool/npm/fetch/fn.unpack_archive.html new file mode 100644 index 000000000..23743a6b0 --- /dev/null +++ b/main/volta_core/tool/npm/fetch/fn.unpack_archive.html @@ -0,0 +1,2 @@ +unpack_archive in volta_core::tool::npm::fetch - Rust
fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<()>
Expand description

Unpack the npm archive into the image directory so that it is ready for use

+
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/index.html b/main/volta_core/tool/npm/fetch/index.html new file mode 100644 index 000000000..8a736529d --- /dev/null +++ b/main/volta_core/tool/npm/fetch/index.html @@ -0,0 +1,4 @@ +volta_core::tool::npm::fetch - Rust

Module volta_core::tool::npm::fetch

source ·
Expand description

Provides fetcher for npm distributions

+

Functions

  • Determine the remote URL to download from, using the hooks if avaialble
  • Fetch the distro archive from the internet
  • Return the archive if it is valid. It may have been corrupted or interrupted in the middle of +downloading. +ISSUE(#134) - verify checksum
  • Overwrite the launcher script
  • Unpack the npm archive into the image directory so that it is ready for use
\ No newline at end of file diff --git a/main/volta_core/tool/npm/fetch/sidebar-items.js b/main/volta_core/tool/npm/fetch/sidebar-items.js new file mode 100644 index 000000000..480961327 --- /dev/null +++ b/main/volta_core/tool/npm/fetch/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["determine_remote_url","fetch","fetch_remote_distro","load_cached_distro","overwrite_launcher","unpack_archive"]}; \ No newline at end of file diff --git a/main/volta_core/tool/npm/fn.resolve.html b/main/volta_core/tool/npm/fn.resolve.html new file mode 100644 index 000000000..4996671fa --- /dev/null +++ b/main/volta_core/tool/npm/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::npm - Rust

Function volta_core::tool::npm::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Option<Version>>
\ No newline at end of file diff --git a/main/volta_core/tool/npm/index.html b/main/volta_core/tool/npm/index.html new file mode 100644 index 000000000..ad86178e6 --- /dev/null +++ b/main/volta_core/tool/npm/index.html @@ -0,0 +1 @@ +volta_core::tool::npm - Rust

Module volta_core::tool::npm

source ·

Modules

  • fetch 🔒
    Provides fetcher for npm distributions
  • resolve 🔒
    Provides resolution of npm Version requirements into specific versions

Structs

  • The Tool implementation for setting npm to the version bundled with Node
  • The Tool implementation for fetching and installing npm

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/npm/resolve/fn.fetch_npm_index.html b/main/volta_core/tool/npm/resolve/fn.fetch_npm_index.html new file mode 100644 index 000000000..f8e4d500a --- /dev/null +++ b/main/volta_core/tool/npm/resolve/fn.fetch_npm_index.html @@ -0,0 +1,3 @@ +fetch_npm_index in volta_core::tool::npm::resolve - Rust
fn fetch_npm_index(
+    hooks: Option<&ToolHooks<Npm>>
+) -> Fallible<(String, PackageIndex)>
\ No newline at end of file diff --git a/main/volta_core/tool/npm/resolve/fn.resolve.html b/main/volta_core/tool/npm/resolve/fn.resolve.html new file mode 100644 index 000000000..e60d62c19 --- /dev/null +++ b/main/volta_core/tool/npm/resolve/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::npm::resolve - Rust

Function volta_core::tool::npm::resolve::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Option<Version>>
\ No newline at end of file diff --git a/main/volta_core/tool/npm/resolve/fn.resolve_semver.html b/main/volta_core/tool/npm/resolve/fn.resolve_semver.html new file mode 100644 index 000000000..a2a2eb0c8 --- /dev/null +++ b/main/volta_core/tool/npm/resolve/fn.resolve_semver.html @@ -0,0 +1,4 @@ +resolve_semver in volta_core::tool::npm::resolve - Rust
fn resolve_semver(
+    matching: Range,
+    hooks: Option<&ToolHooks<Npm>>
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/npm/resolve/fn.resolve_tag.html b/main/volta_core/tool/npm/resolve/fn.resolve_tag.html new file mode 100644 index 000000000..a3b17c3a3 --- /dev/null +++ b/main/volta_core/tool/npm/resolve/fn.resolve_tag.html @@ -0,0 +1 @@ +resolve_tag in volta_core::tool::npm::resolve - Rust
fn resolve_tag(tag: &str, hooks: Option<&ToolHooks<Npm>>) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/npm/resolve/index.html b/main/volta_core/tool/npm/resolve/index.html new file mode 100644 index 000000000..516e6d8cd --- /dev/null +++ b/main/volta_core/tool/npm/resolve/index.html @@ -0,0 +1,2 @@ +volta_core::tool::npm::resolve - Rust

Module volta_core::tool::npm::resolve

source ·
Expand description

Provides resolution of npm Version requirements into specific versions

+

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/npm/resolve/sidebar-items.js b/main/volta_core/tool/npm/resolve/sidebar-items.js new file mode 100644 index 000000000..10461aa70 --- /dev/null +++ b/main/volta_core/tool/npm/resolve/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["fetch_npm_index","resolve","resolve_semver","resolve_tag"]}; \ No newline at end of file diff --git a/main/volta_core/tool/npm/sidebar-items.js b/main/volta_core/tool/npm/sidebar-items.js new file mode 100644 index 000000000..0d7c8a737 --- /dev/null +++ b/main/volta_core/tool/npm/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["resolve"],"mod":["fetch","resolve"],"struct":["BundledNpm","Npm"]}; \ No newline at end of file diff --git a/main/volta_core/tool/npm/struct.BundledNpm.html b/main/volta_core/tool/npm/struct.BundledNpm.html new file mode 100644 index 000000000..ec7adf193 --- /dev/null +++ b/main/volta_core/tool/npm/struct.BundledNpm.html @@ -0,0 +1,14 @@ +BundledNpm in volta_core::tool::npm - Rust

Struct volta_core::tool::npm::BundledNpm

source ·
pub struct BundledNpm;
Expand description

The Tool implementation for setting npm to the version bundled with Node

+

Trait Implementations§

source§

impl Display for BundledNpm

source§

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

Formats the value using the given formatter. Read more
source§

impl Tool for BundledNpm

source§

fn fetch(self: Box<Self>, _session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory
source§

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine
source§

fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/npm/struct.Npm.html b/main/volta_core/tool/npm/struct.Npm.html new file mode 100644 index 000000000..801f1aa65 --- /dev/null +++ b/main/volta_core/tool/npm/struct.Npm.html @@ -0,0 +1,16 @@ +Npm in volta_core::tool::npm - Rust

Struct volta_core::tool::npm::Npm

source ·
pub struct Npm {
+    pub(super) version: Version,
+}
Expand description

The Tool implementation for fetching and installing npm

+

Fields§

§version: Version

Implementations§

source§

impl Npm

source

pub fn new(version: Version) -> Self

source

pub fn archive_basename(version: &str) -> String

source

pub fn archive_filename(version: &str) -> String

source

pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<()>

Trait Implementations§

source§

impl Display for Npm

source§

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

Formats the value using the given formatter. Read more
source§

impl Tool for Npm

source§

fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory
source§

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine
source§

fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

Auto Trait Implementations§

§

impl RefUnwindSafe for Npm

§

impl Send for Npm

§

impl Sync for Npm

§

impl Unpin for Npm

§

impl UnwindSafe for Npm

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/configure/fn.parse_manifest.html b/main/volta_core/tool/package/configure/fn.parse_manifest.html new file mode 100644 index 000000000..2c02b7b7f --- /dev/null +++ b/main/volta_core/tool/package/configure/fn.parse_manifest.html @@ -0,0 +1,6 @@ +parse_manifest in volta_core::tool::package::configure - Rust
pub(super) fn parse_manifest(
+    package_name: &str,
+    staging_dir: PathBuf,
+    manager: PackageManager
+) -> Fallible<PackageManifest>
Expand description

Read the manifest for the package being installed

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/configure/fn.validate_bins.html b/main/volta_core/tool/package/configure/fn.validate_bins.html new file mode 100644 index 000000000..dc44a8d1d --- /dev/null +++ b/main/volta_core/tool/package/configure/fn.validate_bins.html @@ -0,0 +1,3 @@ +validate_bins in volta_core::tool::package::configure - Rust
fn validate_bins(package_name: &str, manifest: &PackageManifest) -> Fallible<()>
Expand description

Validate that we aren’t attempting to install a bin that is already installed by +another package.

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/configure/fn.write_config_and_shims.html b/main/volta_core/tool/package/configure/fn.write_config_and_shims.html new file mode 100644 index 000000000..fbee11a4b --- /dev/null +++ b/main/volta_core/tool/package/configure/fn.write_config_and_shims.html @@ -0,0 +1,7 @@ +write_config_and_shims in volta_core::tool::package::configure - Rust
pub(super) fn write_config_and_shims(
+    name: &str,
+    manifest: &PackageManifest,
+    image: &Image,
+    manager: PackageManager
+) -> Fallible<()>
Expand description

Generate configuration files and shims for the package and each of its bins

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/configure/index.html b/main/volta_core/tool/package/configure/index.html new file mode 100644 index 000000000..7165cf666 --- /dev/null +++ b/main/volta_core/tool/package/configure/index.html @@ -0,0 +1,2 @@ +volta_core::tool::package::configure - Rust

Functions

  • Read the manifest for the package being installed
  • Validate that we aren’t attempting to install a bin that is already installed by +another package.
  • Generate configuration files and shims for the package and each of its bins
\ No newline at end of file diff --git a/main/volta_core/tool/package/configure/sidebar-items.js b/main/volta_core/tool/package/configure/sidebar-items.js new file mode 100644 index 000000000..561b7f928 --- /dev/null +++ b/main/volta_core/tool/package/configure/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_manifest","validate_bins","write_config_and_shims"]}; \ No newline at end of file diff --git a/main/volta_core/tool/package/enum.NeedsScope.html b/main/volta_core/tool/package/enum.NeedsScope.html new file mode 100644 index 000000000..f10f0a6ec --- /dev/null +++ b/main/volta_core/tool/package/enum.NeedsScope.html @@ -0,0 +1,18 @@ +NeedsScope in volta_core::tool::package - Rust
enum NeedsScope {
+    Yes,
+    No,
+}

Variants§

§

Yes

§

No

Trait Implementations§

source§

impl Clone for NeedsScope

source§

fn clone(&self) -> NeedsScope

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl From<bool> for NeedsScope

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl PartialEq for NeedsScope

source§

fn eq(&self, other: &NeedsScope) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Copy for NeedsScope

source§

impl StructuralPartialEq for NeedsScope

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/enum.PackageManager.html b/main/volta_core/tool/package/enum.PackageManager.html new file mode 100644 index 000000000..a3637fab2 --- /dev/null +++ b/main/volta_core/tool/package/enum.PackageManager.html @@ -0,0 +1,48 @@ +PackageManager in volta_core::tool::package - Rust
pub enum PackageManager {
+    Npm,
+    Pnpm,
+    Yarn,
+}
Expand description

The package manager used to install a given package

+

Variants§

§

Npm

§

Pnpm

§

Yarn

Implementations§

source§

impl PackageManager

source

pub fn source_dir(self, package_root: PathBuf) -> PathBuf

Given the package_root, returns the directory where the source is stored for this +package manager. This will include the top-level node_modules, where appropriate.

+
source

pub fn source_root(self, package_root: PathBuf) -> PathBuf

Given the package_root, returns the root of the source directory. This directory will +contain the top-level node-modules

+
source

pub fn binary_dir(self, package_root: PathBuf) -> PathBuf

Given the package_root, returns the directory where binaries are stored for this package +manager.

+
source

pub fn setup_global_command(self, command: &mut Command, package_root: PathBuf)

Modify a given Command to be set up for global installs, given the package root

+
source

pub(super) fn get_installed_package( + self, + package_root: PathBuf +) -> Option<String>

Determine the name of the package that was installed into the package_root

+

If there are none or more than one package installed, then we return None

+

Trait Implementations§

source§

impl Clone for PackageManager

source§

fn clone(&self) -> PackageManager

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PackageManager

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for PackageManager

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Ord for PackageManager

source§

fn cmp(&self, other: &PackageManager) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for PackageManager

source§

fn eq(&self, other: &PackageManager) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PackageManager

source§

fn partial_cmp(&self, other: &PackageManager) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Serialize for PackageManager

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for PackageManager

source§

impl Eq for PackageManager

source§

impl StructuralEq for PackageManager

source§

impl StructuralPartialEq for PackageManager

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/fn.link_package_to_shared_dir.html b/main/volta_core/tool/package/fn.link_package_to_shared_dir.html new file mode 100644 index 000000000..20fa48226 --- /dev/null +++ b/main/volta_core/tool/package/fn.link_package_to_shared_dir.html @@ -0,0 +1,4 @@ +link_package_to_shared_dir in volta_core::tool::package - Rust
fn link_package_to_shared_dir(
+    package_name: &str,
+    manager: PackageManager
+) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/tool/package/fn.persist_install.html b/main/volta_core/tool/package/fn.persist_install.html new file mode 100644 index 000000000..58fd6a93f --- /dev/null +++ b/main/volta_core/tool/package/fn.persist_install.html @@ -0,0 +1,6 @@ +persist_install in volta_core::tool::package - Rust
fn persist_install<V>(
+    package_name: &str,
+    package_version: V,
+    staging_dir: &Path
+) -> Fallible<()>where
+    V: Display,
\ No newline at end of file diff --git a/main/volta_core/tool/package/fn.setup_staging_directory.html b/main/volta_core/tool/package/fn.setup_staging_directory.html new file mode 100644 index 000000000..841d96102 --- /dev/null +++ b/main/volta_core/tool/package/fn.setup_staging_directory.html @@ -0,0 +1,6 @@ +setup_staging_directory in volta_core::tool::package - Rust
fn setup_staging_directory(
+    manager: PackageManager,
+    needs_scope: NeedsScope
+) -> Fallible<TempDir>
Expand description

Create the temporary staging directory we will use to install and ensure expected +subdirectories exist within it

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/fn.uninstall.html b/main/volta_core/tool/package/fn.uninstall.html new file mode 100644 index 000000000..503a1be7f --- /dev/null +++ b/main/volta_core/tool/package/fn.uninstall.html @@ -0,0 +1,8 @@ +uninstall in volta_core::tool::package - Rust

Function volta_core::tool::package::uninstall

source ·
pub fn uninstall(name: &str) -> Fallible<()>
Expand description

Uninstalls the specified package.

+

This removes:

+
    +
  • The JSON configuration files for both the package and its bins
  • +
  • The shims for the package bins
  • +
  • The package directory itself
  • +
+
\ No newline at end of file diff --git a/main/volta_core/tool/package/index.html b/main/volta_core/tool/package/index.html new file mode 100644 index 000000000..6e36e5d9d --- /dev/null +++ b/main/volta_core/tool/package/index.html @@ -0,0 +1,2 @@ +volta_core::tool::package - Rust

Module volta_core::tool::package

source ·

Modules

Structs

  • Configuration information about a single installed binary from a package
  • Helper struct for direct installs through npm i -g or yarn global add
  • Helper struct for direct in-place upgrades using npm update -g or yarn global upgrade
  • The Tool implementation for installing 3rd-party global packages
  • Configuration information about an installed package
  • The relevant information we need out of a package’s package.json file

Enums

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/package/install/fn.run_global_install.html b/main/volta_core/tool/package/install/fn.run_global_install.html new file mode 100644 index 000000000..38b5eaaf6 --- /dev/null +++ b/main/volta_core/tool/package/install/fn.run_global_install.html @@ -0,0 +1,9 @@ +run_global_install in volta_core::tool::package::install - Rust
pub(super) fn run_global_install(
+    package: String,
+    staging_dir: PathBuf,
+    platform_image: &Image
+) -> Fallible<()>
Expand description

Use npm install --global to install the package

+

Sets the environment variable npm_config_prefix to redirect the install to the Volta +data directory, taking advantage of the standard global install behavior with a custom +location

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/install/index.html b/main/volta_core/tool/package/install/index.html new file mode 100644 index 000000000..6c3764c7d --- /dev/null +++ b/main/volta_core/tool/package/install/index.html @@ -0,0 +1 @@ +volta_core::tool::package::install - Rust

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/package/install/sidebar-items.js b/main/volta_core/tool/package/install/sidebar-items.js new file mode 100644 index 000000000..a07d67978 --- /dev/null +++ b/main/volta_core/tool/package/install/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["run_global_install"]}; \ No newline at end of file diff --git a/main/volta_core/tool/package/manager/enum.PackageManager.html b/main/volta_core/tool/package/manager/enum.PackageManager.html new file mode 100644 index 000000000..3da057b4a --- /dev/null +++ b/main/volta_core/tool/package/manager/enum.PackageManager.html @@ -0,0 +1,48 @@ +PackageManager in volta_core::tool::package::manager - Rust
pub enum PackageManager {
+    Npm,
+    Pnpm,
+    Yarn,
+}
Expand description

The package manager used to install a given package

+

Variants§

§

Npm

§

Pnpm

§

Yarn

Implementations§

source§

impl PackageManager

source

pub fn source_dir(self, package_root: PathBuf) -> PathBuf

Given the package_root, returns the directory where the source is stored for this +package manager. This will include the top-level node_modules, where appropriate.

+
source

pub fn source_root(self, package_root: PathBuf) -> PathBuf

Given the package_root, returns the root of the source directory. This directory will +contain the top-level node-modules

+
source

pub fn binary_dir(self, package_root: PathBuf) -> PathBuf

Given the package_root, returns the directory where binaries are stored for this package +manager.

+
source

pub fn setup_global_command(self, command: &mut Command, package_root: PathBuf)

Modify a given Command to be set up for global installs, given the package root

+
source

pub(super) fn get_installed_package( + self, + package_root: PathBuf +) -> Option<String>

Determine the name of the package that was installed into the package_root

+

If there are none or more than one package installed, then we return None

+

Trait Implementations§

source§

impl Clone for PackageManager

source§

fn clone(&self) -> PackageManager

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PackageManager

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for PackageManager

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Ord for PackageManager

source§

fn cmp(&self, other: &PackageManager) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for PackageManager

source§

fn eq(&self, other: &PackageManager) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PackageManager

source§

fn partial_cmp(&self, other: &PackageManager) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Serialize for PackageManager

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for PackageManager

source§

impl Eq for PackageManager

source§

impl StructuralEq for PackageManager

source§

impl StructuralPartialEq for PackageManager

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/manager/fn.get_npm_package_name.html b/main/volta_core/tool/package/manager/fn.get_npm_package_name.html new file mode 100644 index 000000000..587663966 --- /dev/null +++ b/main/volta_core/tool/package/manager/fn.get_npm_package_name.html @@ -0,0 +1,4 @@ +get_npm_package_name in volta_core::tool::package::manager - Rust
fn get_npm_package_name(source_dir: PathBuf) -> Option<String>
Expand description

Determine the package name for an npm global install

+

npm doesn’t hoist the packages inside of node_modules, so the only directory will be the +globally installed package.

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/manager/fn.get_pnpm_or_yarn_package_name.html b/main/volta_core/tool/package/manager/fn.get_pnpm_or_yarn_package_name.html new file mode 100644 index 000000000..9fa9ebce1 --- /dev/null +++ b/main/volta_core/tool/package/manager/fn.get_pnpm_or_yarn_package_name.html @@ -0,0 +1,3 @@ +get_pnpm_or_yarn_package_name in volta_core::tool::package::manager - Rust
fn get_pnpm_or_yarn_package_name(source_root: PathBuf) -> Option<String>
Expand description

Determine the package name for a pnpm or Yarn global install

+

pnpm/Yarn creates a package.json file with the globally installed package as a dependency

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/manager/fn.get_single_directory_name.html b/main/volta_core/tool/package/manager/fn.get_single_directory_name.html new file mode 100644 index 000000000..c100bc2a8 --- /dev/null +++ b/main/volta_core/tool/package/manager/fn.get_single_directory_name.html @@ -0,0 +1,3 @@ +get_single_directory_name in volta_core::tool::package::manager - Rust
fn get_single_directory_name(parent_dir: &Path) -> Option<String>
Expand description

Return the name of the single subdirectory (if any) to the given parent_dir

+

If there are more than one subdirectory, then this will return None

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/manager/index.html b/main/volta_core/tool/package/manager/index.html new file mode 100644 index 000000000..06fbcb07b --- /dev/null +++ b/main/volta_core/tool/package/manager/index.html @@ -0,0 +1 @@ +volta_core::tool::package::manager - Rust

Enums

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/package/manager/sidebar-items.js b/main/volta_core/tool/package/manager/sidebar-items.js new file mode 100644 index 000000000..782722a07 --- /dev/null +++ b/main/volta_core/tool/package/manager/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["PackageManager"],"fn":["get_npm_package_name","get_pnpm_or_yarn_package_name","get_single_directory_name"]}; \ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/fn.default_binary_name.html b/main/volta_core/tool/package/metadata/fn.default_binary_name.html new file mode 100644 index 000000000..7a9875365 --- /dev/null +++ b/main/volta_core/tool/package/metadata/fn.default_binary_name.html @@ -0,0 +1,5 @@ +default_binary_name in volta_core::tool::package::metadata - Rust
fn default_binary_name(package_name: &str) -> String
Expand description

Determine the default binary name from the package name

+

For non-scoped packages, this is just the package name +For scoped packages, to match the behavior of the package managers, we remove the scope and use +only the package part, e.g. @microsoft/rush would have a default name of rush

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/index.html b/main/volta_core/tool/package/metadata/index.html new file mode 100644 index 000000000..30e489749 --- /dev/null +++ b/main/volta_core/tool/package/metadata/index.html @@ -0,0 +1 @@ +volta_core::tool::package::metadata - Rust

Modules

Structs

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/serde_bins/fn.deserialize.html b/main/volta_core/tool/package/metadata/serde_bins/fn.deserialize.html new file mode 100644 index 000000000..39bd08bbe --- /dev/null +++ b/main/volta_core/tool/package/metadata/serde_bins/fn.deserialize.html @@ -0,0 +1,2 @@ +deserialize in volta_core::tool::package::metadata::serde_bins - Rust
pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>where
+    D: Deserializer<'de>,
\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/serde_bins/index.html b/main/volta_core/tool/package/metadata/serde_bins/index.html new file mode 100644 index 000000000..ab30956e5 --- /dev/null +++ b/main/volta_core/tool/package/metadata/serde_bins/index.html @@ -0,0 +1 @@ +volta_core::tool::package::metadata::serde_bins - Rust
\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/serde_bins/sidebar-items.js b/main/volta_core/tool/package/metadata/serde_bins/sidebar-items.js new file mode 100644 index 000000000..c9c9970d1 --- /dev/null +++ b/main/volta_core/tool/package/metadata/serde_bins/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["deserialize"],"struct":["BinMapVisitor"]}; \ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/serde_bins/struct.BinMapVisitor.html b/main/volta_core/tool/package/metadata/serde_bins/struct.BinMapVisitor.html new file mode 100644 index 000000000..613081dd7 --- /dev/null +++ b/main/volta_core/tool/package/metadata/serde_bins/struct.BinMapVisitor.html @@ -0,0 +1,59 @@ +BinMapVisitor in volta_core::tool::package::metadata::serde_bins - Rust
struct BinMapVisitor;

Trait Implementations§

source§

impl<'de> Visitor<'de> for BinMapVisitor

§

type Value = Vec<String>

The value produced by this visitor.
source§

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

Format a message stating what data this Visitor expects to receive. Read more
source§

fn visit_str<E>(self, _path: &str) -> Result<Self::Value, E>where + E: Error,

The input contains a string. The lifetime of the string is ephemeral and +it may be destroyed after this method returns. Read more
source§

fn visit_map<M>(self, access: M) -> Result<Self::Value, M::Error>where + M: MapAccess<'de>,

The input contains a key-value map. Read more
source§

fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>where + E: Error,

The input contains a boolean. Read more
source§

fn visit_i8<E>(self, v: i8) -> Result<Self::Value, E>where + E: Error,

The input contains an i8. Read more
source§

fn visit_i16<E>(self, v: i16) -> Result<Self::Value, E>where + E: Error,

The input contains an i16. Read more
source§

fn visit_i32<E>(self, v: i32) -> Result<Self::Value, E>where + E: Error,

The input contains an i32. Read more
source§

fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>where + E: Error,

The input contains an i64. Read more
source§

fn visit_i128<E>(self, v: i128) -> Result<Self::Value, E>where + E: Error,

The input contains a i128. Read more
source§

fn visit_u8<E>(self, v: u8) -> Result<Self::Value, E>where + E: Error,

The input contains a u8. Read more
source§

fn visit_u16<E>(self, v: u16) -> Result<Self::Value, E>where + E: Error,

The input contains a u16. Read more
source§

fn visit_u32<E>(self, v: u32) -> Result<Self::Value, E>where + E: Error,

The input contains a u32. Read more
source§

fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>where + E: Error,

The input contains a u64. Read more
source§

fn visit_u128<E>(self, v: u128) -> Result<Self::Value, E>where + E: Error,

The input contains a u128. Read more
source§

fn visit_f32<E>(self, v: f32) -> Result<Self::Value, E>where + E: Error,

The input contains an f32. Read more
source§

fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>where + E: Error,

The input contains an f64. Read more
source§

fn visit_char<E>(self, v: char) -> Result<Self::Value, E>where + E: Error,

The input contains a char. Read more
source§

fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>where + E: Error,

The input contains a string that lives at least as long as the +Deserializer. Read more
source§

fn visit_string<E>(self, v: String) -> Result<Self::Value, E>where + E: Error,

The input contains a string and ownership of the string is being given +to the Visitor. Read more
source§

fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>where + E: Error,

The input contains a byte array. The lifetime of the byte array is +ephemeral and it may be destroyed after this method returns. Read more
source§

fn visit_borrowed_bytes<E>(self, v: &'de [u8]) -> Result<Self::Value, E>where + E: Error,

The input contains a byte array that lives at least as long as the +Deserializer. Read more
source§

fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E>where + E: Error,

The input contains a byte array and ownership of the byte array is being +given to the Visitor. Read more
source§

fn visit_none<E>(self) -> Result<Self::Value, E>where + E: Error,

The input contains an optional that is absent. Read more
source§

fn visit_some<D>( + self, + deserializer: D +) -> Result<Self::Value, <D as Deserializer<'de>>::Error>where + D: Deserializer<'de>,

The input contains an optional that is present. Read more
source§

fn visit_unit<E>(self) -> Result<Self::Value, E>where + E: Error,

The input contains a unit (). Read more
source§

fn visit_newtype_struct<D>( + self, + deserializer: D +) -> Result<Self::Value, <D as Deserializer<'de>>::Error>where + D: Deserializer<'de>,

The input contains a newtype struct. Read more
source§

fn visit_seq<A>( + self, + seq: A +) -> Result<Self::Value, <A as SeqAccess<'de>>::Error>where + A: SeqAccess<'de>,

The input contains a sequence of elements. Read more
source§

fn visit_enum<A>( + self, + data: A +) -> Result<Self::Value, <A as EnumAccess<'de>>::Error>where + A: EnumAccess<'de>,

The input contains an enum. Read more

Auto Trait Implementations§

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<'de, T> Expected for Twhere + T: Visitor<'de>,

source§

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

Format an explanation of what data was being expected. Same signature as +the Display and Debug traits.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/sidebar-items.js b/main/volta_core/tool/package/metadata/sidebar-items.js new file mode 100644 index 000000000..c1f1398b9 --- /dev/null +++ b/main/volta_core/tool/package/metadata/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["default_binary_name"],"mod":["serde_bins"],"struct":["BinConfig","GlobalYarnManifest","PackageConfig","PackageManifest","RawPlatformSpec"]}; \ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/struct.BinConfig.html b/main/volta_core/tool/package/metadata/struct.BinConfig.html new file mode 100644 index 000000000..a10e68e99 --- /dev/null +++ b/main/volta_core/tool/package/metadata/struct.BinConfig.html @@ -0,0 +1,32 @@ +BinConfig in volta_core::tool::package::metadata - Rust
pub struct BinConfig {
+    pub name: String,
+    pub package: String,
+    pub version: Version,
+    pub platform: PlatformSpec,
+    pub manager: PackageManager,
+}
Expand description

Configuration information about a single installed binary from a package

+

Will be stored in <VOLTA_HOME>/tools/user/bins/.json

+

Fields§

§name: String

The binary name

+
§package: String

The package that installed the binary

+
§version: Version

The package version

+
§platform: PlatformSpec

The platform used to install this binary

+
§manager: PackageManager

The package manager used to install this binary

+

Implementations§

source§

impl BinConfig

source

pub fn from_file<P>(file: P) -> Fallible<Self>where + P: AsRef<Path>,

Parse a BinConfig instance from the given config file

+
source

pub fn from_file_if_exists<P>(file: P) -> Fallible<Option<Self>>where + P: AsRef<Path>,

source

pub fn write(self) -> Fallible<()>

Write this BinConfig to the appropriate config file

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for BinConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for BinConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/struct.GlobalYarnManifest.html b/main/volta_core/tool/package/metadata/struct.GlobalYarnManifest.html new file mode 100644 index 000000000..383c213da --- /dev/null +++ b/main/volta_core/tool/package/metadata/struct.GlobalYarnManifest.html @@ -0,0 +1,19 @@ +GlobalYarnManifest in volta_core::tool::package::metadata - Rust
pub(super) struct GlobalYarnManifest {
+    pub dependencies: HashMap<String, String>,
+}
Expand description

Struct to read the dependencies out of Yarn’s global manifest.

+

For global installs, yarn creates a package.json file in the global-folder and installs +global packages as dependencies of that pseudo-package

+

Fields§

§dependencies: HashMap<String, String>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for GlobalYarnManifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/struct.PackageConfig.html b/main/volta_core/tool/package/metadata/struct.PackageConfig.html new file mode 100644 index 000000000..d53e8ba5e --- /dev/null +++ b/main/volta_core/tool/package/metadata/struct.PackageConfig.html @@ -0,0 +1,47 @@ +PackageConfig in volta_core::tool::package::metadata - Rust
pub struct PackageConfig {
+    pub name: String,
+    pub version: Version,
+    pub platform: PlatformSpec,
+    pub bins: Vec<String>,
+    pub manager: PackageManager,
+}
Expand description

Configuration information about an installed package

+

Will be stored in <VOLTA_HOME>/tools/user/packages/<package>.json

+

Fields§

§name: String

The package name

+
§version: Version

The package version

+
§platform: PlatformSpec

The platform used to install this package

+
§bins: Vec<String>

The binaries installed by this package

+
§manager: PackageManager

The package manager that was used to install this package

+

Implementations§

source§

impl PackageConfig

source

pub fn from_file<P>(file: P) -> Fallible<Self>where + P: AsRef<Path>,

Parse a PackageConfig instance from a config file

+
source

pub fn from_file_if_exists<P>(file: P) -> Fallible<Option<Self>>where + P: AsRef<Path>,

source

pub fn write(self) -> Fallible<()>

Write this PackageConfig into the appropriate config file

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for PackageConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Ord for PackageConfig

source§

fn cmp(&self, other: &PackageConfig) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for PackageConfig

source§

fn eq(&self, other: &PackageConfig) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PackageConfig

source§

fn partial_cmp(&self, other: &PackageConfig) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Serialize for PackageConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for PackageConfig

source§

impl StructuralEq for PackageConfig

source§

impl StructuralPartialEq for PackageConfig

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/struct.PackageManifest.html b/main/volta_core/tool/package/metadata/struct.PackageManifest.html new file mode 100644 index 000000000..9eef2c694 --- /dev/null +++ b/main/volta_core/tool/package/metadata/struct.PackageManifest.html @@ -0,0 +1,25 @@ +PackageManifest in volta_core::tool::package::metadata - Rust
pub struct PackageManifest {
+    pub name: String,
+    pub version: Version,
+    pub bin: Vec<String>,
+}
Expand description

The relevant information we need out of a package’s package.json file

+

This includes the exact Version (since we can install using a range) +and the list of bins provided by the package.

+

Fields§

§name: String

The name of the package

+
§version: Version

The version of the package

+
§bin: Vec<String>

The bin section, containing a map of binary names to locations

+

Implementations§

source§

impl PackageManifest

source

pub fn for_dir(package: &str, package_root: &Path) -> Fallible<Self>

Parse the package.json for a given package directory

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for PackageManifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/metadata/struct.RawPlatformSpec.html b/main/volta_core/tool/package/metadata/struct.RawPlatformSpec.html new file mode 100644 index 000000000..ef01a352c --- /dev/null +++ b/main/volta_core/tool/package/metadata/struct.RawPlatformSpec.html @@ -0,0 +1,22 @@ +RawPlatformSpec in volta_core::tool::package::metadata - Rust
struct RawPlatformSpec {
+    node: Version,
+    npm: Option<Version>,
+    pnpm: Option<Version>,
+    yarn: Option<Version>,
+}

Fields§

§node: Version§npm: Option<Version>§pnpm: Option<Version>§yarn: Option<Version>

Implementations§

source§

impl RawPlatformSpec

source

fn serialize<__S>( + __self: &PlatformSpec, + __serializer: __S +) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

source§

impl<'de> RawPlatformSpec

source

fn deserialize<__D>(__deserializer: __D) -> Result<PlatformSpec, __D::Error>where + __D: Deserializer<'de>,

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/sidebar-items.js b/main/volta_core/tool/package/sidebar-items.js new file mode 100644 index 000000000..a42393b7d --- /dev/null +++ b/main/volta_core/tool/package/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["NeedsScope","PackageManager"],"fn":["link_package_to_shared_dir","persist_install","setup_staging_directory","uninstall"],"mod":["configure","install","manager","metadata","uninstall"],"struct":["BinConfig","DirectInstall","InPlaceUpgrade","Package","PackageConfig","PackageManifest"]}; \ No newline at end of file diff --git a/main/volta_core/tool/package/struct.BinConfig.html b/main/volta_core/tool/package/struct.BinConfig.html new file mode 100644 index 000000000..dde6e5d93 --- /dev/null +++ b/main/volta_core/tool/package/struct.BinConfig.html @@ -0,0 +1,32 @@ +BinConfig in volta_core::tool::package - Rust
pub struct BinConfig {
+    pub name: String,
+    pub package: String,
+    pub version: Version,
+    pub platform: PlatformSpec,
+    pub manager: PackageManager,
+}
Expand description

Configuration information about a single installed binary from a package

+

Will be stored in <VOLTA_HOME>/tools/user/bins/.json

+

Fields§

§name: String

The binary name

+
§package: String

The package that installed the binary

+
§version: Version

The package version

+
§platform: PlatformSpec

The platform used to install this binary

+
§manager: PackageManager

The package manager used to install this binary

+

Implementations§

source§

impl BinConfig

source

pub fn from_file<P>(file: P) -> Fallible<Self>where + P: AsRef<Path>,

Parse a BinConfig instance from the given config file

+
source

pub fn from_file_if_exists<P>(file: P) -> Fallible<Option<Self>>where + P: AsRef<Path>,

source

pub fn write(self) -> Fallible<()>

Write this BinConfig to the appropriate config file

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for BinConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for BinConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/struct.DirectInstall.html b/main/volta_core/tool/package/struct.DirectInstall.html new file mode 100644 index 000000000..bfa2a2ddf --- /dev/null +++ b/main/volta_core/tool/package/struct.DirectInstall.html @@ -0,0 +1,21 @@ +DirectInstall in volta_core::tool::package - Rust
pub struct DirectInstall {
+    staging: TempDir,
+    manager: PackageManager,
+    name: Option<String>,
+}
Expand description

Helper struct for direct installs through npm i -g or yarn global add

+

Provides methods to simplify installing into a staging directory and then moving that install +into the proper location after it is complete.

+

Note: We don’t always know the name of the package up-front, as the install could be from a +tarball or a git coordinate. If we do know ahead of time, then we can skip looking it up

+

Fields§

§staging: TempDir§manager: PackageManager§name: Option<String>

Implementations§

source§

impl DirectInstall

source

pub fn new(manager: PackageManager) -> Fallible<Self>

source

pub fn with_name(manager: PackageManager, name: String) -> Fallible<Self>

source

pub fn setup_command(&self, command: &mut Command)

source

pub fn complete_install(self, image: &Image) -> Fallible<()>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/struct.InPlaceUpgrade.html b/main/volta_core/tool/package/struct.InPlaceUpgrade.html new file mode 100644 index 000000000..1efcdb258 --- /dev/null +++ b/main/volta_core/tool/package/struct.InPlaceUpgrade.html @@ -0,0 +1,21 @@ +InPlaceUpgrade in volta_core::tool::package - Rust
pub struct InPlaceUpgrade {
+    package: String,
+    directory: PathBuf,
+    manager: PackageManager,
+}
Expand description

Helper struct for direct in-place upgrades using npm update -g or yarn global upgrade

+

Upgrades the requested package directly in the image directory

+

Fields§

§package: String§directory: PathBuf§manager: PackageManager

Implementations§

source§

impl InPlaceUpgrade

source

pub fn new(package: String, manager: PackageManager) -> Fallible<Self>

source

pub fn check_upgraded_package(&self) -> Fallible<()>

Check for possible failure cases with the package to be upgraded +- The package is not installed as a global +- The package exists, but was installed with a different package manager

+
source

pub fn setup_command(&self, command: &mut Command)

source

pub fn complete_upgrade(self, image: &Image) -> Fallible<()>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/struct.Package.html b/main/volta_core/tool/package/struct.Package.html new file mode 100644 index 000000000..0d65312bb --- /dev/null +++ b/main/volta_core/tool/package/struct.Package.html @@ -0,0 +1,18 @@ +Package in volta_core::tool::package - Rust
pub struct Package {
+    name: String,
+    version: VersionSpec,
+    staging: TempDir,
+}
Expand description

The Tool implementation for installing 3rd-party global packages

+

Fields§

§name: String§version: VersionSpec§staging: TempDir

Implementations§

source§

impl Package

source

pub fn new(name: String, version: VersionSpec) -> Fallible<Self>

source

pub fn run_install(&self, platform_image: &Image) -> Fallible<()>

source

pub fn complete_install(self, image: &Image) -> Fallible<PackageManifest>

Trait Implementations§

source§

impl Display for Package

source§

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

Formats the value using the given formatter. Read more
source§

impl Tool for Package

source§

fn fetch(self: Box<Self>, _session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory
source§

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine
source§

fn pin(self: Box<Self>, _session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/package/struct.PackageConfig.html b/main/volta_core/tool/package/struct.PackageConfig.html new file mode 100644 index 000000000..388bc38fa --- /dev/null +++ b/main/volta_core/tool/package/struct.PackageConfig.html @@ -0,0 +1,47 @@ +PackageConfig in volta_core::tool::package - Rust
pub struct PackageConfig {
+    pub name: String,
+    pub version: Version,
+    pub platform: PlatformSpec,
+    pub bins: Vec<String>,
+    pub manager: PackageManager,
+}
Expand description

Configuration information about an installed package

+

Will be stored in <VOLTA_HOME>/tools/user/packages/<package>.json

+

Fields§

§name: String

The package name

+
§version: Version

The package version

+
§platform: PlatformSpec

The platform used to install this package

+
§bins: Vec<String>

The binaries installed by this package

+
§manager: PackageManager

The package manager that was used to install this package

+

Implementations§

source§

impl PackageConfig

source

pub fn from_file<P>(file: P) -> Fallible<Self>where + P: AsRef<Path>,

Parse a PackageConfig instance from a config file

+
source

pub fn from_file_if_exists<P>(file: P) -> Fallible<Option<Self>>where + P: AsRef<Path>,

source

pub fn write(self) -> Fallible<()>

Write this PackageConfig into the appropriate config file

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for PackageConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Ord for PackageConfig

source§

fn cmp(&self, other: &PackageConfig) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere + Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere + Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for PackageConfig

source§

fn eq(&self, other: &PackageConfig) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PackageConfig

source§

fn partial_cmp(&self, other: &PackageConfig) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= +operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= +operator. Read more
source§

impl Serialize for PackageConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for PackageConfig

source§

impl StructuralEq for PackageConfig

source§

impl StructuralPartialEq for PackageConfig

Auto Trait Implementations§

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
§

impl<Q, K> Comparable<K> for Qwhere + Q: Ord + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/struct.PackageManifest.html b/main/volta_core/tool/package/struct.PackageManifest.html new file mode 100644 index 000000000..f3a41ca14 --- /dev/null +++ b/main/volta_core/tool/package/struct.PackageManifest.html @@ -0,0 +1,25 @@ +PackageManifest in volta_core::tool::package - Rust
pub struct PackageManifest {
+    pub name: String,
+    pub version: Version,
+    pub bin: Vec<String>,
+}
Expand description

The relevant information we need out of a package’s package.json file

+

This includes the exact Version (since we can install using a range) +and the list of bins provided by the package.

+

Fields§

§name: String

The name of the package

+
§version: Version

The version of the package

+
§bin: Vec<String>

The bin section, containing a map of binary names to locations

+

Implementations§

source§

impl PackageManifest

source

pub fn for_dir(package: &str, package_root: &Path) -> Fallible<Self>

Parse the package.json for a given package directory

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for PackageManifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/package/uninstall/fn.binaries_from_package.html b/main/volta_core/tool/package/uninstall/fn.binaries_from_package.html new file mode 100644 index 000000000..f14292212 --- /dev/null +++ b/main/volta_core/tool/package/uninstall/fn.binaries_from_package.html @@ -0,0 +1,3 @@ +binaries_from_package in volta_core::tool::package::uninstall - Rust
fn binaries_from_package(package: &str) -> Fallible<Vec<String>>
Expand description

Reads the contents of a directory and returns a Vec containing the names of +all the binaries installed by the given package.

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/uninstall/fn.remove_config_and_shim.html b/main/volta_core/tool/package/uninstall/fn.remove_config_and_shim.html new file mode 100644 index 000000000..e7fda4572 --- /dev/null +++ b/main/volta_core/tool/package/uninstall/fn.remove_config_and_shim.html @@ -0,0 +1,2 @@ +remove_config_and_shim in volta_core::tool::package::uninstall - Rust
fn remove_config_and_shim(bin_name: &str, pkg_name: &str) -> Fallible<()>
Expand description

Remove a shim and its associated configuration file

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/uninstall/fn.remove_shared_link_dir.html b/main/volta_core/tool/package/uninstall/fn.remove_shared_link_dir.html new file mode 100644 index 000000000..e1bfd53a5 --- /dev/null +++ b/main/volta_core/tool/package/uninstall/fn.remove_shared_link_dir.html @@ -0,0 +1,3 @@ +remove_shared_link_dir in volta_core::tool::package::uninstall - Rust
fn remove_shared_link_dir(name: &str) -> Fallible<()>
Expand description

Remove the link to the package in the shared lib directory

+

For scoped packages, if the scope directory is now empty, it will also be removed

+
\ No newline at end of file diff --git a/main/volta_core/tool/package/uninstall/fn.uninstall.html b/main/volta_core/tool/package/uninstall/fn.uninstall.html new file mode 100644 index 000000000..43f34b3b6 --- /dev/null +++ b/main/volta_core/tool/package/uninstall/fn.uninstall.html @@ -0,0 +1,8 @@ +uninstall in volta_core::tool::package::uninstall - Rust
pub fn uninstall(name: &str) -> Fallible<()>
Expand description

Uninstalls the specified package.

+

This removes:

+
    +
  • The JSON configuration files for both the package and its bins
  • +
  • The shims for the package bins
  • +
  • The package directory itself
  • +
+
\ No newline at end of file diff --git a/main/volta_core/tool/package/uninstall/index.html b/main/volta_core/tool/package/uninstall/index.html new file mode 100644 index 000000000..50848cfec --- /dev/null +++ b/main/volta_core/tool/package/uninstall/index.html @@ -0,0 +1,2 @@ +volta_core::tool::package::uninstall - Rust

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/package/uninstall/sidebar-items.js b/main/volta_core/tool/package/uninstall/sidebar-items.js new file mode 100644 index 000000000..dbe6d8f74 --- /dev/null +++ b/main/volta_core/tool/package/uninstall/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["binaries_from_package","remove_config_and_shim","remove_shared_link_dir","uninstall"]}; \ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/fn.determine_remote_url.html b/main/volta_core/tool/pnpm/fetch/fn.determine_remote_url.html new file mode 100644 index 000000000..9993e881e --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/fn.determine_remote_url.html @@ -0,0 +1,5 @@ +determine_remote_url in volta_core::tool::pnpm::fetch - Rust
fn determine_remote_url(
+    version: &Version,
+    hooks: Option<&ToolHooks<Pnpm>>
+) -> Fallible<String>
Expand description

Determine the remote URL to download from, using the hooks if avaialble

+
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/fn.fetch.html b/main/volta_core/tool/pnpm/fetch/fn.fetch.html new file mode 100644 index 000000000..850a63d26 --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/fn.fetch.html @@ -0,0 +1 @@ +fetch in volta_core::tool::pnpm::fetch - Rust

Function volta_core::tool::pnpm::fetch::fetch

source ·
pub fn fetch(version: &Version, hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/fn.fetch_remote_distro.html b/main/volta_core/tool/pnpm/fetch/fn.fetch_remote_distro.html new file mode 100644 index 000000000..36cd41adf --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/fn.fetch_remote_distro.html @@ -0,0 +1,6 @@ +fetch_remote_distro in volta_core::tool::pnpm::fetch - Rust
fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path
+) -> Fallible<Box<dyn Archive>>
Expand description

Fetch the distro archive from the internet

+
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/fn.load_cached_distro.html b/main/volta_core/tool/pnpm/fetch/fn.load_cached_distro.html new file mode 100644 index 000000000..15d302f29 --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/fn.load_cached_distro.html @@ -0,0 +1,3 @@ +load_cached_distro in volta_core::tool::pnpm::fetch - Rust
fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>>
Expand description

Return the archive if it is valid. It may have been corrupted or interrupted in the middle of +downloading.

+
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/fn.unpack_archive.html b/main/volta_core/tool/pnpm/fetch/fn.unpack_archive.html new file mode 100644 index 000000000..55b1567df --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/fn.unpack_archive.html @@ -0,0 +1,2 @@ +unpack_archive in volta_core::tool::pnpm::fetch - Rust
fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<()>
Expand description

Unpack the pnpm archive into the image directory so that it is ready for use

+
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/fn.write_launcher.html b/main/volta_core/tool/pnpm/fetch/fn.write_launcher.html new file mode 100644 index 000000000..eba52ef2a --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/fn.write_launcher.html @@ -0,0 +1,2 @@ +write_launcher in volta_core::tool::pnpm::fetch - Rust
fn write_launcher(base_path: &Path, tool: &str) -> Fallible<()>
Expand description

Create executable launchers for the pnpm and pnpx binaries

+
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/index.html b/main/volta_core/tool/pnpm/fetch/index.html new file mode 100644 index 000000000..767fda4dc --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/index.html @@ -0,0 +1,3 @@ +volta_core::tool::pnpm::fetch - Rust

Module volta_core::tool::pnpm::fetch

source ·
Expand description

Provides fetcher for pnpm distributions

+

Functions

  • Determine the remote URL to download from, using the hooks if avaialble
  • Fetch the distro archive from the internet
  • Return the archive if it is valid. It may have been corrupted or interrupted in the middle of +downloading.
  • Unpack the pnpm archive into the image directory so that it is ready for use
  • Create executable launchers for the pnpm and pnpx binaries
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fetch/sidebar-items.js b/main/volta_core/tool/pnpm/fetch/sidebar-items.js new file mode 100644 index 000000000..47d7ed039 --- /dev/null +++ b/main/volta_core/tool/pnpm/fetch/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["determine_remote_url","fetch","fetch_remote_distro","load_cached_distro","unpack_archive","write_launcher"]}; \ No newline at end of file diff --git a/main/volta_core/tool/pnpm/fn.resolve.html b/main/volta_core/tool/pnpm/fn.resolve.html new file mode 100644 index 000000000..71efe0e53 --- /dev/null +++ b/main/volta_core/tool/pnpm/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::pnpm - Rust

Function volta_core::tool::pnpm::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/index.html b/main/volta_core/tool/pnpm/index.html new file mode 100644 index 000000000..a61101ad1 --- /dev/null +++ b/main/volta_core/tool/pnpm/index.html @@ -0,0 +1 @@ +volta_core::tool::pnpm - Rust

Module volta_core::tool::pnpm

source ·

Modules

  • fetch 🔒
    Provides fetcher for pnpm distributions
  • resolve 🔒

Structs

  • The Tool implementation for fetching and installing pnpm

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/resolve/fn.fetch_pnpm_index.html b/main/volta_core/tool/pnpm/resolve/fn.fetch_pnpm_index.html new file mode 100644 index 000000000..17deef0d4 --- /dev/null +++ b/main/volta_core/tool/pnpm/resolve/fn.fetch_pnpm_index.html @@ -0,0 +1,4 @@ +fetch_pnpm_index in volta_core::tool::pnpm::resolve - Rust
fn fetch_pnpm_index(
+    hooks: Option<&ToolHooks<Pnpm>>
+) -> Fallible<(String, PackageIndex)>
Expand description

Fetch the index of available pnpm versions from the npm registry

+
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/resolve/fn.resolve.html b/main/volta_core/tool/pnpm/resolve/fn.resolve.html new file mode 100644 index 000000000..a43524516 --- /dev/null +++ b/main/volta_core/tool/pnpm/resolve/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::pnpm::resolve - Rust

Function volta_core::tool::pnpm::resolve::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/resolve/fn.resolve_semver.html b/main/volta_core/tool/pnpm/resolve/fn.resolve_semver.html new file mode 100644 index 000000000..b1bd26230 --- /dev/null +++ b/main/volta_core/tool/pnpm/resolve/fn.resolve_semver.html @@ -0,0 +1,4 @@ +resolve_semver in volta_core::tool::pnpm::resolve - Rust
fn resolve_semver(
+    matching: Range,
+    hooks: Option<&ToolHooks<Pnpm>>
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/resolve/fn.resolve_tag.html b/main/volta_core/tool/pnpm/resolve/fn.resolve_tag.html new file mode 100644 index 000000000..26fb83585 --- /dev/null +++ b/main/volta_core/tool/pnpm/resolve/fn.resolve_tag.html @@ -0,0 +1 @@ +resolve_tag in volta_core::tool::pnpm::resolve - Rust
fn resolve_tag(tag: &str, hooks: Option<&ToolHooks<Pnpm>>) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/resolve/index.html b/main/volta_core/tool/pnpm/resolve/index.html new file mode 100644 index 000000000..259c9d2d6 --- /dev/null +++ b/main/volta_core/tool/pnpm/resolve/index.html @@ -0,0 +1 @@ +volta_core::tool::pnpm::resolve - Rust

Module volta_core::tool::pnpm::resolve

source ·

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/pnpm/resolve/sidebar-items.js b/main/volta_core/tool/pnpm/resolve/sidebar-items.js new file mode 100644 index 000000000..1c2ccd0db --- /dev/null +++ b/main/volta_core/tool/pnpm/resolve/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["fetch_pnpm_index","resolve","resolve_semver","resolve_tag"]}; \ No newline at end of file diff --git a/main/volta_core/tool/pnpm/sidebar-items.js b/main/volta_core/tool/pnpm/sidebar-items.js new file mode 100644 index 000000000..6cbd71d52 --- /dev/null +++ b/main/volta_core/tool/pnpm/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["resolve"],"mod":["fetch","resolve"],"struct":["Pnpm"]}; \ No newline at end of file diff --git a/main/volta_core/tool/pnpm/struct.Pnpm.html b/main/volta_core/tool/pnpm/struct.Pnpm.html new file mode 100644 index 000000000..e0f4dbfa9 --- /dev/null +++ b/main/volta_core/tool/pnpm/struct.Pnpm.html @@ -0,0 +1,16 @@ +Pnpm in volta_core::tool::pnpm - Rust

Struct volta_core::tool::pnpm::Pnpm

source ·
pub struct Pnpm {
+    pub(super) version: Version,
+}
Expand description

The Tool implementation for fetching and installing pnpm

+

Fields§

§version: Version

Implementations§

source§

impl Pnpm

source

pub fn new(version: Version) -> Self

source

pub fn archive_basename(version: &str) -> String

source

pub fn archive_filename(version: &str) -> String

source

pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<()>

Trait Implementations§

source§

impl Display for Pnpm

source§

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

Formats the value using the given formatter. Read more
source§

impl Tool for Pnpm

source§

fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory
source§

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine
source§

fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

Auto Trait Implementations§

§

impl RefUnwindSafe for Pnpm

§

impl Send for Pnpm

§

impl Sync for Pnpm

§

impl Unpin for Pnpm

§

impl UnwindSafe for Pnpm

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/registry/constant.NPM_ABBREVIATED_ACCEPT_HEADER.html b/main/volta_core/tool/registry/constant.NPM_ABBREVIATED_ACCEPT_HEADER.html new file mode 100644 index 000000000..e94a6975f --- /dev/null +++ b/main/volta_core/tool/registry/constant.NPM_ABBREVIATED_ACCEPT_HEADER.html @@ -0,0 +1 @@ +NPM_ABBREVIATED_ACCEPT_HEADER in volta_core::tool::registry - Rust
pub const NPM_ABBREVIATED_ACCEPT_HEADER: &str = "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*";
\ No newline at end of file diff --git a/main/volta_core/tool/registry/fn.fetch_npm_registry.html b/main/volta_core/tool/registry/fn.fetch_npm_registry.html new file mode 100644 index 000000000..76a7189db --- /dev/null +++ b/main/volta_core/tool/registry/fn.fetch_npm_registry.html @@ -0,0 +1,4 @@ +fetch_npm_registry in volta_core::tool::registry - Rust
pub fn fetch_npm_registry(
+    url: String,
+    name: &str
+) -> Fallible<(String, PackageIndex)>
\ No newline at end of file diff --git a/main/volta_core/tool/registry/fn.find_unpack_dir.html b/main/volta_core/tool/registry/fn.find_unpack_dir.html new file mode 100644 index 000000000..e2d083215 --- /dev/null +++ b/main/volta_core/tool/registry/fn.find_unpack_dir.html @@ -0,0 +1,3 @@ +find_unpack_dir in volta_core::tool::registry - Rust
pub fn find_unpack_dir(in_dir: &Path) -> Fallible<PathBuf>
Expand description

Figure out the unpacked package directory name dynamically

+

Packages typically extract to a “package” directory, but not always

+
\ No newline at end of file diff --git a/main/volta_core/tool/registry/fn.public_registry_index.html b/main/volta_core/tool/registry/fn.public_registry_index.html new file mode 100644 index 000000000..5b3c3d9cd --- /dev/null +++ b/main/volta_core/tool/registry/fn.public_registry_index.html @@ -0,0 +1 @@ +public_registry_index in volta_core::tool::registry - Rust
pub fn public_registry_index(package: &str) -> String
\ No newline at end of file diff --git a/main/volta_core/tool/registry/fn.public_registry_package.html b/main/volta_core/tool/registry/fn.public_registry_package.html new file mode 100644 index 000000000..c39df8889 --- /dev/null +++ b/main/volta_core/tool/registry/fn.public_registry_package.html @@ -0,0 +1 @@ +public_registry_package in volta_core::tool::registry - Rust
pub fn public_registry_package(package: &str, version: &str) -> String
\ No newline at end of file diff --git a/main/volta_core/tool/registry/fn.scoped_public_registry_package.html b/main/volta_core/tool/registry/fn.scoped_public_registry_package.html new file mode 100644 index 000000000..0f0eecc84 --- /dev/null +++ b/main/volta_core/tool/registry/fn.scoped_public_registry_package.html @@ -0,0 +1,5 @@ +scoped_public_registry_package in volta_core::tool::registry - Rust
pub fn scoped_public_registry_package(
+    scope: &str,
+    package: &str,
+    version: &str
+) -> String
\ No newline at end of file diff --git a/main/volta_core/tool/registry/index.html b/main/volta_core/tool/registry/index.html new file mode 100644 index 000000000..d0c121093 --- /dev/null +++ b/main/volta_core/tool/registry/index.html @@ -0,0 +1 @@ +volta_core::tool::registry - Rust

Module volta_core::tool::registry

source ·

Structs

Constants

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/registry/sidebar-items.js b/main/volta_core/tool/registry/sidebar-items.js new file mode 100644 index 000000000..50d03b74f --- /dev/null +++ b/main/volta_core/tool/registry/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["NPM_ABBREVIATED_ACCEPT_HEADER"],"fn":["fetch_npm_registry","find_unpack_dir","public_registry_index","public_registry_package","scoped_public_registry_package"],"struct":["PackageDetails","PackageIndex","RawDistInfo","RawPackageMetadata","RawPackageVersionInfo"]}; \ No newline at end of file diff --git a/main/volta_core/tool/registry/struct.PackageDetails.html b/main/volta_core/tool/registry/struct.PackageDetails.html new file mode 100644 index 000000000..56efb0a05 --- /dev/null +++ b/main/volta_core/tool/registry/struct.PackageDetails.html @@ -0,0 +1,15 @@ +PackageDetails in volta_core::tool::registry - Rust
pub struct PackageDetails {
+    pub(crate) version: Version,
+}
Expand description

Details about a package in the npm Registry

+

Fields§

§version: Version

Trait Implementations§

source§

impl Debug for PackageDetails

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/registry/struct.PackageIndex.html b/main/volta_core/tool/registry/struct.PackageIndex.html new file mode 100644 index 000000000..3f9e1d336 --- /dev/null +++ b/main/volta_core/tool/registry/struct.PackageIndex.html @@ -0,0 +1,16 @@ +PackageIndex in volta_core::tool::registry - Rust
pub struct PackageIndex {
+    pub tags: HashMap<String, Version>,
+    pub entries: Vec<PackageDetails>,
+}
Expand description

Index of versions of a specific package from the npm Registry

+

Fields§

§tags: HashMap<String, Version>§entries: Vec<PackageDetails>

Trait Implementations§

source§

impl From<RawPackageMetadata> for PackageIndex

source§

fn from(serial: RawPackageMetadata) -> PackageIndex

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/registry/struct.RawDistInfo.html b/main/volta_core/tool/registry/struct.RawDistInfo.html new file mode 100644 index 000000000..93e68d598 --- /dev/null +++ b/main/volta_core/tool/registry/struct.RawDistInfo.html @@ -0,0 +1,18 @@ +RawDistInfo in volta_core::tool::registry - Rust
pub struct RawDistInfo {
+    pub shasum: String,
+    pub tarball: String,
+}

Fields§

§shasum: String§tarball: String

Trait Implementations§

source§

impl Clone for RawDistInfo

source§

fn clone(&self) -> RawDistInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RawDistInfo

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for RawDistInfo

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere + T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/registry/struct.RawPackageMetadata.html b/main/volta_core/tool/registry/struct.RawPackageMetadata.html new file mode 100644 index 000000000..166ce160d --- /dev/null +++ b/main/volta_core/tool/registry/struct.RawPackageMetadata.html @@ -0,0 +1,21 @@ +RawPackageMetadata in volta_core::tool::registry - Rust
pub struct RawPackageMetadata {
+    pub name: String,
+    pub versions: HashMap<String, RawPackageVersionInfo>,
+    pub dist_tags: HashMap<String, Version>,
+}
Expand description

Package Metadata Response

+

See npm registry API doc: +https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md

+

Fields§

§name: String§versions: HashMap<String, RawPackageVersionInfo>§dist_tags: HashMap<String, Version>

Trait Implementations§

source§

impl Debug for RawPackageMetadata

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for RawPackageMetadata

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<RawPackageMetadata> for PackageIndex

source§

fn from(serial: RawPackageMetadata) -> PackageIndex

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/registry/struct.RawPackageVersionInfo.html b/main/volta_core/tool/registry/struct.RawPackageVersionInfo.html new file mode 100644 index 000000000..eae146751 --- /dev/null +++ b/main/volta_core/tool/registry/struct.RawPackageVersionInfo.html @@ -0,0 +1,17 @@ +RawPackageVersionInfo in volta_core::tool::registry - Rust
pub struct RawPackageVersionInfo {
+    pub version: Version,
+    pub dist: RawDistInfo,
+}

Fields§

§version: Version§dist: RawDistInfo

Trait Implementations§

source§

impl Debug for RawPackageVersionInfo

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for RawPackageVersionInfo

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/serial/fn.is_version_like.html b/main/volta_core/tool/serial/fn.is_version_like.html new file mode 100644 index 000000000..d6df517c7 --- /dev/null +++ b/main/volta_core/tool/serial/fn.is_version_like.html @@ -0,0 +1,3 @@ +is_version_like in volta_core::tool::serial - Rust
fn is_version_like(value: &str) -> bool
Expand description

Determine if a given string is “version-like”.

+

This means it is either ‘latest’, ‘lts’, a Version, or a Version Range.

+
\ No newline at end of file diff --git a/main/volta_core/tool/serial/index.html b/main/volta_core/tool/serial/index.html new file mode 100644 index 000000000..2c8f2f5af --- /dev/null +++ b/main/volta_core/tool/serial/index.html @@ -0,0 +1 @@ +volta_core::tool::serial - Rust

Module volta_core::tool::serial

source ·

Statics

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/serial/sidebar-items.js b/main/volta_core/tool/serial/sidebar-items.js new file mode 100644 index 000000000..44e8f74ae --- /dev/null +++ b/main/volta_core/tool/serial/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["is_version_like"],"static":["HAS_VERSION","TOOL_SPEC_PATTERN"]}; \ No newline at end of file diff --git a/main/volta_core/tool/serial/static.HAS_VERSION.html b/main/volta_core/tool/serial/static.HAS_VERSION.html new file mode 100644 index 000000000..44090031d --- /dev/null +++ b/main/volta_core/tool/serial/static.HAS_VERSION.html @@ -0,0 +1 @@ +HAS_VERSION in volta_core::tool::serial - Rust
static HAS_VERSION: Lazy<Regex>
\ No newline at end of file diff --git a/main/volta_core/tool/serial/static.TOOL_SPEC_PATTERN.html b/main/volta_core/tool/serial/static.TOOL_SPEC_PATTERN.html new file mode 100644 index 000000000..1631cef08 --- /dev/null +++ b/main/volta_core/tool/serial/static.TOOL_SPEC_PATTERN.html @@ -0,0 +1 @@ +TOOL_SPEC_PATTERN in volta_core::tool::serial - Rust
static TOOL_SPEC_PATTERN: Lazy<Regex>
\ No newline at end of file diff --git a/main/volta_core/tool/sidebar-items.js b/main/volta_core/tool/sidebar-items.js new file mode 100644 index 000000000..9e8616e31 --- /dev/null +++ b/main/volta_core/tool/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["PATH_VAR_NAME"],"enum":["FetchStatus","Spec"],"fn":["check_fetched","check_shim_reachable","debug_already_fetched","download_tool_error","find_expected_shim_dir","info_fetched","info_installed","info_pinned","info_project_version","registry_fetch_error"],"mod":["node","npm","package","pnpm","registry","serial","yarn"],"struct":["PackageDetails"],"trait":["Tool"]}; \ No newline at end of file diff --git a/main/volta_core/tool/struct.PackageDetails.html b/main/volta_core/tool/struct.PackageDetails.html new file mode 100644 index 000000000..b01c2802f --- /dev/null +++ b/main/volta_core/tool/struct.PackageDetails.html @@ -0,0 +1,15 @@ +PackageDetails in volta_core::tool - Rust
pub struct PackageDetails {
+    pub(crate) version: Version,
+}
Expand description

Details about a package in the npm Registry

+

Fields§

§version: Version

Trait Implementations§

source§

impl Debug for PackageDetails

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/trait.Tool.html b/main/volta_core/tool/trait.Tool.html new file mode 100644 index 000000000..b19169ddd --- /dev/null +++ b/main/volta_core/tool/trait.Tool.html @@ -0,0 +1,10 @@ +Tool in volta_core::tool - Rust

Trait volta_core::tool::Tool

source ·
pub trait Tool: Display {
+    // Required methods
+    fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>;
+    fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>;
+    fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>;
+}
Expand description

Trait representing all of the actions that can be taken with a tool

+

Required Methods§

source

fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory

+
source

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine

+
source

fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

+

Implementors§

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/fn.determine_remote_url.html b/main/volta_core/tool/yarn/fetch/fn.determine_remote_url.html new file mode 100644 index 000000000..db3229bd0 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/fn.determine_remote_url.html @@ -0,0 +1,5 @@ +determine_remote_url in volta_core::tool::yarn::fetch - Rust
fn determine_remote_url(
+    version: &Version,
+    hooks: Option<&YarnHooks>
+) -> Fallible<String>
Expand description

Determine the remote URL to download from, using the hooks if available

+
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/fn.ensure_bin_is_executable.html b/main/volta_core/tool/yarn/fetch/fn.ensure_bin_is_executable.html new file mode 100644 index 000000000..db6dd4187 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/fn.ensure_bin_is_executable.html @@ -0,0 +1 @@ +ensure_bin_is_executable in volta_core::tool::yarn::fetch - Rust
fn ensure_bin_is_executable(unpack_dir: &Path, tool: &str) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/fn.fetch.html b/main/volta_core/tool/yarn/fetch/fn.fetch.html new file mode 100644 index 000000000..0ce5a7fd3 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/fn.fetch.html @@ -0,0 +1 @@ +fetch in volta_core::tool::yarn::fetch - Rust

Function volta_core::tool::yarn::fetch::fetch

source ·
pub fn fetch(version: &Version, hooks: Option<&YarnHooks>) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/fn.fetch_remote_distro.html b/main/volta_core/tool/yarn/fetch/fn.fetch_remote_distro.html new file mode 100644 index 000000000..446bc74f0 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/fn.fetch_remote_distro.html @@ -0,0 +1,6 @@ +fetch_remote_distro in volta_core::tool::yarn::fetch - Rust
fn fetch_remote_distro(
+    version: &Version,
+    url: &str,
+    staging_path: &Path
+) -> Fallible<Box<dyn Archive>>
Expand description

Fetch the distro archive from the internet

+
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/fn.load_cached_distro.html b/main/volta_core/tool/yarn/fetch/fn.load_cached_distro.html new file mode 100644 index 000000000..b0c251064 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/fn.load_cached_distro.html @@ -0,0 +1,3 @@ +load_cached_distro in volta_core::tool::yarn::fetch - Rust
fn load_cached_distro(file: &Path) -> Option<Box<dyn Archive>>
Expand description

Return the archive if it is valid. It may have been corrupted or interrupted in the middle of +downloading.

+
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/fn.unpack_archive.html b/main/volta_core/tool/yarn/fetch/fn.unpack_archive.html new file mode 100644 index 000000000..9e47ec691 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/fn.unpack_archive.html @@ -0,0 +1,2 @@ +unpack_archive in volta_core::tool::yarn::fetch - Rust
fn unpack_archive(archive: Box<dyn Archive>, version: &Version) -> Fallible<()>
Expand description

Unpack the yarn archive into the image directory so that it is ready for use

+
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/index.html b/main/volta_core/tool/yarn/fetch/index.html new file mode 100644 index 000000000..f19ba2ad4 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/index.html @@ -0,0 +1,3 @@ +volta_core::tool::yarn::fetch - Rust

Module volta_core::tool::yarn::fetch

source ·
Expand description

Provides fetcher for Yarn distributions

+

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/fetch/sidebar-items.js b/main/volta_core/tool/yarn/fetch/sidebar-items.js new file mode 100644 index 000000000..f552aa152 --- /dev/null +++ b/main/volta_core/tool/yarn/fetch/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["determine_remote_url","ensure_bin_is_executable","fetch","fetch_remote_distro","load_cached_distro","unpack_archive"]}; \ No newline at end of file diff --git a/main/volta_core/tool/yarn/fn.resolve.html b/main/volta_core/tool/yarn/fn.resolve.html new file mode 100644 index 000000000..7db41ef77 --- /dev/null +++ b/main/volta_core/tool/yarn/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::yarn - Rust

Function volta_core::tool::yarn::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/index.html b/main/volta_core/tool/yarn/index.html new file mode 100644 index 000000000..0b5d572f2 --- /dev/null +++ b/main/volta_core/tool/yarn/index.html @@ -0,0 +1 @@ +volta_core::tool::yarn - Rust

Module volta_core::tool::yarn

source ·

Modules

  • fetch 🔒
    Provides fetcher for Yarn distributions
  • metadata 🔒
  • resolve 🔒
    Provides resolution of Yarn requirements into specific versions

Structs

  • The Tool implementation for fetching and installing Yarn

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/metadata/index.html b/main/volta_core/tool/yarn/metadata/index.html new file mode 100644 index 000000000..9cb142cbd --- /dev/null +++ b/main/volta_core/tool/yarn/metadata/index.html @@ -0,0 +1 @@ +volta_core::tool::yarn::metadata - Rust
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/metadata/sidebar-items.js b/main/volta_core/tool/yarn/metadata/sidebar-items.js new file mode 100644 index 000000000..79ea01ef8 --- /dev/null +++ b/main/volta_core/tool/yarn/metadata/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["RawYarnAsset","RawYarnEntry","RawYarnIndex","YarnIndex"]}; \ No newline at end of file diff --git a/main/volta_core/tool/yarn/metadata/struct.RawYarnAsset.html b/main/volta_core/tool/yarn/metadata/struct.RawYarnAsset.html new file mode 100644 index 000000000..c7407d224 --- /dev/null +++ b/main/volta_core/tool/yarn/metadata/struct.RawYarnAsset.html @@ -0,0 +1,17 @@ +RawYarnAsset in volta_core::tool::yarn::metadata - Rust
pub struct RawYarnAsset {
+    pub name: String,
+}

Fields§

§name: String

The filename of an asset included in a Yarn GitHub release.

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawYarnAsset

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/metadata/struct.RawYarnEntry.html b/main/volta_core/tool/yarn/metadata/struct.RawYarnEntry.html new file mode 100644 index 000000000..cfc3bf59f --- /dev/null +++ b/main/volta_core/tool/yarn/metadata/struct.RawYarnEntry.html @@ -0,0 +1,24 @@ +RawYarnEntry in volta_core::tool::yarn::metadata - Rust
pub struct RawYarnEntry {
+    pub tag_name: Version,
+    pub assets: Vec<RawYarnAsset>,
+}

Fields§

§tag_name: Version

Yarn releases are given a tag name of the form “v$version” where $version +is the release’s version string.

+
§assets: Vec<RawYarnAsset>

The GitHub API provides a list of assets. Some Yarn releases don’t include +a tarball, so we don’t support them and remove them from the set of available +Yarn versions.

+

Implementations§

source§

impl RawYarnEntry

source

fn is_full_release(&self) -> bool

Is this entry a full release, i.e., does this entry’s asset list include a +proper release tarball?

+

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawYarnEntry

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/metadata/struct.RawYarnIndex.html b/main/volta_core/tool/yarn/metadata/struct.RawYarnIndex.html new file mode 100644 index 000000000..75776df9d --- /dev/null +++ b/main/volta_core/tool/yarn/metadata/struct.RawYarnIndex.html @@ -0,0 +1,14 @@ +RawYarnIndex in volta_core::tool::yarn::metadata - Rust
pub struct RawYarnIndex(Vec<RawYarnEntry>);

Tuple Fields§

§0: Vec<RawYarnEntry>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for RawYarnIndex

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<RawYarnIndex> for YarnIndex

source§

fn from(raw: RawYarnIndex) -> YarnIndex

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/metadata/struct.YarnIndex.html b/main/volta_core/tool/yarn/metadata/struct.YarnIndex.html new file mode 100644 index 000000000..a1d2ee7d4 --- /dev/null +++ b/main/volta_core/tool/yarn/metadata/struct.YarnIndex.html @@ -0,0 +1,15 @@ +YarnIndex in volta_core::tool::yarn::metadata - Rust
pub struct YarnIndex {
+    pub(super) entries: BTreeSet<Version>,
+}
Expand description

The public Yarn index.

+

Fields§

§entries: BTreeSet<Version>

Trait Implementations§

source§

impl From<RawYarnIndex> for YarnIndex

source§

fn from(raw: RawYarnIndex) -> YarnIndex

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.fetch_yarn_index.html b/main/volta_core/tool/yarn/resolve/fn.fetch_yarn_index.html new file mode 100644 index 000000000..f8b4efde1 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.fetch_yarn_index.html @@ -0,0 +1 @@ +fetch_yarn_index in volta_core::tool::yarn::resolve - Rust
fn fetch_yarn_index(package: &str) -> Fallible<(String, PackageIndex)>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve.html b/main/volta_core/tool/yarn/resolve/fn.resolve.html new file mode 100644 index 000000000..9268da74d --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve.html @@ -0,0 +1,4 @@ +resolve in volta_core::tool::yarn::resolve - Rust

Function volta_core::tool::yarn::resolve::resolve

source ·
pub fn resolve(
+    matching: VersionSpec,
+    session: &mut Session
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_custom_tag.html b/main/volta_core/tool/yarn/resolve/fn.resolve_custom_tag.html new file mode 100644 index 000000000..6fe70c70b --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_custom_tag.html @@ -0,0 +1 @@ +resolve_custom_tag in volta_core::tool::yarn::resolve - Rust
fn resolve_custom_tag(tag: String) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_latest_legacy.html b/main/volta_core/tool/yarn/resolve/fn.resolve_latest_legacy.html new file mode 100644 index 000000000..15f7ce2c3 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_latest_legacy.html @@ -0,0 +1 @@ +resolve_latest_legacy in volta_core::tool::yarn::resolve - Rust
fn resolve_latest_legacy(url: String) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_semver.html b/main/volta_core/tool/yarn/resolve/fn.resolve_semver.html new file mode 100644 index 000000000..7241952d4 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_semver.html @@ -0,0 +1,4 @@ +resolve_semver in volta_core::tool::yarn::resolve - Rust
fn resolve_semver(
+    matching: Range,
+    hooks: Option<&YarnHooks>
+) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_semver_from_registry.html b/main/volta_core/tool/yarn/resolve/fn.resolve_semver_from_registry.html new file mode 100644 index 000000000..de12a4074 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_semver_from_registry.html @@ -0,0 +1 @@ +resolve_semver_from_registry in volta_core::tool::yarn::resolve - Rust
fn resolve_semver_from_registry(matching: Range) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_semver_legacy.html b/main/volta_core/tool/yarn/resolve/fn.resolve_semver_legacy.html new file mode 100644 index 000000000..58a993e71 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_semver_legacy.html @@ -0,0 +1 @@ +resolve_semver_legacy in volta_core::tool::yarn::resolve - Rust
fn resolve_semver_legacy(matching: Range, url: String) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_semver_npm.html b/main/volta_core/tool/yarn/resolve/fn.resolve_semver_npm.html new file mode 100644 index 000000000..d26ca2a73 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_semver_npm.html @@ -0,0 +1 @@ +resolve_semver_npm in volta_core::tool::yarn::resolve - Rust
fn resolve_semver_npm(matching: Range, url: String) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/fn.resolve_tag.html b/main/volta_core/tool/yarn/resolve/fn.resolve_tag.html new file mode 100644 index 000000000..c64cd96f0 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/fn.resolve_tag.html @@ -0,0 +1 @@ +resolve_tag in volta_core::tool::yarn::resolve - Rust
fn resolve_tag(tag: VersionTag, hooks: Option<&YarnHooks>) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/index.html b/main/volta_core/tool/yarn/resolve/index.html new file mode 100644 index 000000000..bd7c5e832 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/index.html @@ -0,0 +1,2 @@ +volta_core::tool::yarn::resolve - Rust

Module volta_core::tool::yarn::resolve

source ·
Expand description

Provides resolution of Yarn requirements into specific versions

+

Functions

\ No newline at end of file diff --git a/main/volta_core/tool/yarn/resolve/sidebar-items.js b/main/volta_core/tool/yarn/resolve/sidebar-items.js new file mode 100644 index 000000000..e0d201a13 --- /dev/null +++ b/main/volta_core/tool/yarn/resolve/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["fetch_yarn_index","resolve","resolve_custom_tag","resolve_latest_legacy","resolve_semver","resolve_semver_from_registry","resolve_semver_legacy","resolve_semver_npm","resolve_tag"]}; \ No newline at end of file diff --git a/main/volta_core/tool/yarn/sidebar-items.js b/main/volta_core/tool/yarn/sidebar-items.js new file mode 100644 index 000000000..d7b5b8bd0 --- /dev/null +++ b/main/volta_core/tool/yarn/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["resolve"],"mod":["fetch","metadata","resolve"],"struct":["Yarn"]}; \ No newline at end of file diff --git a/main/volta_core/tool/yarn/struct.Yarn.html b/main/volta_core/tool/yarn/struct.Yarn.html new file mode 100644 index 000000000..836484daf --- /dev/null +++ b/main/volta_core/tool/yarn/struct.Yarn.html @@ -0,0 +1,16 @@ +Yarn in volta_core::tool::yarn - Rust

Struct volta_core::tool::yarn::Yarn

source ·
pub struct Yarn {
+    pub(super) version: Version,
+}
Expand description

The Tool implementation for fetching and installing Yarn

+

Fields§

§version: Version

Implementations§

source§

impl Yarn

source

pub fn new(version: Version) -> Self

source

pub fn archive_basename(version: &str) -> String

source

pub fn archive_filename(version: &str) -> String

source

pub(crate) fn ensure_fetched(&self, session: &mut Session) -> Fallible<()>

Trait Implementations§

source§

impl Display for Yarn

source§

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

Formats the value using the given formatter. Read more
source§

impl Tool for Yarn

source§

fn fetch(self: Box<Self>, session: &mut Session) -> Fallible<()>

Fetch a Tool into the local inventory
source§

fn install(self: Box<Self>, session: &mut Session) -> Fallible<()>

Install a tool, making it the default so it is available everywhere on the user’s machine
source§

fn pin(self: Box<Self>, session: &mut Session) -> Fallible<()>

Pin a tool in the local project so that it is usable within the project

Auto Trait Implementations§

§

impl RefUnwindSafe for Yarn

§

impl Send for Yarn

§

impl Sync for Yarn

§

impl Unpin for Yarn

§

impl UnwindSafe for Yarn

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/toolchain/index.html b/main/volta_core/toolchain/index.html new file mode 100644 index 000000000..d569853a8 --- /dev/null +++ b/main/volta_core/toolchain/index.html @@ -0,0 +1 @@ +volta_core::toolchain - Rust
\ No newline at end of file diff --git a/main/volta_core/toolchain/serial/index.html b/main/volta_core/toolchain/serial/index.html new file mode 100644 index 000000000..2c341306a --- /dev/null +++ b/main/volta_core/toolchain/serial/index.html @@ -0,0 +1 @@ +volta_core::toolchain::serial - Rust
\ No newline at end of file diff --git a/main/volta_core/toolchain/serial/sidebar-items.js b/main/volta_core/toolchain/serial/sidebar-items.js new file mode 100644 index 000000000..f5200f635 --- /dev/null +++ b/main/volta_core/toolchain/serial/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["NodeVersion","Platform"]}; \ No newline at end of file diff --git a/main/volta_core/toolchain/serial/struct.NodeVersion.html b/main/volta_core/toolchain/serial/struct.NodeVersion.html new file mode 100644 index 000000000..0f4a1561c --- /dev/null +++ b/main/volta_core/toolchain/serial/struct.NodeVersion.html @@ -0,0 +1,26 @@ +NodeVersion in volta_core::toolchain::serial - Rust
pub struct NodeVersion {
+    pub runtime: Version,
+    pub npm: Option<Version>,
+}

Fields§

§runtime: Version§npm: Option<Version>

Trait Implementations§

source§

impl Debug for NodeVersion

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for NodeVersion

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for NodeVersion

source§

fn eq(&self, other: &NodeVersion) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Serialize for NodeVersion

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for NodeVersion

source§

impl StructuralEq for NodeVersion

source§

impl StructuralPartialEq for NodeVersion

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/toolchain/serial/struct.Platform.html b/main/volta_core/toolchain/serial/struct.Platform.html new file mode 100644 index 000000000..1ab22e926 --- /dev/null +++ b/main/volta_core/toolchain/serial/struct.Platform.html @@ -0,0 +1,28 @@ +Platform in volta_core::toolchain::serial - Rust
pub struct Platform {
+    pub node: Option<NodeVersion>,
+    pub pnpm: Option<Version>,
+    pub yarn: Option<Version>,
+}

Fields§

§node: Option<NodeVersion>§pnpm: Option<Version>§yarn: Option<Version>

Implementations§

source§

impl Platform

source

pub fn of(source: &PlatformSpec) -> Self

source

pub fn into_json(self) -> Fallible<String>

Serialize the Platform to a JSON String

+

Trait Implementations§

source§

impl Debug for Platform

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Platform

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Platform> for Option<PlatformSpec>

source§

fn from(platform: Platform) -> Option<PlatformSpec>

Converts to this type from the input type.
source§

impl PartialEq for Platform

source§

fn eq(&self, other: &Platform) -> bool

This method tests for self and other values to be equal, and is used +by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always +sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Platform

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<String> for Platform

§

type Error = VoltaError

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

fn try_from(src: String) -> Fallible<Self>

Performs the conversion.
source§

impl Eq for Platform

source§

impl StructuralEq for Platform

source§

impl StructuralPartialEq for Platform

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere + Q: Eq + ?Sized, + K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/toolchain/sidebar-items.js b/main/volta_core/toolchain/sidebar-items.js new file mode 100644 index 000000000..1be81efb6 --- /dev/null +++ b/main/volta_core/toolchain/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"mod":["serial"],"struct":["LazyToolchain","Toolchain"]}; \ No newline at end of file diff --git a/main/volta_core/toolchain/struct.LazyToolchain.html b/main/volta_core/toolchain/struct.LazyToolchain.html new file mode 100644 index 000000000..5b085809a --- /dev/null +++ b/main/volta_core/toolchain/struct.LazyToolchain.html @@ -0,0 +1,18 @@ +LazyToolchain in volta_core::toolchain - Rust
pub struct LazyToolchain {
+    toolchain: OnceCell<Toolchain>,
+}
Expand description

Lazily loaded toolchain

+

Fields§

§toolchain: OnceCell<Toolchain>

Implementations§

source§

impl LazyToolchain

source

pub fn init() -> Self

Creates a new LazyToolchain

+
source

pub fn get(&self) -> Fallible<&Toolchain>

Forces loading of the toolchain and returns an immutable reference to it

+
source

pub fn get_mut(&mut self) -> Fallible<&mut Toolchain>

Forces loading of the toolchain and returns a mutable reference to it

+

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/toolchain/struct.Toolchain.html b/main/volta_core/toolchain/struct.Toolchain.html new file mode 100644 index 000000000..2290123e6 --- /dev/null +++ b/main/volta_core/toolchain/struct.Toolchain.html @@ -0,0 +1,18 @@ +Toolchain in volta_core::toolchain - Rust
pub struct Toolchain {
+    platform: Option<PlatformSpec>,
+}

Fields§

§platform: Option<PlatformSpec>

Implementations§

source§

impl Toolchain

source

fn current() -> Fallible<Toolchain>

source

pub fn platform(&self) -> Option<&PlatformSpec>

source

pub fn set_active_node(&mut self, node_version: &Version) -> Fallible<()>

Set the active Node version in the default platform file.

+
source

pub fn set_active_yarn(&mut self, yarn: Option<Version>) -> Fallible<()>

Set the active Yarn version in the default platform file.

+
source

pub fn set_active_pnpm(&mut self, pnpm: Option<Version>) -> Fallible<()>

Set the active pnpm version in the default platform file.

+
source

pub fn set_active_npm(&mut self, npm: Option<Version>) -> Fallible<()>

Set the active Npm version in the default platform file.

+
source

pub fn save(&self) -> Fallible<()>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/version/enum.VersionSpec.html b/main/volta_core/version/enum.VersionSpec.html new file mode 100644 index 000000000..ae4290911 --- /dev/null +++ b/main/volta_core/version/enum.VersionSpec.html @@ -0,0 +1,22 @@ +VersionSpec in volta_core::version - Rust
pub enum VersionSpec {
+    None,
+    Semver(Range),
+    Exact(Version),
+    Tag(VersionTag),
+}

Variants§

§

None

No version specified (default)

+
§

Semver(Range)

SemVer Range

+
§

Exact(Version)

Exact Version

+
§

Tag(VersionTag)

Arbitrary Version Tag

+

Trait Implementations§

source§

impl Debug for VersionSpec

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for VersionSpec

source§

fn default() -> VersionSpec

Returns the “default value” for a type. Read more
source§

impl Display for VersionSpec

source§

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

Formats the value using the given formatter. Read more
source§

impl FromStr for VersionSpec

§

type Err = VoltaError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Fallible<Self>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/version/enum.VersionTag.html b/main/volta_core/version/enum.VersionTag.html new file mode 100644 index 000000000..77bb2cdba --- /dev/null +++ b/main/volta_core/version/enum.VersionTag.html @@ -0,0 +1,20 @@ +VersionTag in volta_core::version - Rust
pub enum VersionTag {
+    Latest,
+    Lts,
+    Custom(String),
+}

Variants§

§

Latest

The ‘latest’ tag, a special case that exists for all packages

+
§

Lts

The ‘lts’ tag, a special case for Node

+
§

Custom(String)

An arbitrary tag version

+

Trait Implementations§

source§

impl Debug for VersionTag

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for VersionTag

source§

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

Formats the value using the given formatter. Read more
source§

impl FromStr for VersionTag

§

type Err = VoltaError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Fallible<Self>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_core/version/fn.parse_requirements.html b/main/volta_core/version/fn.parse_requirements.html new file mode 100644 index 000000000..1638dfe1f --- /dev/null +++ b/main/volta_core/version/fn.parse_requirements.html @@ -0,0 +1 @@ +parse_requirements in volta_core::version - Rust
pub fn parse_requirements(s: impl AsRef<str>) -> Fallible<Range>
\ No newline at end of file diff --git a/main/volta_core/version/fn.parse_version.html b/main/volta_core/version/fn.parse_version.html new file mode 100644 index 000000000..090b7a4bd --- /dev/null +++ b/main/volta_core/version/fn.parse_version.html @@ -0,0 +1 @@ +parse_version in volta_core::version - Rust
pub fn parse_version(s: impl AsRef<str>) -> Fallible<Version>
\ No newline at end of file diff --git a/main/volta_core/version/fn.trim_version.html b/main/volta_core/version/fn.trim_version.html new file mode 100644 index 000000000..7690447b3 --- /dev/null +++ b/main/volta_core/version/fn.trim_version.html @@ -0,0 +1 @@ +trim_version in volta_core::version - Rust
fn trim_version(s: &str) -> &str
\ No newline at end of file diff --git a/main/volta_core/version/hashmap_version_serde/fn.deserialize.html b/main/volta_core/version/hashmap_version_serde/fn.deserialize.html new file mode 100644 index 000000000..62b9ea96e --- /dev/null +++ b/main/volta_core/version/hashmap_version_serde/fn.deserialize.html @@ -0,0 +1,4 @@ +deserialize in volta_core::version::hashmap_version_serde - Rust
pub fn deserialize<'de, D>(
+    deserializer: D
+) -> Result<HashMap<String, Version>, D::Error>where
+    D: Deserializer<'de>,
\ No newline at end of file diff --git a/main/volta_core/version/hashmap_version_serde/index.html b/main/volta_core/version/hashmap_version_serde/index.html new file mode 100644 index 000000000..1dfbd299e --- /dev/null +++ b/main/volta_core/version/hashmap_version_serde/index.html @@ -0,0 +1 @@ +volta_core::version::hashmap_version_serde - Rust
\ No newline at end of file diff --git a/main/volta_core/version/hashmap_version_serde/sidebar-items.js b/main/volta_core/version/hashmap_version_serde/sidebar-items.js new file mode 100644 index 000000000..eb27d82fc --- /dev/null +++ b/main/volta_core/version/hashmap_version_serde/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["deserialize"],"struct":["Wrapper"]}; \ No newline at end of file diff --git a/main/volta_core/version/hashmap_version_serde/struct.Wrapper.html b/main/volta_core/version/hashmap_version_serde/struct.Wrapper.html new file mode 100644 index 000000000..24447b410 --- /dev/null +++ b/main/volta_core/version/hashmap_version_serde/struct.Wrapper.html @@ -0,0 +1,14 @@ +Wrapper in volta_core::version::hashmap_version_serde - Rust
struct Wrapper(Version);

Tuple Fields§

§0: Version

Trait Implementations§

source§

impl<'de> Deserialize<'de> for Wrapper

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_core/version/index.html b/main/volta_core/version/index.html new file mode 100644 index 000000000..4f669aa25 --- /dev/null +++ b/main/volta_core/version/index.html @@ -0,0 +1 @@ +volta_core::version - Rust
\ No newline at end of file diff --git a/main/volta_core/version/option_version_serde/fn.deserialize.html b/main/volta_core/version/option_version_serde/fn.deserialize.html new file mode 100644 index 000000000..2e10a1b1f --- /dev/null +++ b/main/volta_core/version/option_version_serde/fn.deserialize.html @@ -0,0 +1,2 @@ +deserialize in volta_core::version::option_version_serde - Rust
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Version>, D::Error>where
+    D: Deserializer<'de>,
\ No newline at end of file diff --git a/main/volta_core/version/option_version_serde/fn.serialize.html b/main/volta_core/version/option_version_serde/fn.serialize.html new file mode 100644 index 000000000..662f22324 --- /dev/null +++ b/main/volta_core/version/option_version_serde/fn.serialize.html @@ -0,0 +1,2 @@ +serialize in volta_core::version::option_version_serde - Rust
pub fn serialize<S>(version: &Option<Version>, s: S) -> Result<S::Ok, S::Error>where
+    S: Serializer,
\ No newline at end of file diff --git a/main/volta_core/version/option_version_serde/index.html b/main/volta_core/version/option_version_serde/index.html new file mode 100644 index 000000000..c880fad1d --- /dev/null +++ b/main/volta_core/version/option_version_serde/index.html @@ -0,0 +1 @@ +volta_core::version::option_version_serde - Rust
\ No newline at end of file diff --git a/main/volta_core/version/option_version_serde/sidebar-items.js b/main/volta_core/version/option_version_serde/sidebar-items.js new file mode 100644 index 000000000..4ed511ece --- /dev/null +++ b/main/volta_core/version/option_version_serde/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["deserialize","serialize"]}; \ No newline at end of file diff --git a/main/volta_core/version/serial/fn.parse_requirements.html b/main/volta_core/version/serial/fn.parse_requirements.html new file mode 100644 index 000000000..ca3348613 --- /dev/null +++ b/main/volta_core/version/serial/fn.parse_requirements.html @@ -0,0 +1 @@ +parse_requirements in volta_core::version::serial - Rust
pub fn parse_requirements(src: &str) -> Result<Range, SemverError>
\ No newline at end of file diff --git a/main/volta_core/version/serial/index.html b/main/volta_core/version/serial/index.html new file mode 100644 index 000000000..a9249d382 --- /dev/null +++ b/main/volta_core/version/serial/index.html @@ -0,0 +1 @@ +volta_core::version::serial - Rust
\ No newline at end of file diff --git a/main/volta_core/version/serial/sidebar-items.js b/main/volta_core/version/serial/sidebar-items.js new file mode 100644 index 000000000..8d37e3b41 --- /dev/null +++ b/main/volta_core/version/serial/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["parse_requirements"]}; \ No newline at end of file diff --git a/main/volta_core/version/sidebar-items.js b/main/volta_core/version/sidebar-items.js new file mode 100644 index 000000000..19d792b52 --- /dev/null +++ b/main/volta_core/version/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["VersionSpec","VersionTag"],"fn":["parse_requirements","parse_version","trim_version"],"mod":["hashmap_version_serde","option_version_serde","serial","version_serde"]}; \ No newline at end of file diff --git a/main/volta_core/version/version_serde/fn.deserialize.html b/main/volta_core/version/version_serde/fn.deserialize.html new file mode 100644 index 000000000..271d4c5b9 --- /dev/null +++ b/main/volta_core/version/version_serde/fn.deserialize.html @@ -0,0 +1,2 @@ +deserialize in volta_core::version::version_serde - Rust
pub fn deserialize<'de, D>(deserializer: D) -> Result<Version, D::Error>where
+    D: Deserializer<'de>,
\ No newline at end of file diff --git a/main/volta_core/version/version_serde/fn.serialize.html b/main/volta_core/version/version_serde/fn.serialize.html new file mode 100644 index 000000000..756d1d44b --- /dev/null +++ b/main/volta_core/version/version_serde/fn.serialize.html @@ -0,0 +1,2 @@ +serialize in volta_core::version::version_serde - Rust
pub fn serialize<S>(version: &Version, s: S) -> Result<S::Ok, S::Error>where
+    S: Serializer,
\ No newline at end of file diff --git a/main/volta_core/version/version_serde/index.html b/main/volta_core/version/version_serde/index.html new file mode 100644 index 000000000..936ee1a33 --- /dev/null +++ b/main/volta_core/version/version_serde/index.html @@ -0,0 +1 @@ +volta_core::version::version_serde - Rust
\ No newline at end of file diff --git a/main/volta_core/version/version_serde/sidebar-items.js b/main/volta_core/version/version_serde/sidebar-items.js new file mode 100644 index 000000000..d7c08dddf --- /dev/null +++ b/main/volta_core/version/version_serde/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["deserialize","serialize"],"struct":["VersionVisitor"]}; \ No newline at end of file diff --git a/main/volta_core/version/version_serde/struct.VersionVisitor.html b/main/volta_core/version/version_serde/struct.VersionVisitor.html new file mode 100644 index 000000000..0fdf8c29a --- /dev/null +++ b/main/volta_core/version/version_serde/struct.VersionVisitor.html @@ -0,0 +1,62 @@ +VersionVisitor in volta_core::version::version_serde - Rust
struct VersionVisitor;

Trait Implementations§

source§

impl Visitor<'_> for VersionVisitor

§

type Value = Version

The value produced by this visitor.
source§

fn expecting(&self, formatter: &mut Formatter<'_>) -> Result

Format a message stating what data this Visitor expects to receive. Read more
source§

fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>where + E: Error,

The input contains a string. The lifetime of the string is ephemeral and +it may be destroyed after this method returns. Read more
source§

fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>where + E: Error,

The input contains a boolean. Read more
source§

fn visit_i8<E>(self, v: i8) -> Result<Self::Value, E>where + E: Error,

The input contains an i8. Read more
source§

fn visit_i16<E>(self, v: i16) -> Result<Self::Value, E>where + E: Error,

The input contains an i16. Read more
source§

fn visit_i32<E>(self, v: i32) -> Result<Self::Value, E>where + E: Error,

The input contains an i32. Read more
source§

fn visit_i64<E>(self, v: i64) -> Result<Self::Value, E>where + E: Error,

The input contains an i64. Read more
source§

fn visit_i128<E>(self, v: i128) -> Result<Self::Value, E>where + E: Error,

The input contains a i128. Read more
source§

fn visit_u8<E>(self, v: u8) -> Result<Self::Value, E>where + E: Error,

The input contains a u8. Read more
source§

fn visit_u16<E>(self, v: u16) -> Result<Self::Value, E>where + E: Error,

The input contains a u16. Read more
source§

fn visit_u32<E>(self, v: u32) -> Result<Self::Value, E>where + E: Error,

The input contains a u32. Read more
source§

fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E>where + E: Error,

The input contains a u64. Read more
source§

fn visit_u128<E>(self, v: u128) -> Result<Self::Value, E>where + E: Error,

The input contains a u128. Read more
source§

fn visit_f32<E>(self, v: f32) -> Result<Self::Value, E>where + E: Error,

The input contains an f32. Read more
source§

fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>where + E: Error,

The input contains an f64. Read more
source§

fn visit_char<E>(self, v: char) -> Result<Self::Value, E>where + E: Error,

The input contains a char. Read more
source§

fn visit_borrowed_str<E>(self, v: &'de str) -> Result<Self::Value, E>where + E: Error,

The input contains a string that lives at least as long as the +Deserializer. Read more
source§

fn visit_string<E>(self, v: String) -> Result<Self::Value, E>where + E: Error,

The input contains a string and ownership of the string is being given +to the Visitor. Read more
source§

fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>where + E: Error,

The input contains a byte array. The lifetime of the byte array is +ephemeral and it may be destroyed after this method returns. Read more
source§

fn visit_borrowed_bytes<E>(self, v: &'de [u8]) -> Result<Self::Value, E>where + E: Error,

The input contains a byte array that lives at least as long as the +Deserializer. Read more
source§

fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E>where + E: Error,

The input contains a byte array and ownership of the byte array is being +given to the Visitor. Read more
source§

fn visit_none<E>(self) -> Result<Self::Value, E>where + E: Error,

The input contains an optional that is absent. Read more
source§

fn visit_some<D>( + self, + deserializer: D +) -> Result<Self::Value, <D as Deserializer<'de>>::Error>where + D: Deserializer<'de>,

The input contains an optional that is present. Read more
source§

fn visit_unit<E>(self) -> Result<Self::Value, E>where + E: Error,

The input contains a unit (). Read more
source§

fn visit_newtype_struct<D>( + self, + deserializer: D +) -> Result<Self::Value, <D as Deserializer<'de>>::Error>where + D: Deserializer<'de>,

The input contains a newtype struct. Read more
source§

fn visit_seq<A>( + self, + seq: A +) -> Result<Self::Value, <A as SeqAccess<'de>>::Error>where + A: SeqAccess<'de>,

The input contains a sequence of elements. Read more
source§

fn visit_map<A>( + self, + map: A +) -> Result<Self::Value, <A as MapAccess<'de>>::Error>where + A: MapAccess<'de>,

The input contains a key-value map. Read more
source§

fn visit_enum<A>( + self, + data: A +) -> Result<Self::Value, <A as EnumAccess<'de>>::Error>where + A: EnumAccess<'de>,

The input contains an enum. Read more

Auto Trait Implementations§

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<'de, T> Expected for Twhere + T: Visitor<'de>,

source§

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

Format an explanation of what data was being expected. Same signature as +the Display and Debug traits.
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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_layout/all.html b/main/volta_layout/all.html new file mode 100644 index 000000000..f4019570c --- /dev/null +++ b/main/volta_layout/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/main/volta_layout/fn.executable.html b/main/volta_layout/fn.executable.html new file mode 100644 index 000000000..c3650b170 --- /dev/null +++ b/main/volta_layout/fn.executable.html @@ -0,0 +1 @@ +executable in volta_layout - Rust

Function volta_layout::executable

source ·
pub(crate) fn executable(name: &str) -> String
\ No newline at end of file diff --git a/main/volta_layout/index.html b/main/volta_layout/index.html new file mode 100644 index 000000000..579c85d8f --- /dev/null +++ b/main/volta_layout/index.html @@ -0,0 +1,2 @@ +volta_layout - Rust
\ No newline at end of file diff --git a/main/volta_layout/macros/index.html b/main/volta_layout/macros/index.html new file mode 100644 index 000000000..609b0bd15 --- /dev/null +++ b/main/volta_layout/macros/index.html @@ -0,0 +1 @@ +volta_layout::macros - Rust
\ No newline at end of file diff --git a/main/volta_layout/macros/macro.path_buf!.html b/main/volta_layout/macros/macro.path_buf!.html new file mode 100644 index 000000000..ef215442e --- /dev/null +++ b/main/volta_layout/macros/macro.path_buf!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.path_buf.html...

+ + + \ No newline at end of file diff --git a/main/volta_layout/macros/macro.path_buf.html b/main/volta_layout/macros/macro.path_buf.html new file mode 100644 index 000000000..62a55b454 --- /dev/null +++ b/main/volta_layout/macros/macro.path_buf.html @@ -0,0 +1,3 @@ +path_buf in volta_layout::macros - Rust
macro_rules! path_buf {
+    ($base:expr, $( $x:expr ), *) => { ... };
+}
\ No newline at end of file diff --git a/main/volta_layout/macros/sidebar-items.js b/main/volta_layout/macros/sidebar-items.js new file mode 100644 index 000000000..de338170a --- /dev/null +++ b/main/volta_layout/macros/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"macro":["path_buf"]}; \ No newline at end of file diff --git a/main/volta_layout/sidebar-items.js b/main/volta_layout/sidebar-items.js new file mode 100644 index 000000000..38d325bae --- /dev/null +++ b/main/volta_layout/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["executable"],"mod":["macros","v0","v1","v2","v3","v4"]}; \ No newline at end of file diff --git a/main/volta_layout/v0/index.html b/main/volta_layout/v0/index.html new file mode 100644 index 000000000..cba65da1b --- /dev/null +++ b/main/volta_layout/v0/index.html @@ -0,0 +1 @@ +volta_layout::v0 - Rust
\ No newline at end of file diff --git a/main/volta_layout/v0/sidebar-items.js b/main/volta_layout/v0/sidebar-items.js new file mode 100644 index 000000000..c2ca151a3 --- /dev/null +++ b/main/volta_layout/v0/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["VoltaHome","VoltaInstall"]}; \ No newline at end of file diff --git a/main/volta_layout/v0/struct.VoltaHome.html b/main/volta_layout/v0/struct.VoltaHome.html new file mode 100644 index 000000000..a2d1d58a0 --- /dev/null +++ b/main/volta_layout/v0/struct.VoltaHome.html @@ -0,0 +1,102 @@ +VoltaHome in volta_layout::v0 - Rust

Struct volta_layout::v0::VoltaHome

source ·
pub struct VoltaHome {
Show 22 fields + cache_dir: PathBuf, + node_cache_dir: PathBuf, + shim_dir: PathBuf, + log_dir: PathBuf, + tools_dir: PathBuf, + inventory_dir: PathBuf, + node_inventory_dir: PathBuf, + package_inventory_dir: PathBuf, + yarn_inventory_dir: PathBuf, + image_dir: PathBuf, + node_image_root_dir: PathBuf, + yarn_image_root_dir: PathBuf, + package_image_root_dir: PathBuf, + default_toolchain_dir: PathBuf, + default_bin_dir: PathBuf, + default_package_dir: PathBuf, + tmp_dir: PathBuf, + node_index_file: PathBuf, + node_index_expiry_file: PathBuf, + default_platform_file: PathBuf, + default_hooks_file: PathBuf, + root: PathBuf, +
}

Fields§

§cache_dir: PathBuf§node_cache_dir: PathBuf§shim_dir: PathBuf§log_dir: PathBuf§tools_dir: PathBuf§inventory_dir: PathBuf§node_inventory_dir: PathBuf§package_inventory_dir: PathBuf§yarn_inventory_dir: PathBuf§image_dir: PathBuf§node_image_root_dir: PathBuf§yarn_image_root_dir: PathBuf§package_image_root_dir: PathBuf§default_toolchain_dir: PathBuf§default_bin_dir: PathBuf§default_package_dir: PathBuf§tmp_dir: PathBuf§node_index_file: PathBuf§node_index_expiry_file: PathBuf§default_platform_file: PathBuf§default_hooks_file: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaHome

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaHome +layout, rooted at root.

+
source§

impl VoltaHome

source

pub fn cache_dir(&self) -> &Path

Returns the +cache_dir +path.

+
source

pub fn node_cache_dir(&self) -> &Path

Returns the +node_cache_dir +path.

+
source

pub fn shim_dir(&self) -> &Path

Returns the +shim_dir +path.

+
source

pub fn log_dir(&self) -> &Path

Returns the +log_dir +path.

+
source

pub fn tools_dir(&self) -> &Path

Returns the +tools_dir +path.

+
source

pub fn inventory_dir(&self) -> &Path

Returns the +inventory_dir +path.

+
source

pub fn node_inventory_dir(&self) -> &Path

Returns the +node_inventory_dir +path.

+
source

pub fn package_inventory_dir(&self) -> &Path

Returns the +package_inventory_dir +path.

+
source

pub fn yarn_inventory_dir(&self) -> &Path

Returns the +yarn_inventory_dir +path.

+
source

pub fn image_dir(&self) -> &Path

Returns the +image_dir +path.

+
source

pub fn node_image_root_dir(&self) -> &Path

Returns the +node_image_root_dir +path.

+
source

pub fn yarn_image_root_dir(&self) -> &Path

Returns the +yarn_image_root_dir +path.

+
source

pub fn package_image_root_dir(&self) -> &Path

Returns the +package_image_root_dir +path.

+
source

pub fn default_toolchain_dir(&self) -> &Path

Returns the +default_toolchain_dir +path.

+
source

pub fn default_bin_dir(&self) -> &Path

Returns the +default_bin_dir +path.

+
source

pub fn default_package_dir(&self) -> &Path

Returns the +default_package_dir +path.

+
source

pub fn tmp_dir(&self) -> &Path

Returns the +tmp_dir +path.

+
source

pub fn node_index_file(&self) -> &Path

Returns the +node_index_file +path.

+
source

pub fn node_index_expiry_file(&self) -> &Path

Returns the +node_index_expiry_file +path.

+
source

pub fn default_platform_file(&self) -> &Path

Returns the +default_platform_file +path.

+
source

pub fn default_hooks_file(&self) -> &Path

Returns the +default_hooks_file +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaHome

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+
source§

impl VoltaHome

source

pub fn package_distro_file(&self, name: &str, version: &str) -> PathBuf

source

pub fn package_distro_shasum(&self, name: &str, version: &str) -> PathBuf

source

pub fn node_image_dir(&self, node: &str, npm: &str) -> PathBuf

source

pub fn yarn_image_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn package_image_dir(&self, name: &str, version: &str) -> PathBuf

source

pub fn default_package_config_file(&self, package_name: &str) -> PathBuf

source

pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf

source

pub fn node_npm_version_file(&self, version: &str) -> PathBuf

source

pub fn shim_file(&self, toolname: &str) -> PathBuf

source§

impl VoltaHome

source

pub fn node_image_bin_dir(&self, node: &str, npm: &str) -> PathBuf

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout/v0/struct.VoltaInstall.html b/main/volta_layout/v0/struct.VoltaInstall.html new file mode 100644 index 000000000..eddc29f2e --- /dev/null +++ b/main/volta_layout/v0/struct.VoltaInstall.html @@ -0,0 +1,22 @@ +VoltaInstall in volta_layout::v0 - Rust
pub struct VoltaInstall {
+    shim_executable: PathBuf,
+    root: PathBuf,
+}

Fields§

§shim_executable: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaInstall

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaInstall +layout, rooted at root.

+
source§

impl VoltaInstall

source

pub fn shim_executable(&self) -> &Path

Returns the +shim_executable +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaInstall

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout/v1/index.html b/main/volta_layout/v1/index.html new file mode 100644 index 000000000..9d3ed10f3 --- /dev/null +++ b/main/volta_layout/v1/index.html @@ -0,0 +1 @@ +volta_layout::v1 - Rust
\ No newline at end of file diff --git a/main/volta_layout/v1/sidebar-items.js b/main/volta_layout/v1/sidebar-items.js new file mode 100644 index 000000000..c2ca151a3 --- /dev/null +++ b/main/volta_layout/v1/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["VoltaHome","VoltaInstall"]}; \ No newline at end of file diff --git a/main/volta_layout/v1/struct.VoltaHome.html b/main/volta_layout/v1/struct.VoltaHome.html new file mode 100644 index 000000000..c1cdfbaff --- /dev/null +++ b/main/volta_layout/v1/struct.VoltaHome.html @@ -0,0 +1,106 @@ +VoltaHome in volta_layout::v1 - Rust

Struct volta_layout::v1::VoltaHome

source ·
pub struct VoltaHome {
Show 23 fields + cache_dir: PathBuf, + node_cache_dir: PathBuf, + shim_dir: PathBuf, + log_dir: PathBuf, + tools_dir: PathBuf, + inventory_dir: PathBuf, + node_inventory_dir: PathBuf, + package_inventory_dir: PathBuf, + yarn_inventory_dir: PathBuf, + image_dir: PathBuf, + node_image_root_dir: PathBuf, + yarn_image_root_dir: PathBuf, + package_image_root_dir: PathBuf, + default_toolchain_dir: PathBuf, + default_bin_dir: PathBuf, + default_package_dir: PathBuf, + tmp_dir: PathBuf, + node_index_file: PathBuf, + node_index_expiry_file: PathBuf, + default_platform_file: PathBuf, + default_hooks_file: PathBuf, + layout_file: PathBuf, + root: PathBuf, +
}

Fields§

§cache_dir: PathBuf§node_cache_dir: PathBuf§shim_dir: PathBuf§log_dir: PathBuf§tools_dir: PathBuf§inventory_dir: PathBuf§node_inventory_dir: PathBuf§package_inventory_dir: PathBuf§yarn_inventory_dir: PathBuf§image_dir: PathBuf§node_image_root_dir: PathBuf§yarn_image_root_dir: PathBuf§package_image_root_dir: PathBuf§default_toolchain_dir: PathBuf§default_bin_dir: PathBuf§default_package_dir: PathBuf§tmp_dir: PathBuf§node_index_file: PathBuf§node_index_expiry_file: PathBuf§default_platform_file: PathBuf§default_hooks_file: PathBuf§layout_file: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaHome

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaHome +layout, rooted at root.

+
source§

impl VoltaHome

source

pub fn cache_dir(&self) -> &Path

Returns the +cache_dir +path.

+
source

pub fn node_cache_dir(&self) -> &Path

Returns the +node_cache_dir +path.

+
source

pub fn shim_dir(&self) -> &Path

Returns the +shim_dir +path.

+
source

pub fn log_dir(&self) -> &Path

Returns the +log_dir +path.

+
source

pub fn tools_dir(&self) -> &Path

Returns the +tools_dir +path.

+
source

pub fn inventory_dir(&self) -> &Path

Returns the +inventory_dir +path.

+
source

pub fn node_inventory_dir(&self) -> &Path

Returns the +node_inventory_dir +path.

+
source

pub fn package_inventory_dir(&self) -> &Path

Returns the +package_inventory_dir +path.

+
source

pub fn yarn_inventory_dir(&self) -> &Path

Returns the +yarn_inventory_dir +path.

+
source

pub fn image_dir(&self) -> &Path

Returns the +image_dir +path.

+
source

pub fn node_image_root_dir(&self) -> &Path

Returns the +node_image_root_dir +path.

+
source

pub fn yarn_image_root_dir(&self) -> &Path

Returns the +yarn_image_root_dir +path.

+
source

pub fn package_image_root_dir(&self) -> &Path

Returns the +package_image_root_dir +path.

+
source

pub fn default_toolchain_dir(&self) -> &Path

Returns the +default_toolchain_dir +path.

+
source

pub fn default_bin_dir(&self) -> &Path

Returns the +default_bin_dir +path.

+
source

pub fn default_package_dir(&self) -> &Path

Returns the +default_package_dir +path.

+
source

pub fn tmp_dir(&self) -> &Path

Returns the +tmp_dir +path.

+
source

pub fn node_index_file(&self) -> &Path

Returns the +node_index_file +path.

+
source

pub fn node_index_expiry_file(&self) -> &Path

Returns the +node_index_expiry_file +path.

+
source

pub fn default_platform_file(&self) -> &Path

Returns the +default_platform_file +path.

+
source

pub fn default_hooks_file(&self) -> &Path

Returns the +default_hooks_file +path.

+
source

pub fn layout_file(&self) -> &Path

Returns the +layout_file +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaHome

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+
source§

impl VoltaHome

source

pub fn package_distro_file(&self, name: &str, version: &str) -> PathBuf

source

pub fn package_distro_shasum(&self, name: &str, version: &str) -> PathBuf

source

pub fn node_image_dir(&self, node: &str, npm: &str) -> PathBuf

source

pub fn yarn_image_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn package_image_dir(&self, name: &str, version: &str) -> PathBuf

source

pub fn default_package_config_file(&self, package_name: &str) -> PathBuf

source

pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf

source

pub fn node_npm_version_file(&self, version: &str) -> PathBuf

source

pub fn shim_file(&self, toolname: &str) -> PathBuf

source§

impl VoltaHome

source

pub fn node_image_bin_dir(&self, node: &str, npm: &str) -> PathBuf

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout/v1/struct.VoltaInstall.html b/main/volta_layout/v1/struct.VoltaInstall.html new file mode 100644 index 000000000..04ca96a0d --- /dev/null +++ b/main/volta_layout/v1/struct.VoltaInstall.html @@ -0,0 +1,30 @@ +VoltaInstall in volta_layout::v1 - Rust
pub struct VoltaInstall {
+    shim_executable: PathBuf,
+    main_executable: PathBuf,
+    migrate_executable: PathBuf,
+    root: PathBuf,
+}

Fields§

§shim_executable: PathBuf§main_executable: PathBuf§migrate_executable: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaInstall

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaInstall +layout, rooted at root.

+
source§

impl VoltaInstall

source

pub fn shim_executable(&self) -> &Path

Returns the +shim_executable +path.

+
source

pub fn main_executable(&self) -> &Path

Returns the +main_executable +path.

+
source

pub fn migrate_executable(&self) -> &Path

Returns the +migrate_executable +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaInstall

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout/v2/index.html b/main/volta_layout/v2/index.html new file mode 100644 index 000000000..70c8e52b0 --- /dev/null +++ b/main/volta_layout/v2/index.html @@ -0,0 +1 @@ +volta_layout::v2 - Rust
\ No newline at end of file diff --git a/main/volta_layout/v2/sidebar-items.js b/main/volta_layout/v2/sidebar-items.js new file mode 100644 index 000000000..540824009 --- /dev/null +++ b/main/volta_layout/v2/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["VoltaHome"]}; \ No newline at end of file diff --git a/main/volta_layout/v2/struct.VoltaHome.html b/main/volta_layout/v2/struct.VoltaHome.html new file mode 100644 index 000000000..ac426735e --- /dev/null +++ b/main/volta_layout/v2/struct.VoltaHome.html @@ -0,0 +1,114 @@ +VoltaHome in volta_layout::v2 - Rust

Struct volta_layout::v2::VoltaHome

source ·
pub struct VoltaHome {
Show 25 fields + cache_dir: PathBuf, + node_cache_dir: PathBuf, + shim_dir: PathBuf, + log_dir: PathBuf, + tools_dir: PathBuf, + inventory_dir: PathBuf, + node_inventory_dir: PathBuf, + npm_inventory_dir: PathBuf, + package_inventory_dir: PathBuf, + yarn_inventory_dir: PathBuf, + image_dir: PathBuf, + node_image_root_dir: PathBuf, + npm_image_root_dir: PathBuf, + yarn_image_root_dir: PathBuf, + package_image_root_dir: PathBuf, + default_toolchain_dir: PathBuf, + default_bin_dir: PathBuf, + default_package_dir: PathBuf, + tmp_dir: PathBuf, + node_index_file: PathBuf, + node_index_expiry_file: PathBuf, + default_platform_file: PathBuf, + default_hooks_file: PathBuf, + layout_file: PathBuf, + root: PathBuf, +
}

Fields§

§cache_dir: PathBuf§node_cache_dir: PathBuf§shim_dir: PathBuf§log_dir: PathBuf§tools_dir: PathBuf§inventory_dir: PathBuf§node_inventory_dir: PathBuf§npm_inventory_dir: PathBuf§package_inventory_dir: PathBuf§yarn_inventory_dir: PathBuf§image_dir: PathBuf§node_image_root_dir: PathBuf§npm_image_root_dir: PathBuf§yarn_image_root_dir: PathBuf§package_image_root_dir: PathBuf§default_toolchain_dir: PathBuf§default_bin_dir: PathBuf§default_package_dir: PathBuf§tmp_dir: PathBuf§node_index_file: PathBuf§node_index_expiry_file: PathBuf§default_platform_file: PathBuf§default_hooks_file: PathBuf§layout_file: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaHome

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaHome +layout, rooted at root.

+
source§

impl VoltaHome

source

pub fn cache_dir(&self) -> &Path

Returns the +cache_dir +path.

+
source

pub fn node_cache_dir(&self) -> &Path

Returns the +node_cache_dir +path.

+
source

pub fn shim_dir(&self) -> &Path

Returns the +shim_dir +path.

+
source

pub fn log_dir(&self) -> &Path

Returns the +log_dir +path.

+
source

pub fn tools_dir(&self) -> &Path

Returns the +tools_dir +path.

+
source

pub fn inventory_dir(&self) -> &Path

Returns the +inventory_dir +path.

+
source

pub fn node_inventory_dir(&self) -> &Path

Returns the +node_inventory_dir +path.

+
source

pub fn npm_inventory_dir(&self) -> &Path

Returns the +npm_inventory_dir +path.

+
source

pub fn package_inventory_dir(&self) -> &Path

Returns the +package_inventory_dir +path.

+
source

pub fn yarn_inventory_dir(&self) -> &Path

Returns the +yarn_inventory_dir +path.

+
source

pub fn image_dir(&self) -> &Path

Returns the +image_dir +path.

+
source

pub fn node_image_root_dir(&self) -> &Path

Returns the +node_image_root_dir +path.

+
source

pub fn npm_image_root_dir(&self) -> &Path

Returns the +npm_image_root_dir +path.

+
source

pub fn yarn_image_root_dir(&self) -> &Path

Returns the +yarn_image_root_dir +path.

+
source

pub fn package_image_root_dir(&self) -> &Path

Returns the +package_image_root_dir +path.

+
source

pub fn default_toolchain_dir(&self) -> &Path

Returns the +default_toolchain_dir +path.

+
source

pub fn default_bin_dir(&self) -> &Path

Returns the +default_bin_dir +path.

+
source

pub fn default_package_dir(&self) -> &Path

Returns the +default_package_dir +path.

+
source

pub fn tmp_dir(&self) -> &Path

Returns the +tmp_dir +path.

+
source

pub fn node_index_file(&self) -> &Path

Returns the +node_index_file +path.

+
source

pub fn node_index_expiry_file(&self) -> &Path

Returns the +node_index_expiry_file +path.

+
source

pub fn default_platform_file(&self) -> &Path

Returns the +default_platform_file +path.

+
source

pub fn default_hooks_file(&self) -> &Path

Returns the +default_hooks_file +path.

+
source

pub fn layout_file(&self) -> &Path

Returns the +layout_file +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaHome

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+
source§

impl VoltaHome

source

pub fn package_distro_file(&self, name: &str, version: &str) -> PathBuf

source

pub fn package_distro_shasum(&self, name: &str, version: &str) -> PathBuf

source

pub fn node_image_dir(&self, node: &str) -> PathBuf

source

pub fn npm_image_dir(&self, npm: &str) -> PathBuf

source

pub fn npm_image_bin_dir(&self, npm: &str) -> PathBuf

source

pub fn yarn_image_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn package_image_dir(&self, name: &str, version: &str) -> PathBuf

source

pub fn default_package_config_file(&self, package_name: &str) -> PathBuf

source

pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf

source

pub fn node_npm_version_file(&self, version: &str) -> PathBuf

source

pub fn shim_file(&self, toolname: &str) -> PathBuf

source§

impl VoltaHome

source

pub fn node_image_bin_dir(&self, node: &str) -> PathBuf

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout/v3/index.html b/main/volta_layout/v3/index.html new file mode 100644 index 000000000..262899ca6 --- /dev/null +++ b/main/volta_layout/v3/index.html @@ -0,0 +1 @@ +volta_layout::v3 - Rust
\ No newline at end of file diff --git a/main/volta_layout/v3/sidebar-items.js b/main/volta_layout/v3/sidebar-items.js new file mode 100644 index 000000000..540824009 --- /dev/null +++ b/main/volta_layout/v3/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["VoltaHome"]}; \ No newline at end of file diff --git a/main/volta_layout/v3/struct.VoltaHome.html b/main/volta_layout/v3/struct.VoltaHome.html new file mode 100644 index 000000000..05f45269e --- /dev/null +++ b/main/volta_layout/v3/struct.VoltaHome.html @@ -0,0 +1,122 @@ +VoltaHome in volta_layout::v3 - Rust

Struct volta_layout::v3::VoltaHome

source ·
pub struct VoltaHome {
Show 27 fields + cache_dir: PathBuf, + node_cache_dir: PathBuf, + shim_dir: PathBuf, + log_dir: PathBuf, + tools_dir: PathBuf, + inventory_dir: PathBuf, + node_inventory_dir: PathBuf, + npm_inventory_dir: PathBuf, + pnpm_inventory_dir: PathBuf, + yarn_inventory_dir: PathBuf, + image_dir: PathBuf, + node_image_root_dir: PathBuf, + npm_image_root_dir: PathBuf, + pnpm_image_root_dir: PathBuf, + yarn_image_root_dir: PathBuf, + package_image_root_dir: PathBuf, + shared_lib_root: PathBuf, + default_toolchain_dir: PathBuf, + default_bin_dir: PathBuf, + default_package_dir: PathBuf, + tmp_dir: PathBuf, + node_index_file: PathBuf, + node_index_expiry_file: PathBuf, + default_platform_file: PathBuf, + default_hooks_file: PathBuf, + layout_file: PathBuf, + root: PathBuf, +
}

Fields§

§cache_dir: PathBuf§node_cache_dir: PathBuf§shim_dir: PathBuf§log_dir: PathBuf§tools_dir: PathBuf§inventory_dir: PathBuf§node_inventory_dir: PathBuf§npm_inventory_dir: PathBuf§pnpm_inventory_dir: PathBuf§yarn_inventory_dir: PathBuf§image_dir: PathBuf§node_image_root_dir: PathBuf§npm_image_root_dir: PathBuf§pnpm_image_root_dir: PathBuf§yarn_image_root_dir: PathBuf§package_image_root_dir: PathBuf§shared_lib_root: PathBuf§default_toolchain_dir: PathBuf§default_bin_dir: PathBuf§default_package_dir: PathBuf§tmp_dir: PathBuf§node_index_file: PathBuf§node_index_expiry_file: PathBuf§default_platform_file: PathBuf§default_hooks_file: PathBuf§layout_file: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaHome

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaHome +layout, rooted at root.

+
source§

impl VoltaHome

source

pub fn cache_dir(&self) -> &Path

Returns the +cache_dir +path.

+
source

pub fn node_cache_dir(&self) -> &Path

Returns the +node_cache_dir +path.

+
source

pub fn shim_dir(&self) -> &Path

Returns the +shim_dir +path.

+
source

pub fn log_dir(&self) -> &Path

Returns the +log_dir +path.

+
source

pub fn tools_dir(&self) -> &Path

Returns the +tools_dir +path.

+
source

pub fn inventory_dir(&self) -> &Path

Returns the +inventory_dir +path.

+
source

pub fn node_inventory_dir(&self) -> &Path

Returns the +node_inventory_dir +path.

+
source

pub fn npm_inventory_dir(&self) -> &Path

Returns the +npm_inventory_dir +path.

+
source

pub fn pnpm_inventory_dir(&self) -> &Path

Returns the +pnpm_inventory_dir +path.

+
source

pub fn yarn_inventory_dir(&self) -> &Path

Returns the +yarn_inventory_dir +path.

+
source

pub fn image_dir(&self) -> &Path

Returns the +image_dir +path.

+
source

pub fn node_image_root_dir(&self) -> &Path

Returns the +node_image_root_dir +path.

+
source

pub fn npm_image_root_dir(&self) -> &Path

Returns the +npm_image_root_dir +path.

+
source

pub fn pnpm_image_root_dir(&self) -> &Path

Returns the +pnpm_image_root_dir +path.

+
source

pub fn yarn_image_root_dir(&self) -> &Path

Returns the +yarn_image_root_dir +path.

+
source

pub fn package_image_root_dir(&self) -> &Path

Returns the +package_image_root_dir +path.

+
source

pub fn shared_lib_root(&self) -> &Path

Returns the +shared_lib_root +path.

+
source

pub fn default_toolchain_dir(&self) -> &Path

Returns the +default_toolchain_dir +path.

+
source

pub fn default_bin_dir(&self) -> &Path

Returns the +default_bin_dir +path.

+
source

pub fn default_package_dir(&self) -> &Path

Returns the +default_package_dir +path.

+
source

pub fn tmp_dir(&self) -> &Path

Returns the +tmp_dir +path.

+
source

pub fn node_index_file(&self) -> &Path

Returns the +node_index_file +path.

+
source

pub fn node_index_expiry_file(&self) -> &Path

Returns the +node_index_expiry_file +path.

+
source

pub fn default_platform_file(&self) -> &Path

Returns the +default_platform_file +path.

+
source

pub fn default_hooks_file(&self) -> &Path

Returns the +default_hooks_file +path.

+
source

pub fn layout_file(&self) -> &Path

Returns the +layout_file +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaHome

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+
source§

impl VoltaHome

source

pub fn node_image_dir(&self, node: &str) -> PathBuf

source

pub fn npm_image_dir(&self, npm: &str) -> PathBuf

source

pub fn npm_image_bin_dir(&self, npm: &str) -> PathBuf

source

pub fn pnpm_image_dir(&self, version: &str) -> PathBuf

source

pub fn pnpm_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn package_image_dir(&self, name: &str) -> PathBuf

source

pub fn default_package_config_file(&self, package_name: &str) -> PathBuf

source

pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf

source

pub fn node_npm_version_file(&self, version: &str) -> PathBuf

source

pub fn shim_file(&self, toolname: &str) -> PathBuf

source

pub fn shared_lib_dir(&self, library: &str) -> PathBuf

source§

impl VoltaHome

source

pub fn node_image_bin_dir(&self, node: &str) -> PathBuf

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout/v4/index.html b/main/volta_layout/v4/index.html new file mode 100644 index 000000000..a52aaa856 --- /dev/null +++ b/main/volta_layout/v4/index.html @@ -0,0 +1 @@ +volta_layout::v4 - Rust
\ No newline at end of file diff --git a/main/volta_layout/v4/sidebar-items.js b/main/volta_layout/v4/sidebar-items.js new file mode 100644 index 000000000..540824009 --- /dev/null +++ b/main/volta_layout/v4/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["VoltaHome"]}; \ No newline at end of file diff --git a/main/volta_layout/v4/struct.VoltaHome.html b/main/volta_layout/v4/struct.VoltaHome.html new file mode 100644 index 000000000..71c1b91e1 --- /dev/null +++ b/main/volta_layout/v4/struct.VoltaHome.html @@ -0,0 +1,122 @@ +VoltaHome in volta_layout::v4 - Rust

Struct volta_layout::v4::VoltaHome

source ·
pub struct VoltaHome {
Show 27 fields + cache_dir: PathBuf, + node_cache_dir: PathBuf, + shim_dir: PathBuf, + log_dir: PathBuf, + tools_dir: PathBuf, + inventory_dir: PathBuf, + node_inventory_dir: PathBuf, + npm_inventory_dir: PathBuf, + pnpm_inventory_dir: PathBuf, + yarn_inventory_dir: PathBuf, + image_dir: PathBuf, + node_image_root_dir: PathBuf, + npm_image_root_dir: PathBuf, + pnpm_image_root_dir: PathBuf, + yarn_image_root_dir: PathBuf, + package_image_root_dir: PathBuf, + shared_lib_root: PathBuf, + default_toolchain_dir: PathBuf, + default_bin_dir: PathBuf, + default_package_dir: PathBuf, + tmp_dir: PathBuf, + node_index_file: PathBuf, + node_index_expiry_file: PathBuf, + default_platform_file: PathBuf, + default_hooks_file: PathBuf, + layout_file: PathBuf, + root: PathBuf, +
}

Fields§

§cache_dir: PathBuf§node_cache_dir: PathBuf§shim_dir: PathBuf§log_dir: PathBuf§tools_dir: PathBuf§inventory_dir: PathBuf§node_inventory_dir: PathBuf§npm_inventory_dir: PathBuf§pnpm_inventory_dir: PathBuf§yarn_inventory_dir: PathBuf§image_dir: PathBuf§node_image_root_dir: PathBuf§npm_image_root_dir: PathBuf§pnpm_image_root_dir: PathBuf§yarn_image_root_dir: PathBuf§package_image_root_dir: PathBuf§shared_lib_root: PathBuf§default_toolchain_dir: PathBuf§default_bin_dir: PathBuf§default_package_dir: PathBuf§tmp_dir: PathBuf§node_index_file: PathBuf§node_index_expiry_file: PathBuf§default_platform_file: PathBuf§default_hooks_file: PathBuf§layout_file: PathBuf§root: PathBuf

Implementations§

source§

impl VoltaHome

source

pub fn new(root: PathBuf) -> Self

Constructs a new instance of the +VoltaHome +layout, rooted at root.

+
source§

impl VoltaHome

source

pub fn cache_dir(&self) -> &Path

Returns the +cache_dir +path.

+
source

pub fn node_cache_dir(&self) -> &Path

Returns the +node_cache_dir +path.

+
source

pub fn shim_dir(&self) -> &Path

Returns the +shim_dir +path.

+
source

pub fn log_dir(&self) -> &Path

Returns the +log_dir +path.

+
source

pub fn tools_dir(&self) -> &Path

Returns the +tools_dir +path.

+
source

pub fn inventory_dir(&self) -> &Path

Returns the +inventory_dir +path.

+
source

pub fn node_inventory_dir(&self) -> &Path

Returns the +node_inventory_dir +path.

+
source

pub fn npm_inventory_dir(&self) -> &Path

Returns the +npm_inventory_dir +path.

+
source

pub fn pnpm_inventory_dir(&self) -> &Path

Returns the +pnpm_inventory_dir +path.

+
source

pub fn yarn_inventory_dir(&self) -> &Path

Returns the +yarn_inventory_dir +path.

+
source

pub fn image_dir(&self) -> &Path

Returns the +image_dir +path.

+
source

pub fn node_image_root_dir(&self) -> &Path

Returns the +node_image_root_dir +path.

+
source

pub fn npm_image_root_dir(&self) -> &Path

Returns the +npm_image_root_dir +path.

+
source

pub fn pnpm_image_root_dir(&self) -> &Path

Returns the +pnpm_image_root_dir +path.

+
source

pub fn yarn_image_root_dir(&self) -> &Path

Returns the +yarn_image_root_dir +path.

+
source

pub fn package_image_root_dir(&self) -> &Path

Returns the +package_image_root_dir +path.

+
source

pub fn shared_lib_root(&self) -> &Path

Returns the +shared_lib_root +path.

+
source

pub fn default_toolchain_dir(&self) -> &Path

Returns the +default_toolchain_dir +path.

+
source

pub fn default_bin_dir(&self) -> &Path

Returns the +default_bin_dir +path.

+
source

pub fn default_package_dir(&self) -> &Path

Returns the +default_package_dir +path.

+
source

pub fn tmp_dir(&self) -> &Path

Returns the +tmp_dir +path.

+
source

pub fn node_index_file(&self) -> &Path

Returns the +node_index_file +path.

+
source

pub fn node_index_expiry_file(&self) -> &Path

Returns the +node_index_expiry_file +path.

+
source

pub fn default_platform_file(&self) -> &Path

Returns the +default_platform_file +path.

+
source

pub fn default_hooks_file(&self) -> &Path

Returns the +default_hooks_file +path.

+
source

pub fn layout_file(&self) -> &Path

Returns the +layout_file +path.

+
source

pub fn root(&self) -> &Path

Returns the root path for this directory layout.

+
source§

impl VoltaHome

source

pub fn create(&self) -> Result<()>

Creates all subdirectories in this directory layout.

+
source§

impl VoltaHome

source

pub fn node_image_dir(&self, node: &str) -> PathBuf

source

pub fn npm_image_dir(&self, npm: &str) -> PathBuf

source

pub fn npm_image_bin_dir(&self, npm: &str) -> PathBuf

source

pub fn pnpm_image_dir(&self, version: &str) -> PathBuf

source

pub fn pnpm_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_dir(&self, version: &str) -> PathBuf

source

pub fn yarn_image_bin_dir(&self, version: &str) -> PathBuf

source

pub fn package_image_dir(&self, name: &str) -> PathBuf

source

pub fn default_package_config_file(&self, package_name: &str) -> PathBuf

source

pub fn default_tool_bin_config(&self, bin_name: &str) -> PathBuf

source

pub fn node_npm_version_file(&self, version: &str) -> PathBuf

source

pub fn shim_file(&self, toolname: &str) -> PathBuf

source

pub fn shared_lib_dir(&self, library: &str) -> PathBuf

source§

impl VoltaHome

source

pub fn node_image_bin_dir(&self, node: &str) -> PathBuf

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/all.html b/main/volta_layout_macro/all.html new file mode 100644 index 000000000..bd4c98909 --- /dev/null +++ b/main/volta_layout_macro/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/enum.EntryKind.html b/main/volta_layout_macro/ast/enum.EntryKind.html new file mode 100644 index 000000000..25990b163 --- /dev/null +++ b/main/volta_layout_macro/ast/enum.EntryKind.html @@ -0,0 +1,15 @@ +EntryKind in volta_layout_macro::ast - Rust
enum EntryKind {
+    Exe,
+    File,
+    Dir,
+}

Variants§

§

Exe

§

File

§

Dir

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/enum.FieldContents.html b/main/volta_layout_macro/ast/enum.FieldContents.html new file mode 100644 index 000000000..b734a1e47 --- /dev/null +++ b/main/volta_layout_macro/ast/enum.FieldContents.html @@ -0,0 +1,17 @@ +FieldContents in volta_layout_macro::ast - Rust
enum FieldContents {
+    File(Semi),
+    Dir(Directory),
+}
Expand description

AST for the suffix of a field in a layout! struct declaration.

+

Variants§

§

File(Semi)

A file field suffix, which consists of a single semicolon (;).

+
§

Dir(Directory)

A directory field suffix, which consists of a braced directory.

+

Trait Implementations§

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/index.html b/main/volta_layout_macro/ast/index.html new file mode 100644 index 000000000..9617422a3 --- /dev/null +++ b/main/volta_layout_macro/ast/index.html @@ -0,0 +1,3 @@ +volta_layout_macro::ast - Rust

Module volta_layout_macro::ast

source ·

Structs

  • Ast 🔒
    Abstract syntax tree (AST) for the surface syntax of the layout! macro.
  • Directory 🔒
    Represents a directory entry in the AST, which can recursively contain +more entries.
  • AST for the common prefix of a single field in a layout! struct declaration, +which is of the form:
  • Represents a single type LayoutStruct in the AST, which takes the form:

Enums

Type Aliases

\ No newline at end of file diff --git a/main/volta_layout_macro/ast/sidebar-items.js b/main/volta_layout_macro/ast/sidebar-items.js new file mode 100644 index 000000000..34e5476b0 --- /dev/null +++ b/main/volta_layout_macro/ast/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["EntryKind","FieldContents"],"struct":["Ast","Directory","FieldPrefix","LayoutStruct"],"type":["Result"]}; \ No newline at end of file diff --git a/main/volta_layout_macro/ast/struct.Ast.html b/main/volta_layout_macro/ast/struct.Ast.html new file mode 100644 index 000000000..8ce2f8dba --- /dev/null +++ b/main/volta_layout_macro/ast/struct.Ast.html @@ -0,0 +1,20 @@ +Ast in volta_layout_macro::ast - Rust

Struct volta_layout_macro::ast::Ast

source ·
pub(crate) struct Ast {
+    decls: Vec<LayoutStruct>,
+}
Expand description

Abstract syntax tree (AST) for the surface syntax of the layout! macro.

+

The surface syntax of the layout! macro takes the form:

+
Attribute* Visibility "struct" Ident Directory
+
+

This AST gets lowered by the flatten method to a vector of intermediate +representation (IR) trees. See the Ir type for details.

+

Fields§

§decls: Vec<LayoutStruct>

Implementations§

source§

impl Ast

source

pub(crate) fn compile(self) -> TokenStream

Compiles (macro-expands) the AST.

+

Trait Implementations§

source§

impl Parse for Ast

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

§

impl RefUnwindSafe for Ast

§

impl !Send for Ast

§

impl !Sync for Ast

§

impl Unpin for Ast

§

impl UnwindSafe for Ast

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/struct.Directory.html b/main/volta_layout_macro/ast/struct.Directory.html new file mode 100644 index 000000000..c6a66f303 --- /dev/null +++ b/main/volta_layout_macro/ast/struct.Directory.html @@ -0,0 +1,24 @@ +Directory in volta_layout_macro::ast - Rust
struct Directory {
+    entries: Punctuated<FieldPrefix, FieldContents>,
+}
Expand description

Represents a directory entry in the AST, which can recursively contain +more entries.

+

The surface syntax of a directory takes the form:

+
{
+    (FieldPrefix)FieldContents*
+}
+

Fields§

§entries: Punctuated<FieldPrefix, FieldContents>

Implementations§

source§

impl Directory

source

fn flatten( + self, + results: &mut Ir, + context: Vec<LitStr> +) -> Result<(), TokenStream>

Lowers the directory to a flattened intermediate representation.

+

Trait Implementations§

source§

impl Parse for Directory

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/struct.FieldPrefix.html b/main/volta_layout_macro/ast/struct.FieldPrefix.html new file mode 100644 index 000000000..aa2b2f89c --- /dev/null +++ b/main/volta_layout_macro/ast/struct.FieldPrefix.html @@ -0,0 +1,23 @@ +FieldPrefix in volta_layout_macro::ast - Rust
struct FieldPrefix {
+    filename: LitStr,
+    name: Ident,
+}
Expand description

AST for the common prefix of a single field in a layout! struct declaration, +which is of the form:

+
LitStr ":" Ident
+
+

This is followed either by a semicolon (;), indicating that the field is a +file, or a braced directory entry, indicating that the field is a directory.

+

If the LitStr contains the suffix "[.exe]" it is treated specially as an +executable file, whose suffix (or lack thereof) is determined by the current +operating system (using the std::env::consts::EXE_SUFFIX constant).

+

Fields§

§filename: LitStr§name: Ident

Trait Implementations§

source§

impl Parse for FieldPrefix

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/struct.LayoutStruct.html b/main/volta_layout_macro/ast/struct.LayoutStruct.html new file mode 100644 index 000000000..5f887807e --- /dev/null +++ b/main/volta_layout_macro/ast/struct.LayoutStruct.html @@ -0,0 +1,22 @@ +LayoutStruct in volta_layout_macro::ast - Rust
pub(crate) struct LayoutStruct {
+    attrs: Vec<Attribute>,
+    visibility: Visibility,
+    name: Ident,
+    directory: Directory,
+}
Expand description

Represents a single type LayoutStruct in the AST, which takes the form:

+
Attribute* Visibility "struct" Ident Directory
+
+

This AST gets lowered by the flatten method to a flat list of entries, +organized by entry type. See the Ir type for details.

+

Fields§

§attrs: Vec<Attribute>§visibility: Visibility§name: Ident§directory: Directory

Implementations§

source§

impl LayoutStruct

source

fn flatten(self) -> Result<Ir, TokenStream>

Lowers the AST to a flattened intermediate representation.

+

Trait Implementations§

Auto Trait Implementations§

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ast/type.Result.html b/main/volta_layout_macro/ast/type.Result.html new file mode 100644 index 000000000..985f9a074 --- /dev/null +++ b/main/volta_layout_macro/ast/type.Result.html @@ -0,0 +1,6 @@ +Result in volta_layout_macro::ast - Rust

Type Alias volta_layout_macro::ast::Result

source ·
pub(crate) type Result<T> = Result<T, TokenStream>;

Aliased Type§

enum Result<T> {
+    Ok(T),
+    Err(TokenStream),
+}

Variants§

§1.0.0

Ok(T)

Contains the success value

+
§1.0.0

Err(TokenStream)

Contains the error value

+
\ No newline at end of file diff --git a/main/volta_layout_macro/index.html b/main/volta_layout_macro/index.html new file mode 100644 index 000000000..cb4eefc17 --- /dev/null +++ b/main/volta_layout_macro/index.html @@ -0,0 +1,2 @@ +volta_layout_macro - Rust

Modules

Macros

  • A macro for defining Volta directory layout hierarchies.
\ No newline at end of file diff --git a/main/volta_layout_macro/ir/index.html b/main/volta_layout_macro/ir/index.html new file mode 100644 index 000000000..0738eb76f --- /dev/null +++ b/main/volta_layout_macro/ir/index.html @@ -0,0 +1,3 @@ +volta_layout_macro::ir - Rust

Module volta_layout_macro::ir

source ·

Structs

  • Entry 🔒
  • Ir 🔒
    The intermediate representation (IR) of a struct type defined by the layout! +macro, which contains the flattened directory entries, organized into three +categories:
\ No newline at end of file diff --git a/main/volta_layout_macro/ir/sidebar-items.js b/main/volta_layout_macro/ir/sidebar-items.js new file mode 100644 index 000000000..467bc257c --- /dev/null +++ b/main/volta_layout_macro/ir/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Entry","Ir"]}; \ No newline at end of file diff --git a/main/volta_layout_macro/ir/struct.Entry.html b/main/volta_layout_macro/ir/struct.Entry.html new file mode 100644 index 000000000..bd8389638 --- /dev/null +++ b/main/volta_layout_macro/ir/struct.Entry.html @@ -0,0 +1,15 @@ +Entry in volta_layout_macro::ir - Rust
pub(crate) struct Entry {
+    pub(crate) name: Ident,
+    pub(crate) context: Vec<LitStr>,
+    pub(crate) filename: LitStr,
+}

Fields§

§name: Ident§context: Vec<LitStr>§filename: LitStr

Implementations§

Auto Trait Implementations§

§

impl RefUnwindSafe for Entry

§

impl !Send for Entry

§

impl !Sync for Entry

§

impl Unpin for Entry

§

impl UnwindSafe for Entry

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/ir/struct.Ir.html b/main/volta_layout_macro/ir/struct.Ir.html new file mode 100644 index 000000000..1c5de14eb --- /dev/null +++ b/main/volta_layout_macro/ir/struct.Ir.html @@ -0,0 +1,26 @@ +Ir in volta_layout_macro::ir - Rust

Struct volta_layout_macro::ir::Ir

source ·
pub(crate) struct Ir {
+    pub(crate) name: Ident,
+    pub(crate) attrs: Vec<Attribute>,
+    pub(crate) visibility: Visibility,
+    pub(crate) dirs: Vec<Entry>,
+    pub(crate) files: Vec<Entry>,
+    pub(crate) exes: Vec<Entry>,
+}
Expand description

The intermediate representation (IR) of a struct type defined by the layout! +macro, which contains the flattened directory entries, organized into three +categories:

+
    +
  • Directories
  • +
  • Executable files
  • +
  • Other files
  • +
+

Fields§

§name: Ident§attrs: Vec<Attribute>§visibility: Visibility§dirs: Vec<Entry>§files: Vec<Entry>§exes: Vec<Entry>

Implementations§

source§

impl Ir

source

fn dir_names(&self) -> impl Iterator<Item = &Ident>

source

fn file_names(&self) -> impl Iterator<Item = &Ident>

source

fn exe_names(&self) -> impl Iterator<Item = &Ident>

source

fn field_names(&self) -> impl Iterator<Item = &Ident>

source

fn to_struct_decl(&self) -> TokenStream

source

fn to_create_method(&self) -> TokenStream

source

fn to_item_methods(&self) -> TokenStream

source

fn to_ctor(&self) -> TokenStream

source

pub(crate) fn codegen(&self) -> TokenStream

Auto Trait Implementations§

§

impl RefUnwindSafe for Ir

§

impl !Send for Ir

§

impl !Sync for Ir

§

impl Unpin for Ir

§

impl UnwindSafe for Ir

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, 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.
\ No newline at end of file diff --git a/main/volta_layout_macro/macro.layout!.html b/main/volta_layout_macro/macro.layout!.html new file mode 100644 index 000000000..4cd70973a --- /dev/null +++ b/main/volta_layout_macro/macro.layout!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.layout.html...

+ + + \ No newline at end of file diff --git a/main/volta_layout_macro/macro.layout.html b/main/volta_layout_macro/macro.layout.html new file mode 100644 index 000000000..9a06cbd99 --- /dev/null +++ b/main/volta_layout_macro/macro.layout.html @@ -0,0 +1,23 @@ +layout in volta_layout_macro - Rust
layout!() { /* proc-macro */ }
Expand description

A macro for defining Volta directory layout hierarchies.

+

The syntax of layout! takes the form:

+
layout! {
+    LayoutStruct*
+}
+
+

The syntax of a LayoutStruct takes the form:

+
Attribute* Visibility "struct" Ident Directory
+
+

The syntax of a Directory takes the form:

+
{
+    (FieldPrefix)FieldContents*
+}
+
+

The syntax of a FieldPrefix takes the form:

+
LitStr ":" Ident
+
+

The syntax of a FieldContents is either:

+
";"
+
+

or:

+
Directory
+
\ No newline at end of file diff --git a/main/volta_layout_macro/sidebar-items.js b/main/volta_layout_macro/sidebar-items.js new file mode 100644 index 000000000..d5af67d38 --- /dev/null +++ b/main/volta_layout_macro/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"macro":["layout"],"mod":["ast","ir"]}; \ No newline at end of file diff --git a/main/volta_migrate/all.html b/main/volta_migrate/all.html new file mode 100644 index 000000000..1ba65cdd9 --- /dev/null +++ b/main/volta_migrate/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Functions

\ No newline at end of file diff --git a/main/volta_migrate/detect/fn.v1.html b/main/volta_migrate/detect/fn.v1.html new file mode 100644 index 000000000..dcd45f4e9 --- /dev/null +++ b/main/volta_migrate/detect/fn.v1.html @@ -0,0 +1 @@ +v1 in volta_migrate::detect - Rust

Function volta_migrate::detect::v1

source ·
pub(crate) fn v1(home: &Path) -> Option<MigrationState>
\ No newline at end of file diff --git a/main/volta_migrate/detect/fn.v2.html b/main/volta_migrate/detect/fn.v2.html new file mode 100644 index 000000000..e6ba8318b --- /dev/null +++ b/main/volta_migrate/detect/fn.v2.html @@ -0,0 +1 @@ +v2 in volta_migrate::detect - Rust

Function volta_migrate::detect::v2

source ·
pub(crate) fn v2(home: &Path) -> Option<MigrationState>
\ No newline at end of file diff --git a/main/volta_migrate/detect/fn.v3.html b/main/volta_migrate/detect/fn.v3.html new file mode 100644 index 000000000..fa572d63f --- /dev/null +++ b/main/volta_migrate/detect/fn.v3.html @@ -0,0 +1 @@ +v3 in volta_migrate::detect - Rust

Function volta_migrate::detect::v3

source ·
pub(crate) fn v3(home: &Path) -> Option<MigrationState>
\ No newline at end of file diff --git a/main/volta_migrate/detect/fn.v4.html b/main/volta_migrate/detect/fn.v4.html new file mode 100644 index 000000000..89a1a02c4 --- /dev/null +++ b/main/volta_migrate/detect/fn.v4.html @@ -0,0 +1 @@ +v4 in volta_migrate::detect - Rust

Function volta_migrate::detect::v4

source ·
pub(crate) fn v4(home: &Path) -> Option<MigrationState>
\ No newline at end of file diff --git a/main/volta_migrate/detect/index.html b/main/volta_migrate/detect/index.html new file mode 100644 index 000000000..d92b5c45c --- /dev/null +++ b/main/volta_migrate/detect/index.html @@ -0,0 +1 @@ +volta_migrate::detect - Rust

Module volta_migrate::detect

source ·

Functions

\ No newline at end of file diff --git a/main/volta_migrate/detect/sidebar-items.js b/main/volta_migrate/detect/sidebar-items.js new file mode 100644 index 000000000..2f59a0564 --- /dev/null +++ b/main/volta_migrate/detect/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["v1","v2","v3","v4"]}; \ No newline at end of file diff --git a/main/volta_migrate/empty/index.html b/main/volta_migrate/empty/index.html new file mode 100644 index 000000000..210a55bcf --- /dev/null +++ b/main/volta_migrate/empty/index.html @@ -0,0 +1 @@ +volta_migrate::empty - Rust

Module volta_migrate::empty

source ·

Structs

  • Represents an Empty (or uninitialized) Volta layout, one that has never been used by any prior version
\ No newline at end of file diff --git a/main/volta_migrate/empty/sidebar-items.js b/main/volta_migrate/empty/sidebar-items.js new file mode 100644 index 000000000..d46620987 --- /dev/null +++ b/main/volta_migrate/empty/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Empty"]}; \ No newline at end of file diff --git a/main/volta_migrate/empty/struct.Empty.html b/main/volta_migrate/empty/struct.Empty.html new file mode 100644 index 000000000..822f72f74 --- /dev/null +++ b/main/volta_migrate/empty/struct.Empty.html @@ -0,0 +1,17 @@ +Empty in volta_migrate::empty - Rust

Struct volta_migrate::empty::Empty

source ·
pub struct Empty {
+    pub home: PathBuf,
+}
Expand description

Represents an Empty (or uninitialized) Volta layout, one that has never been used by any prior version

+

This is the easiest to migrate from, as we simply need to create the current layout within the .volta +directory

+

Fields§

§home: PathBuf

Implementations§

source§

impl Empty

source

pub fn new(home: PathBuf) -> Self

Trait Implementations§

source§

impl TryFrom<Empty> for V1

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<V1>

Performs the conversion.
source§

impl TryFrom<Empty> for V2

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<V2>

Performs the conversion.
source§

impl TryFrom<Empty> for V3

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<Self>

Performs the conversion.
source§

impl TryFrom<Empty> for V4

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<V4>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for Empty

§

impl Send for Empty

§

impl Sync for Empty

§

impl Unpin for Empty

§

impl UnwindSafe for Empty

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_migrate/enum.MigrationState.html b/main/volta_migrate/enum.MigrationState.html new file mode 100644 index 000000000..93c361b8e --- /dev/null +++ b/main/volta_migrate/enum.MigrationState.html @@ -0,0 +1,22 @@ +MigrationState in volta_migrate - Rust
pub(crate) enum MigrationState {
+    Empty(Empty),
+    V0(Box<V0>),
+    V1(Box<V1>),
+    V2(Box<V2>),
+    V3(Box<V3>),
+    V4(Box<V4>),
+}
Expand description

Represents the state of the Volta directory at every point in the migration process

+

Migrations should be applied sequentially, migrating from V0 to V1 to … as needed, cycling +through the possible MigrationState values.

+

Variants§

§

Empty(Empty)

§

V0(Box<V0>)

§

V1(Box<V1>)

§

V2(Box<V2>)

§

V3(Box<V3>)

§

V4(Box<V4>)

Implementations§

source§

impl MigrationState

source

pub(crate) fn detect_tagged_state(home: &Path) -> Option<Self>

source§

impl MigrationState

source

pub(crate) fn current() -> Fallible<Self>

source

pub(crate) fn detect_legacy_state(home: &Path) -> Fallible<Self>

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_migrate/fn.detect_and_migrate.html b/main/volta_migrate/fn.detect_and_migrate.html new file mode 100644 index 000000000..f5e7e419e --- /dev/null +++ b/main/volta_migrate/fn.detect_and_migrate.html @@ -0,0 +1 @@ +detect_and_migrate in volta_migrate - Rust
pub(crate) fn detect_and_migrate() -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_migrate/fn.main.html b/main/volta_migrate/fn.main.html new file mode 100644 index 000000000..5e4e6c9ce --- /dev/null +++ b/main/volta_migrate/fn.main.html @@ -0,0 +1 @@ +main in volta_migrate - Rust

Function volta_migrate::main

source ·
pub fn main()
\ No newline at end of file diff --git a/main/volta_migrate/fn.run_migration.html b/main/volta_migrate/fn.run_migration.html new file mode 100644 index 000000000..4dd669045 --- /dev/null +++ b/main/volta_migrate/fn.run_migration.html @@ -0,0 +1 @@ +run_migration in volta_migrate - Rust
pub fn run_migration() -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_migrate/index.html b/main/volta_migrate/index.html new file mode 100644 index 000000000..3104a0924 --- /dev/null +++ b/main/volta_migrate/index.html @@ -0,0 +1,2 @@ +volta_migrate - Rust
\ No newline at end of file diff --git a/main/volta_migrate/macro.detect_tagged!.html b/main/volta_migrate/macro.detect_tagged!.html new file mode 100644 index 000000000..857dc5ae7 --- /dev/null +++ b/main/volta_migrate/macro.detect_tagged!.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to macro.detect_tagged.html...

+ + + \ No newline at end of file diff --git a/main/volta_migrate/macro.detect_tagged.html b/main/volta_migrate/macro.detect_tagged.html new file mode 100644 index 000000000..0b6d16c6b --- /dev/null +++ b/main/volta_migrate/macro.detect_tagged.html @@ -0,0 +1,12 @@ +detect_tagged in volta_migrate - Rust
macro_rules! detect_tagged {
+    ($(($layout:ident, $variant:ident, $migration:ident)),*) => { ... };
+}
Expand description

Macro to simplify the boilerplate associated with detecting a tagged state.

+

Should be passed a series of tuples, each of which contains (in this order):

+
    +
  • The layout version (module name from volta_layout crate, e.g. v1)
  • +
  • The MigrationState variant name (e.g. V1)
  • +
  • The migration object itself (e.g. V1 from the v1 module in this crate)
  • +
+

The tuples should be in reverse chronological order, so that the newest is first, e.g.:

+

detect_tagged!((v3, V3, V3), (v2, V2, V2), (v1, V1, V1));

+
\ No newline at end of file diff --git a/main/volta_migrate/sidebar-items.js b/main/volta_migrate/sidebar-items.js new file mode 100644 index 000000000..9b556a055 --- /dev/null +++ b/main/volta_migrate/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["main"]}; \ No newline at end of file diff --git a/main/volta_migrate/v0/index.html b/main/volta_migrate/v0/index.html new file mode 100644 index 000000000..0e80c4344 --- /dev/null +++ b/main/volta_migrate/v0/index.html @@ -0,0 +1 @@ +volta_migrate::v0 - Rust

Module volta_migrate::v0

source ·

Structs

  • Represents a V0 Volta layout (from before v0.7.0)
\ No newline at end of file diff --git a/main/volta_migrate/v0/sidebar-items.js b/main/volta_migrate/v0/sidebar-items.js new file mode 100644 index 000000000..72c86f658 --- /dev/null +++ b/main/volta_migrate/v0/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["V0"]}; \ No newline at end of file diff --git a/main/volta_migrate/v0/struct.V0.html b/main/volta_migrate/v0/struct.V0.html new file mode 100644 index 000000000..18dca071b --- /dev/null +++ b/main/volta_migrate/v0/struct.V0.html @@ -0,0 +1,17 @@ +V0 in volta_migrate::v0 - Rust

Struct volta_migrate::v0::V0

source ·
pub struct V0 {
+    pub home: VoltaHome,
+}
Expand description

Represents a V0 Volta layout (from before v0.7.0)

+

This needs some migration work to move up to V1, so we keep a reference to the V0 layout +struct to allow for easy comparison between versions

+

Fields§

§home: VoltaHome

Implementations§

source§

impl V0

source

pub fn new(home: PathBuf) -> Self

Trait Implementations§

source§

impl TryFrom<V0> for V1

§

type Error = VoltaError

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

fn try_from(old: V0) -> Fallible<V1>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for V0

§

impl Send for V0

§

impl Sync for V0

§

impl Unpin for V0

§

impl UnwindSafe for V0

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_migrate/v1/index.html b/main/volta_migrate/v1/index.html new file mode 100644 index 000000000..649c5cbcd --- /dev/null +++ b/main/volta_migrate/v1/index.html @@ -0,0 +1 @@ +volta_migrate::v1 - Rust

Module volta_migrate::v1

source ·

Structs

  • Represents a V1 Volta Layout (used by Volta v0.7.0 - v0.7.2)
\ No newline at end of file diff --git a/main/volta_migrate/v1/sidebar-items.js b/main/volta_migrate/v1/sidebar-items.js new file mode 100644 index 000000000..e111c1751 --- /dev/null +++ b/main/volta_migrate/v1/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["V1"]}; \ No newline at end of file diff --git a/main/volta_migrate/v1/struct.V1.html b/main/volta_migrate/v1/struct.V1.html new file mode 100644 index 000000000..f3f93a179 --- /dev/null +++ b/main/volta_migrate/v1/struct.V1.html @@ -0,0 +1,19 @@ +V1 in volta_migrate::v1 - Rust

Struct volta_migrate::v1::V1

source ·
pub struct V1 {
+    pub home: VoltaHome,
+}
Expand description

Represents a V1 Volta Layout (used by Volta v0.7.0 - v0.7.2)

+

Holds a reference to the V1 layout struct to support potential future migrations

+

Fields§

§home: VoltaHome

Implementations§

source§

impl V1

source

pub fn new(home: PathBuf) -> Self

source

fn complete_migration(home: VoltaHome) -> Fallible<Self>

Write the layout file to mark migration to V1 as complete

+

Should only be called once all other migration steps are finished, so that we don’t +accidentally mark an incomplete migration as completed

+

Trait Implementations§

source§

impl TryFrom<Empty> for V1

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<V1>

Performs the conversion.
source§

impl TryFrom<V0> for V1

§

type Error = VoltaError

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

fn try_from(old: V0) -> Fallible<V1>

Performs the conversion.
source§

impl TryFrom<V1> for V2

§

type Error = VoltaError

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

fn try_from(old: V1) -> Fallible<V2>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for V1

§

impl Send for V1

§

impl Sync for V1

§

impl Unpin for V1

§

impl UnwindSafe for V1

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_migrate/v2/fn.clear_default_npm.html b/main/volta_migrate/v2/fn.clear_default_npm.html new file mode 100644 index 000000000..44db581f0 --- /dev/null +++ b/main/volta_migrate/v2/fn.clear_default_npm.html @@ -0,0 +1,4 @@ +clear_default_npm in volta_migrate::v2 - Rust
fn clear_default_npm(platform_file: &Path) -> Fallible<()>
Expand description

Clear npm from the default platform.json file if it is set to the same value as that bundled with Node

+

This will ensure that we don’t treat the default npm from a prior version of Volta as a “custom” npm that +the user explicitly requested

+
\ No newline at end of file diff --git a/main/volta_migrate/v2/fn.remove_npm_version_from_node_image_dir.html b/main/volta_migrate/v2/fn.remove_npm_version_from_node_image_dir.html new file mode 100644 index 000000000..fff5c4566 --- /dev/null +++ b/main/volta_migrate/v2/fn.remove_npm_version_from_node_image_dir.html @@ -0,0 +1,7 @@ +remove_npm_version_from_node_image_dir in volta_migrate::v2 - Rust
fn remove_npm_version_from_node_image_dir(
+    old_home: &VoltaHome,
+    new_home: &VoltaHome,
+    node_version: Version,
+    temp_dir: &Path
+) -> Fallible<()>
Expand description

Move a single node image up a directory, if it currently has the npm version in its path

+
\ No newline at end of file diff --git a/main/volta_migrate/v2/fn.shift_node_images.html b/main/volta_migrate/v2/fn.shift_node_images.html new file mode 100644 index 000000000..a5cafbcf2 --- /dev/null +++ b/main/volta_migrate/v2/fn.shift_node_images.html @@ -0,0 +1,6 @@ +shift_node_images in volta_migrate::v2 - Rust
fn shift_node_images(old_home: &VoltaHome, new_home: &VoltaHome) -> Fallible<()>
Expand description

Move all Node images up one directory, removing the default npm version directory

+

In the V1 layout, we kept all node images in /<node_version>/<npm_version>/, however we will be +storing custom npm versions in a separate image directory, so there is no need to maintain the +bundled npm version in the file structure any more. This also will make it slightly easier to access +the Node image, as we no longer will need to look up the bundled npm version every time.

+
\ No newline at end of file diff --git a/main/volta_migrate/v2/index.html b/main/volta_migrate/v2/index.html new file mode 100644 index 000000000..5a6a9c2a4 --- /dev/null +++ b/main/volta_migrate/v2/index.html @@ -0,0 +1 @@ +volta_migrate::v2 - Rust

Module volta_migrate::v2

source ·

Structs

  • Represents a V2 Volta Layout (used by Volta v0.7.3 and above)

Functions

  • Clear npm from the default platform.json file if it is set to the same value as that bundled with Node
  • Move a single node image up a directory, if it currently has the npm version in its path
  • Move all Node images up one directory, removing the default npm version directory
\ No newline at end of file diff --git a/main/volta_migrate/v2/sidebar-items.js b/main/volta_migrate/v2/sidebar-items.js new file mode 100644 index 000000000..e2a5e0021 --- /dev/null +++ b/main/volta_migrate/v2/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["clear_default_npm","remove_npm_version_from_node_image_dir","shift_node_images"],"struct":["V2"]}; \ No newline at end of file diff --git a/main/volta_migrate/v2/struct.V2.html b/main/volta_migrate/v2/struct.V2.html new file mode 100644 index 000000000..f532a8412 --- /dev/null +++ b/main/volta_migrate/v2/struct.V2.html @@ -0,0 +1,19 @@ +V2 in volta_migrate::v2 - Rust

Struct volta_migrate::v2::V2

source ·
pub struct V2 {
+    pub home: VoltaHome,
+}
Expand description

Represents a V2 Volta Layout (used by Volta v0.7.3 and above)

+

Holds a reference to the V2 layout struct to support potential future migrations

+

Fields§

§home: VoltaHome

Implementations§

source§

impl V2

source

pub fn new(home: PathBuf) -> Self

source

fn complete_migration(home: VoltaHome) -> Fallible<Self>

Write the layout file to mark migration to V2 as complete

+

Should only be called once all other migration steps are finished, so that we don’t +accidentally mark an incomplete migration as completed

+

Trait Implementations§

source§

impl TryFrom<Empty> for V2

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<V2>

Performs the conversion.
source§

impl TryFrom<V1> for V2

§

type Error = VoltaError

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

fn try_from(old: V1) -> Fallible<V2>

Performs the conversion.
source§

impl TryFrom<V2> for V3

§

type Error = VoltaError

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

fn try_from(old: V2) -> Fallible<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for V2

§

impl Send for V2

§

impl Sync for V2

§

impl Unpin for V2

§

impl UnwindSafe for V2

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_migrate/v3/config/index.html b/main/volta_migrate/v3/config/index.html new file mode 100644 index 000000000..b421ded40 --- /dev/null +++ b/main/volta_migrate/v3/config/index.html @@ -0,0 +1 @@ +volta_migrate::v3::config - Rust
\ No newline at end of file diff --git a/main/volta_migrate/v3/config/sidebar-items.js b/main/volta_migrate/v3/config/sidebar-items.js new file mode 100644 index 000000000..4d6057a73 --- /dev/null +++ b/main/volta_migrate/v3/config/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["LegacyPackageConfig","LegacyPlatform","NodeVersion"]}; \ No newline at end of file diff --git a/main/volta_migrate/v3/config/struct.LegacyPackageConfig.html b/main/volta_migrate/v3/config/struct.LegacyPackageConfig.html new file mode 100644 index 000000000..5ad1c47e8 --- /dev/null +++ b/main/volta_migrate/v3/config/struct.LegacyPackageConfig.html @@ -0,0 +1,19 @@ +LegacyPackageConfig in volta_migrate::v3::config - Rust
pub struct LegacyPackageConfig {
+    pub name: String,
+    pub version: Version,
+    pub platform: LegacyPlatform,
+    pub bins: Vec<String>,
+}

Fields§

§name: String§version: Version§platform: LegacyPlatform§bins: Vec<String>

Implementations§

source§

impl LegacyPackageConfig

source

pub fn from_file(config_file: &Path) -> Option<Self>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for LegacyPackageConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_migrate/v3/config/struct.LegacyPlatform.html b/main/volta_migrate/v3/config/struct.LegacyPlatform.html new file mode 100644 index 000000000..6d690caf4 --- /dev/null +++ b/main/volta_migrate/v3/config/struct.LegacyPlatform.html @@ -0,0 +1,17 @@ +LegacyPlatform in volta_migrate::v3::config - Rust
pub struct LegacyPlatform {
+    pub node: NodeVersion,
+    pub yarn: Option<Version>,
+}

Fields§

§node: NodeVersion§yarn: Option<Version>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for LegacyPlatform

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<LegacyPlatform> for PlatformSpec

source§

fn from(config_platform: LegacyPlatform) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_migrate/v3/config/struct.NodeVersion.html b/main/volta_migrate/v3/config/struct.NodeVersion.html new file mode 100644 index 000000000..20692e9dc --- /dev/null +++ b/main/volta_migrate/v3/config/struct.NodeVersion.html @@ -0,0 +1,17 @@ +NodeVersion in volta_migrate::v3::config - Rust
pub struct NodeVersion {
+    pub runtime: Version,
+    pub npm: Option<Version>,
+}

Fields§

§runtime: Version§npm: Option<Version>

Trait Implementations§

source§

impl<'de> Deserialize<'de> for NodeVersion

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere + T: for<'de> Deserialize<'de>,

\ No newline at end of file diff --git a/main/volta_migrate/v3/fn.get_installed_packages.html b/main/volta_migrate/v3/fn.get_installed_packages.html new file mode 100644 index 000000000..55e67ace4 --- /dev/null +++ b/main/volta_migrate/v3/fn.get_installed_packages.html @@ -0,0 +1,2 @@ +get_installed_packages in volta_migrate::v3 - Rust
fn get_installed_packages(old_home: &VoltaHome) -> Vec<LegacyPackageConfig>
Expand description

Determine a list of all installed packages that are using the legacy package config

+
\ No newline at end of file diff --git a/main/volta_migrate/v3/fn.is_migrated_config.html b/main/volta_migrate/v3/fn.is_migrated_config.html new file mode 100644 index 000000000..1fe4a771d --- /dev/null +++ b/main/volta_migrate/v3/fn.is_migrated_config.html @@ -0,0 +1,2 @@ +is_migrated_config in volta_migrate::v3 - Rust
fn is_migrated_config(config_path: &Path) -> bool
Expand description

Determine if a package has already been migrated by attempting to read the V3 PackageConfig

+
\ No newline at end of file diff --git a/main/volta_migrate/v3/fn.migrate_packages.html b/main/volta_migrate/v3/fn.migrate_packages.html new file mode 100644 index 000000000..8b20927f6 --- /dev/null +++ b/main/volta_migrate/v3/fn.migrate_packages.html @@ -0,0 +1 @@ +migrate_packages in volta_migrate::v3 - Rust
fn migrate_packages(old_home: &VoltaHome) -> Fallible<()>
\ No newline at end of file diff --git a/main/volta_migrate/v3/fn.migrate_single_package.html b/main/volta_migrate/v3/fn.migrate_single_package.html new file mode 100644 index 000000000..4d3dedd5e --- /dev/null +++ b/main/volta_migrate/v3/fn.migrate_single_package.html @@ -0,0 +1,14 @@ +migrate_single_package in volta_migrate::v3 - Rust
fn migrate_single_package(
+    config: LegacyPackageConfig,
+    session: &mut Session
+) -> Fallible<()>
Expand description

Migrate a single package to the new workflow

+

Note: This relies on the package install logic in volta_core. If that logic changes, then +the end result may not be a valid V3 layout any more, and this migration will need to be +updated. Specifically, the invariants we rely on are:

+
    +
  • Package image directory is in the same location
  • +
  • Package config files are in the same location and the same format
  • +
  • Binary config files are in the same location and the same format
  • +
+

If any of those are violated, this migration may be invalid and need to be reworked / scrapped

+
\ No newline at end of file diff --git a/main/volta_migrate/v3/index.html b/main/volta_migrate/v3/index.html new file mode 100644 index 000000000..20e2c63ca --- /dev/null +++ b/main/volta_migrate/v3/index.html @@ -0,0 +1 @@ +volta_migrate::v3 - Rust

Module volta_migrate::v3

source ·

Modules

Structs

  • Represents a V3 Volta layout (used by Volta v0.9.0 and above)

Functions

\ No newline at end of file diff --git a/main/volta_migrate/v3/sidebar-items.js b/main/volta_migrate/v3/sidebar-items.js new file mode 100644 index 000000000..a6d826efb --- /dev/null +++ b/main/volta_migrate/v3/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["get_installed_packages","is_migrated_config","migrate_packages","migrate_single_package"],"mod":["config"],"struct":["V3"]}; \ No newline at end of file diff --git a/main/volta_migrate/v3/struct.V3.html b/main/volta_migrate/v3/struct.V3.html new file mode 100644 index 000000000..fec1e28ab --- /dev/null +++ b/main/volta_migrate/v3/struct.V3.html @@ -0,0 +1,19 @@ +V3 in volta_migrate::v3 - Rust

Struct volta_migrate::v3::V3

source ·
pub struct V3 {
+    pub home: VoltaHome,
+}
Expand description

Represents a V3 Volta layout (used by Volta v0.9.0 and above)

+

Holds a reference to the V3 layout struct to support future migrations

+

Fields§

§home: VoltaHome

Implementations§

source§

impl V3

source

pub fn new(home: PathBuf) -> Self

source

fn complete_migration(home: VoltaHome) -> Fallible<Self>

Write the layout file to mark migration to V2 as complete

+

Should only be called once all other migration steps are finished, so that we don’t +accidentally mark an incomplete migration as completed

+

Trait Implementations§

source§

impl TryFrom<Empty> for V3

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<Self>

Performs the conversion.
source§

impl TryFrom<V2> for V3

§

type Error = VoltaError

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

fn try_from(old: V2) -> Fallible<Self>

Performs the conversion.
source§

impl TryFrom<V3> for V4

§

type Error = VoltaError

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

fn try_from(old: V3) -> Fallible<V4>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for V3

§

impl Send for V3

§

impl Sync for V3

§

impl Unpin for V3

§

impl UnwindSafe for V3

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_migrate/v4/index.html b/main/volta_migrate/v4/index.html new file mode 100644 index 000000000..28d5338b7 --- /dev/null +++ b/main/volta_migrate/v4/index.html @@ -0,0 +1 @@ +volta_migrate::v4 - Rust

Module volta_migrate::v4

source ·

Structs

  • Represents a V4 Volta Layout (used by Volta v2.0.0 and above)
\ No newline at end of file diff --git a/main/volta_migrate/v4/sidebar-items.js b/main/volta_migrate/v4/sidebar-items.js new file mode 100644 index 000000000..b60624f98 --- /dev/null +++ b/main/volta_migrate/v4/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["V4"]}; \ No newline at end of file diff --git a/main/volta_migrate/v4/struct.V4.html b/main/volta_migrate/v4/struct.V4.html new file mode 100644 index 000000000..f1c45bee9 --- /dev/null +++ b/main/volta_migrate/v4/struct.V4.html @@ -0,0 +1,19 @@ +V4 in volta_migrate::v4 - Rust

Struct volta_migrate::v4::V4

source ·
pub struct V4 {
+    pub home: VoltaHome,
+}
Expand description

Represents a V4 Volta Layout (used by Volta v2.0.0 and above)

+

Holds a reference to the V4 layout struct to support potential future migrations

+

Fields§

§home: VoltaHome

Implementations§

source§

impl V4

source

pub fn new(home: PathBuf) -> Self

source

fn complete_migration(home: VoltaHome) -> Fallible<Self>

Write the layout file to mark migration to V4 as complete

+

Should only be called once all other migration steps are finished, so that we don’t +accidentally mark an incomplete migration as completed

+

Trait Implementations§

source§

impl TryFrom<Empty> for V4

§

type Error = VoltaError

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

fn try_from(old: Empty) -> Fallible<V4>

Performs the conversion.
source§

impl TryFrom<V3> for V4

§

type Error = VoltaError

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

fn try_from(old: V3) -> Fallible<V4>

Performs the conversion.

Auto Trait Implementations§

§

impl RefUnwindSafe for V4

§

impl Send for V4

§

impl Sync for V4

§

impl Unpin for V4

§

impl UnwindSafe for V4

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_shim/all.html b/main/volta_shim/all.html new file mode 100644 index 000000000..6a0df3a93 --- /dev/null +++ b/main/volta_shim/all.html @@ -0,0 +1 @@ +List of all items in this crate
\ No newline at end of file diff --git a/main/volta_shim/common/enum.Error.html b/main/volta_shim/common/enum.Error.html new file mode 100644 index 000000000..dd0d6c322 --- /dev/null +++ b/main/volta_shim/common/enum.Error.html @@ -0,0 +1,15 @@ +Error in volta_shim::common - Rust

Enum volta_shim::common::Error

source ·
pub enum Error {
+    Volta(VoltaError),
+    Tool(i32),
+}

Variants§

§

Volta(VoltaError)

§

Tool(i32)

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !Send for Error

§

impl !Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

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> Same for T

§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for Twhere + V: MultiLane<T>,

§

fn vzip(self) -> V

\ No newline at end of file diff --git a/main/volta_shim/common/fn.ensure_layout.html b/main/volta_shim/common/fn.ensure_layout.html new file mode 100644 index 000000000..7471859ea --- /dev/null +++ b/main/volta_shim/common/fn.ensure_layout.html @@ -0,0 +1 @@ +ensure_layout in volta_shim::common - Rust
pub fn ensure_layout() -> Result<(), Error>
\ No newline at end of file diff --git a/main/volta_shim/common/index.html b/main/volta_shim/common/index.html new file mode 100644 index 000000000..655d3da95 --- /dev/null +++ b/main/volta_shim/common/index.html @@ -0,0 +1 @@ +volta_shim::common - Rust
\ No newline at end of file diff --git a/main/volta_shim/common/sidebar-items.js b/main/volta_shim/common/sidebar-items.js new file mode 100644 index 000000000..d8d09d593 --- /dev/null +++ b/main/volta_shim/common/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["Error"],"fn":["ensure_layout"],"trait":["IntoResult"]}; \ No newline at end of file diff --git a/main/volta_shim/common/trait.IntoResult.html b/main/volta_shim/common/trait.IntoResult.html new file mode 100644 index 000000000..1c9923dbd --- /dev/null +++ b/main/volta_shim/common/trait.IntoResult.html @@ -0,0 +1,4 @@ +IntoResult in volta_shim::common - Rust
pub trait IntoResult<T> {
+    // Required method
+    fn into_result(self) -> Result<T, Error>;
+}

Required Methods§

Implementations on Foreign Types§

source§

impl IntoResult<()> for Result<ExitStatus, VoltaError>

Implementors§

\ No newline at end of file diff --git a/main/volta_shim/fn.main.html b/main/volta_shim/fn.main.html new file mode 100644 index 000000000..698858909 --- /dev/null +++ b/main/volta_shim/fn.main.html @@ -0,0 +1 @@ +main in volta_shim - Rust

Function volta_shim::main

source ·
pub fn main()
\ No newline at end of file diff --git a/main/volta_shim/index.html b/main/volta_shim/index.html new file mode 100644 index 000000000..59c71b2f3 --- /dev/null +++ b/main/volta_shim/index.html @@ -0,0 +1,2 @@ +volta_shim - Rust
\ No newline at end of file diff --git a/main/volta_shim/sidebar-items.js b/main/volta_shim/sidebar-items.js new file mode 100644 index 000000000..f0c7444e2 --- /dev/null +++ b/main/volta_shim/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"fn":["main"],"mod":["common"]}; \ No newline at end of file