[go: up one dir, main page]

pub struct LocalManifest {
    pub path: PathBuf,
    pub manifest: Manifest,
}
Expand description

A Cargo manifest that is available locally.

Fields

path: PathBuf

Path to the manifest

manifest: Manifest

Manifest contents

Implementations

Construct a LocalManifest. If no path is provided, make an educated guess as to which one the user means.

Construct the LocalManifest corresponding to the Path provided.

Write changes back to the file

Remove entry from a Cargo.toml.

Examples
  use cargo_edit::{Dependency, LocalManifest, Manifest, RegistrySource};
  use toml_edit;

  let root = std::path::PathBuf::from("/").canonicalize().unwrap();
  let path = root.join("Cargo.toml");
  let manifest: toml_edit::Document = "
  [dependencies]
  cargo-edit = '0.1.0'
  ".parse().unwrap();
  let mut manifest = LocalManifest { path, manifest: Manifest { data: manifest } };
  assert!(manifest.remove_from_table(&["dependencies".to_owned()], "cargo-edit").is_ok());
  assert!(manifest.remove_from_table(&["dependencies".to_owned()], "cargo-edit").is_err());
  assert!(!manifest.data.contains_key("dependencies"));

Allow mutating depedencies, wherever they live

Iterates mutably over the [workspace.dependencies].

Override the manifest’s version

true if the package inherits the workspace version

Get the current workspace version, if any.

Override the workspace’s version.

Remove references to dep_key if its no longer present

Trait Implementations

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.