pub struct VersionedGraph {
pub version: String,
pub created_at: Option<String>,
pub metadata: Option<Map<String, Value>>,
pub graph: EinsumGraph,
}Expand description
Versioned wrapper for EinsumGraph serialization
Fields§
§version: StringFormat version (semver)
created_at: Option<String>Creation timestamp (ISO 8601)
metadata: Option<Map<String, Value>>Optional metadata
graph: EinsumGraphThe graph
Implementations§
Source§impl VersionedGraph
impl VersionedGraph
Sourcepub fn new(graph: EinsumGraph) -> Self
pub fn new(graph: EinsumGraph) -> Self
Create a new versioned graph
Sourcepub fn with_metadata(graph: EinsumGraph, metadata: Map<String, Value>) -> Self
pub fn with_metadata(graph: EinsumGraph, metadata: Map<String, Value>) -> Self
Create with custom metadata
Sourcepub fn to_json_pretty(&self) -> Result<String, Error>
pub fn to_json_pretty(&self) -> Result<String, Error>
Serialize to pretty JSON
Sourcepub fn to_json_compact(&self) -> Result<String, Error>
pub fn to_json_compact(&self) -> Result<String, Error>
Serialize to compact JSON
Sourcepub fn from_binary(bytes: &[u8]) -> Result<Self, Box<dyn Error>>
pub fn from_binary(bytes: &[u8]) -> Result<Self, Box<dyn Error>>
Deserialize from binary format
Sourcepub fn is_compatible(&self) -> bool
pub fn is_compatible(&self) -> bool
Check if version is compatible with current version
Trait Implementations§
Source§impl Clone for VersionedGraph
impl Clone for VersionedGraph
Source§fn clone(&self) -> VersionedGraph
fn clone(&self) -> VersionedGraph
Returns a duplicate of the value. Read more
1.0.0 · 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 VersionedGraph
impl Debug for VersionedGraph
Source§impl<'de> Deserialize<'de> for VersionedGraph
impl<'de> Deserialize<'de> for VersionedGraph
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 VersionedGraph
impl RefUnwindSafe for VersionedGraph
impl Send for VersionedGraph
impl Sync for VersionedGraph
impl Unpin for VersionedGraph
impl UnwindSafe for VersionedGraph
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