pub struct GraphArtifact {
pub schema: String,
pub tree: Option<String>,
pub facts: FactSet,
}Expand description
A self-describing snapshot of an assembled graph.
Fields§
§schema: StringSchema tag (ARTIFACT_SCHEMA).
tree: Option<String>Hex id of the HEAD tree this graph was assembled from, if recorded.
facts: FactSetThe full node/edge set.
Implementations§
Source§impl GraphArtifact
impl GraphArtifact
Sourcepub fn from_store(store: &Store) -> Result<Self, StoreError>
pub fn from_store(store: &Store) -> Result<Self, StoreError>
Capture the current contents of store as an artifact.
§Errors
Returns StoreError if the store cannot be read.
Sourcepub fn to_json(&self) -> Result<String, StoreError>
pub fn to_json(&self) -> Result<String, StoreError>
Sourcepub fn from_json(json: &str) -> Result<Self, StoreError>
pub fn from_json(json: &str) -> Result<Self, StoreError>
Parse an artifact from JSON.
§Errors
Returns StoreError::Json on malformed JSON, or StoreError::Corrupt
if the schema tag is unrecognised.
Sourcepub fn load_into(&self, store: &mut Store) -> Result<(), StoreError>
pub fn load_into(&self, store: &mut Store) -> Result<(), StoreError>
Load this artifact into store, replacing its entire contents. If the
artifact carries a tree id it is recorded, so a sync at the matching
commit sees the graph as already applied; a tree-less artifact records no
synced state.
§Errors
Returns StoreError if the rebuild fails.
Trait Implementations§
Source§impl Clone for GraphArtifact
impl Clone for GraphArtifact
Source§fn clone(&self) -> GraphArtifact
fn clone(&self) -> GraphArtifact
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 GraphArtifact
impl Debug for GraphArtifact
Source§impl<'de> Deserialize<'de> for GraphArtifact
impl<'de> Deserialize<'de> for GraphArtifact
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
Source§impl PartialEq for GraphArtifact
impl PartialEq for GraphArtifact
Source§impl Serialize for GraphArtifact
impl Serialize for GraphArtifact
impl StructuralPartialEq for GraphArtifact
Auto Trait Implementations§
impl Freeze for GraphArtifact
impl RefUnwindSafe for GraphArtifact
impl Send for GraphArtifact
impl Sync for GraphArtifact
impl Unpin for GraphArtifact
impl UnsafeUnpin for GraphArtifact
impl UnwindSafe for GraphArtifact
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