pub struct SerializeShapeGraph { /* private fields */ }Expand description
A complete serialization shape graph rooted at one type.
Implementations§
Source§impl SerializeShapeGraph
impl SerializeShapeGraph
Sourcepub fn from_fn<F>(build_root: F) -> Self
pub fn from_fn<F>(build_root: F) -> Self
Builds a serialization graph from a function that returns its root shape.
This is useful when the root type is foreign or when no Rust type corresponds to the
complete wire shape. Use Self::for_type when the root implements SerializeShape.
Sourcepub fn for_type<T>() -> Selfwhere
T: SerializeShape + ?Sized,
pub fn for_type<T>() -> Selfwhere
T: SerializeShape + ?Sized,
Builds a complete serialization shape graph rooted at T.
Sourcepub fn root_definition(&self) -> Option<&SerializeDefinitionShape>
pub fn root_definition(&self) -> Option<&SerializeDefinitionShape>
Returns the root definition when the graph root is a named type.
Sourcepub fn definitions(&self) -> &[SerializeDefinitionShape]
pub fn definitions(&self) -> &[SerializeDefinitionShape]
Returns the named definitions reachable from the root.
Sourcepub fn definition(&self, id: ShapeId) -> Option<&SerializeDefinitionShape>
pub fn definition(&self, id: ShapeId) -> Option<&SerializeDefinitionShape>
Returns the definition at this id’s graph-local index.
A ShapeId does not encode graph ownership. The caller must pass an id produced by this
graph; an id from another graph with an in-bounds index cannot be distinguished here.
Sourcepub fn definition_for(
&self,
shape: &ShapeRef,
) -> Option<&SerializeDefinitionShape>
pub fn definition_for( &self, shape: &ShapeRef, ) -> Option<&SerializeDefinitionShape>
Returns the definition directly referenced by shape.
Returns None for non-definition shapes and out-of-bounds definition indexes.
Trait Implementations§
Source§impl Clone for SerializeShapeGraph
impl Clone for SerializeShapeGraph
Source§fn clone(&self) -> SerializeShapeGraph
fn clone(&self) -> SerializeShapeGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more