pub struct BuildStamp {
path: PathBuf,
stamp: String,
}
Expand description
Manages a stamp file to track build state. The file is created in the given directory and can have custom content and name.
Fields§
§path: PathBuf
§stamp: String
Implementations§
Source§impl BuildStamp
impl BuildStamp
Sourcepub fn new(dir: &Path) -> Self
pub fn new(dir: &Path) -> Self
Creates a new BuildStamp
for a given directory.
By default, stamp will be an empty file named .stamp
within the specified directory.
Sourcepub fn stamp(&self) -> &str
pub fn stamp(&self) -> &str
Returns the value of the stamp.
Note that this is empty by default and is populated using BuildStamp::add_stamp
.
It is not read from an actual file, but rather it holds the value that will be used
when BuildStamp::write
is called.
Sourcepub fn add_stamp<S: ToString>(self, stamp: S) -> Self
pub fn add_stamp<S: ToString>(self, stamp: S) -> Self
Adds specified stamp content to the current value.
This method can be used incrementally e.g., add_stamp("x").add_stamp("y").add_stamp("z")
.
Sourcepub fn with_prefix(self, prefix: &str) -> Self
pub fn with_prefix(self, prefix: &str) -> Self
Adds a prefix to stamp’s name.
Prefix cannot start or end with a dot (.
).
Sourcepub fn is_up_to_date(&self) -> bool
pub fn is_up_to_date(&self) -> bool
Checks if the stamp file is up-to-date.
It is considered up-to-date if file content matches with the stamp string.
Trait Implementations§
Source§impl Clone for BuildStamp
impl Clone for BuildStamp
Source§fn clone(&self) -> BuildStamp
fn clone(&self) -> BuildStamp
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for BuildStamp
impl RefUnwindSafe for BuildStamp
impl Send for BuildStamp
impl Sync for BuildStamp
impl Unpin for BuildStamp
impl UnwindSafe for BuildStamp
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Pointable for T
impl<T> Pointable for T
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: 48 bytes