Skip to main content

Registry

Struct Registry 

Source
pub struct Registry {
    pub base_url: String,
}
Expand description

An npm-compatible registry. Defaults to the public registry.

Fields§

§base_url: String

Implementations§

Source§

impl Registry

Source

pub fn npm() -> Self

The public npm registry (https://registry.npmjs.org).

Source

pub fn with_base_url(base_url: impl Into<String>) -> Self

A registry at a custom base URL (e.g. a private mirror).

Source

pub fn tarball_url(&self, name: &str, version: &str) -> String

Conventional tarball URL for an exact version. Handles scoped names: @scope/pkg<base>/@scope/pkg/-/pkg-<version>.tgz.

Source

pub fn packument(&self, name: &str) -> Result<Value, Box<dyn Error>>

Fetch the package metadata document (“packument”).

Source

pub fn resolve( &self, name: &str, req: &VersionReq, ) -> Result<Resolved, Box<dyn Error>>

Resolve the newest published version of name matching req.

Trait Implementations§

Source§

impl Default for Registry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.