pub struct Package { /* private fields */ }
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.
Implementations
sourceimpl 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<&str>
pub fn rust_version(&self) -> Option<&str>
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
sourceimpl Ord for Package
impl Ord for Package
sourceimpl PartialOrd<Package> for Package
impl PartialOrd<Package> for Package
sourcefn partial_cmp(&self, other: &Package) -> Option<Ordering>
fn partial_cmp(&self, other: &Package) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more