pub struct GraphFileV1 {
pub graph_id: GraphId,
pub graph_version: u32,
pub graph: Graph,
}Expand description
Graph persistence file (v1).
This wrapper enables stable schema evolution while keeping the inner Graph model reusable.
Fields§
§graph_id: GraphIdGraph id (duplicated for quick lookup / validation).
graph_version: u32File wrapper version.
graph: GraphGraph document.
Implementations§
Source§impl GraphFileV1
impl GraphFileV1
Sourcepub fn from_graph(graph: Graph) -> Self
pub fn from_graph(graph: Graph) -> Self
Wraps a graph into a v1 file object.
Sourcepub fn validate(&self) -> Result<(), GraphFileError>
pub fn validate(&self) -> Result<(), GraphFileError>
Validates wrapper invariants.
Sourcepub fn load_json_if_exists(
path: impl AsRef<Path>,
) -> Result<Option<Self>, GraphFileError>
pub fn load_json_if_exists( path: impl AsRef<Path>, ) -> Result<Option<Self>, GraphFileError>
Loads the JSON file if it exists.
Trait Implementations§
Source§impl Clone for GraphFileV1
impl Clone for GraphFileV1
Source§fn clone(&self) -> GraphFileV1
fn clone(&self) -> GraphFileV1
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GraphFileV1
impl Debug for GraphFileV1
Source§impl<'de> Deserialize<'de> for GraphFileV1
impl<'de> Deserialize<'de> for GraphFileV1
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 GraphFileV1
impl RefUnwindSafe for GraphFileV1
impl Send for GraphFileV1
impl Sync for GraphFileV1
impl Unpin for GraphFileV1
impl UnsafeUnpin for GraphFileV1
impl UnwindSafe for GraphFileV1
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