pub(crate) struct Crate {
pub(crate) name: String,
pub(crate) toml_file: PathBuf,
pub(crate) toml_doc: DocumentMut,
pub(crate) toml_doc_orig: DocumentMut,
}
Expand description
Stored information about a crate.
Fields§
§name: String
name of the crate
toml_file: PathBuf
path to the crate’s Cargo.toml
toml_doc: DocumentMut
Parsed and manipulated copy of Cargo.toml
toml_doc_orig: DocumentMut
Parsed and un-manipulated copy of Cargo.toml.
Implementations§
Source§impl Crate
impl Crate
Sourcepub(crate) fn load(p: impl AsRef<Path>) -> Result<Self>
pub(crate) fn load(p: impl AsRef<Path>) -> Result<Self>
Try to read a crate’s Cargo.toml from a given filename.
Sourcepub(crate) fn info(&self) -> CrateInfo
pub(crate) fn info(&self) -> CrateInfo
Extract information about this crate that other crates will need.
Sourcepub(crate) fn fix(
&mut self,
no_annotate: bool,
other_crates: &HashMap<String, CrateInfo>,
) -> Result<Vec<Warning>>
pub(crate) fn fix( &mut self, no_annotate: bool, other_crates: &HashMap<String, CrateInfo>, ) -> Result<Vec<Warning>>
Try to fix all the issues we find with a Cargo.toml. Return a list of warnings.
Sourcepub(crate) fn save_if_changed(&self) -> Result<()>
pub(crate) fn save_if_changed(&self) -> Result<()>
If we made changes to this crate’s cargo.toml, flush it to disk.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Crate
impl RefUnwindSafe for Crate
impl Send for Crate
impl Sync for Crate
impl Unpin for Crate
impl UnwindSafe for Crate
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more