pub struct ManagedNode<R> { /* private fields */ }Expand description
A role-bearing managed object with stable, ordered strong edges.
Edge storage and identity allocation are deliberately private. Callers can mutate the graph only through checked operations, so identities are never reused and compare-and-mutate failures leave the node unchanged.
Implementations§
Source§impl<R> ManagedNode<R>
impl<R> ManagedNode<R>
Sourcepub const fn new(role: R) -> Self
pub const fn new(role: R) -> Self
Constructs an empty node carrying caller-owned role evidence.
Sourcepub const fn with_edge_limits(role: R, limits: EdgeLimits) -> Self
pub const fn with_edge_limits(role: R, limits: EdgeLimits) -> Self
Constructs an empty node with explicit total and per-kind hard caps.
Sourcepub fn edge_snapshot(&self) -> Vec<EdgeSnapshot>
pub fn edge_snapshot(&self) -> Vec<EdgeSnapshot>
Returns an allocation-ordered copy of every live outgoing edge.
Sourcepub fn replace_role(&mut self, role: R) -> R
pub fn replace_role(&mut self, role: R) -> R
Replaces the role without changing the managed graph.
Sourcepub fn insert_strong(
&mut self,
target: ManagedId,
) -> Result<EdgeId, StrongEdgeMutationError>
pub fn insert_strong( &mut self, target: ManagedId, ) -> Result<EdgeId, StrongEdgeMutationError>
Inserts a strong edge and returns its stable identity.
Sourcepub fn replace_strong(
&mut self,
edge: EdgeId,
expected: ManagedId,
replacement: ManagedId,
) -> Result<(), StrongEdgeMutationError>
pub fn replace_strong( &mut self, edge: EdgeId, expected: ManagedId, replacement: ManagedId, ) -> Result<(), StrongEdgeMutationError>
Replaces a strong target only if it still equals expected.
Sourcepub fn remove_strong(
&mut self,
edge: EdgeId,
expected: ManagedId,
) -> Result<ManagedId, StrongEdgeMutationError>
pub fn remove_strong( &mut self, edge: EdgeId, expected: ManagedId, ) -> Result<ManagedId, StrongEdgeMutationError>
Removes a strong edge only if it still equals expected.
Sourcepub fn insert_weak(
&mut self,
target: ManagedId,
) -> Result<EdgeId, WeakEdgeMutationError>
pub fn insert_weak( &mut self, target: ManagedId, ) -> Result<EdgeId, WeakEdgeMutationError>
Inserts a weak edge and returns its stable identity.
Sourcepub fn replace_weak(
&mut self,
edge: EdgeId,
expected: ManagedId,
replacement: ManagedId,
) -> Result<(), WeakEdgeMutationError>
pub fn replace_weak( &mut self, edge: EdgeId, expected: ManagedId, replacement: ManagedId, ) -> Result<(), WeakEdgeMutationError>
Replaces a weak target only if it still equals expected.
Sourcepub fn remove_weak(
&mut self,
edge: EdgeId,
expected: ManagedId,
) -> Result<ManagedId, WeakEdgeMutationError>
pub fn remove_weak( &mut self, edge: EdgeId, expected: ManagedId, ) -> Result<ManagedId, WeakEdgeMutationError>
Removes a weak edge only if it still equals expected.
Sourcepub fn insert_ephemeron(
&mut self,
key: ManagedId,
value: ManagedId,
) -> Result<EdgeId, EphemeronMutationError>
pub fn insert_ephemeron( &mut self, key: ManagedId, value: ManagedId, ) -> Result<EdgeId, EphemeronMutationError>
Inserts an ephemeron entry and returns its stable identity.
Sourcepub fn replace_ephemeron(
&mut self,
edge: EdgeId,
expected: (ManagedId, ManagedId),
replacement: (ManagedId, ManagedId),
) -> Result<(), EphemeronMutationError>
pub fn replace_ephemeron( &mut self, edge: EdgeId, expected: (ManagedId, ManagedId), replacement: (ManagedId, ManagedId), ) -> Result<(), EphemeronMutationError>
Replaces an ephemeron only if it still contains the expected pair.
Sourcepub fn remove_ephemeron(
&mut self,
edge: EdgeId,
expected: (ManagedId, ManagedId),
) -> Result<(ManagedId, ManagedId), EphemeronMutationError>
pub fn remove_ephemeron( &mut self, edge: EdgeId, expected: (ManagedId, ManagedId), ) -> Result<(ManagedId, ManagedId), EphemeronMutationError>
Removes an ephemeron only if it still contains the expected pair.
Trait Implementations§
Source§impl<R: Clone> Clone for ManagedNode<R>
impl<R: Clone> Clone for ManagedNode<R>
Source§fn clone(&self) -> ManagedNode<R>
fn clone(&self) -> ManagedNode<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more