[][src]Struct npm_package_json::Package

pub struct Package {
    pub name: String,
    pub version: String,
    pub description: Option<String>,
    pub keywords: Vec<String>,
    pub homepage: Option<String>,
    pub bugs: Option<Bug>,
    pub license: Option<String>,
    pub author: Option<PersonReference>,
    pub contributors: Vec<PersonReference>,
    pub files: Vec<String>,
    pub main: Option<String>,
    pub browser: Option<String>,
    pub bin: BinSet,
    pub man: Option<ManReference>,
    pub repository: Option<RepositoryReference>,
    pub scripts: ScriptsSet,
    pub dependencies: DepsSet,
    pub dev_dependencies: DepsSet,
    pub peer_dependencies: DepsSet,
    pub bundled_dependencies: DepsSet,
    pub optional_dependencies: DepsSet,
    pub engines: EnginesSet,
    pub private: bool,
    pub others: BTreeMap<String, Value>,
}

The top-level package.json structure.

Fields

name: String

The package name.

version: String

The package version.

description: Option<String>

The optional package description.

keywords: Vec<String>

The optional list of keywords.

homepage: Option<String>

The optional package homepage.

bugs: Option<Bug>

The optional bug contact form.

license: Option<String>

The optional package license.

author: Option<PersonReference>

The optional author.

contributors: Vec<PersonReference>

The optional list of contributors.

files: Vec<String>

The optional list of files to include. Each entry defines a regex pattern.

main: Option<String>

The optional package main entry file.

browser: Option<String>

The optional package browser entry file.

This is usually defined in libraries that are meant to be consumed by browsers. These Thoes can refer to objects that are not available inside a nodejs environment (like window).

bin: BinSet

The optional set of binary definitions.

man: Option<ManReference>

The optional list of man page references.

repository: Option<RepositoryReference>

The optional repository reference.

scripts: ScriptsSet

The optional list of script entries.

dependencies: DepsSet

The optional list of dependencies.

dev_dependencies: DepsSet

The optional list of development dependencies.

peer_dependencies: DepsSet

The optional list of peer dependencies.

bundled_dependencies: DepsSet

The optional list of bundled dependencies.

optional_dependencies: DepsSet

The optional list of optional dependencies.

engines: EnginesSet

The optional list of engine entries.

private: bool

The package privacy.

others: BTreeMap<String, Value>

Other custom fields that have been defined inside the package.json file.

Implementations

impl Package[src]

pub fn new() -> Self[src]

Creates a new default package.

pub fn from_path(path: impl AsRef<Path>) -> Result<Self>[src]

Deserializes a Package from a file path.

pub fn from_reader<R: Read>(r: R) -> Result<Self>[src]

Deserializes a Package from an IO stream.

pub fn from_slice(v: &[u8]) -> Result<Self>[src]

Deserializes a Package from bytes.

Trait Implementations

impl Clone for Package[src]

impl Debug for Package[src]

impl Default for Package[src]

impl<'de> Deserialize<'de> for Package[src]

impl Eq for Package[src]

impl FromStr for Package[src]

type Err = Error

The associated error which can be returned from parsing.

fn from_str(s: &str) -> Result<Self, Self::Err>[src]

Deserializes a Package from a string.

impl PartialEq<Package> for Package[src]

impl Serialize for Package[src]

impl StructuralEq for Package[src]

impl StructuralPartialEq for Package[src]

Auto Trait Implementations

impl RefUnwindSafe for Package

impl Send for Package

impl Sync for Package

impl Unpin for Package

impl UnwindSafe for Package

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.