pub struct SnapshotFile {
pub package_name: String,
pub snapshot: Snapshot,
}
Expand description
Generic Snapshot file wrapper. Each package can have up to 3 different snapshots: initial_ast, canonicalization_ast and type_inferenced_ast;
Fields§
§package_name: String
§snapshot: Snapshot
Implementations§
Source§impl SnapshotFile
impl SnapshotFile
pub fn new(package_name: &str, snapshot: Snapshot) -> Self
pub fn exists_at(&self, path: &Path) -> bool
Sourcepub fn read_from(&self, path: &Path) -> Result<String>
pub fn read_from(&self, path: &Path) -> Result<String>
Reads the serialized struct from the given file path if it exists.
Sourcepub fn remove(&self, path: &Path) -> Result<bool>
pub fn remove(&self, path: &Path) -> Result<bool>
Removes the serialized struct at the given path if it exists. Returns true
on success,
false
if the file doesn’t exist, and Error
if the file system fails during operation.
fn snapshot_file_path<'a>(&self, path: &'a Path) -> Cow<'a, Path>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SnapshotFile
impl<'de> Deserialize<'de> for SnapshotFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SnapshotFile
impl RefUnwindSafe for SnapshotFile
impl Send for SnapshotFile
impl Sync for SnapshotFile
impl Unpin for SnapshotFile
impl UnwindSafe for SnapshotFile
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
§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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