pub struct Package {
inner: Rc<PackageInner>,
}
Expand description
Information about a package that is available somewhere in the file system.
A package is a Cargo.toml
file plus all the files that are part of it.
Fields§
§inner: Rc<PackageInner>
Implementations§
source§impl Package
impl Package
sourcepub fn new(manifest: Manifest, manifest_path: &Path) -> Package
pub fn new(manifest: Manifest, manifest_path: &Path) -> Package
Creates a package from a manifest and its location.
sourcepub fn dependencies(&self) -> &[Dependency]
pub fn dependencies(&self) -> &[Dependency]
Gets the manifest dependencies.
sourcepub fn manifest_mut(&mut self) -> &mut Manifest
pub fn manifest_mut(&mut self) -> &mut Manifest
Gets the manifest.
sourcepub fn manifest_path(&self) -> &Path
pub fn manifest_path(&self) -> &Path
Gets the path to the manifest.
sourcepub fn name(&self) -> InternedString
pub fn name(&self) -> InternedString
Gets the name of the package.
sourcepub fn package_id(&self) -> PackageId
pub fn package_id(&self) -> PackageId
Gets the PackageId
object for the package (fully defines a package).
sourcepub fn library(&self) -> Option<&Target>
pub fn library(&self) -> Option<&Target>
Gets the library crate for this package, if it exists.
Gets the package authors.
sourcepub fn publish(&self) -> &Option<Vec<String>>
pub fn publish(&self) -> &Option<Vec<String>>
Returns None
if the package is set to publish.
Returns Some(allowed_registries)
if publishing is limited to specified
registries or if package is set to not publish.
sourcepub fn proc_macro(&self) -> bool
pub fn proc_macro(&self) -> bool
Returns true
if this package is a proc-macro.
sourcepub fn rust_version(&self) -> Option<&RustVersion>
pub fn rust_version(&self) -> Option<&RustVersion>
Gets the package’s minimum Rust version.
sourcepub fn has_custom_build(&self) -> bool
pub fn has_custom_build(&self) -> bool
Returns true
if the package uses a custom build script for any target.
pub fn map_source(self, to_replace: SourceId, replace_with: SourceId) -> Package
pub fn to_registry_toml(&self, ws: &Workspace<'_>) -> CargoResult<String>
sourcepub fn include_lockfile(&self) -> bool
pub fn include_lockfile(&self) -> bool
Returns if package should include Cargo.lock
.
pub fn serialized(&self) -> SerializedPackage
Trait Implementations§
source§impl Ord for Package
impl Ord for Package
source§impl PartialEq<Package> for Package
impl PartialEq<Package> for Package
source§impl PartialOrd<Package> for Package
impl PartialOrd<Package> for Package
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Package
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes