pub struct ManagedNode<R> { /* private fields */ }Expand description
Shared language-neutral arena, node, edge, and retention building blocks. 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) -> ManagedNode<R>
pub const fn new(role: R) -> ManagedNode<R>
Constructs an empty node carrying caller-owned role evidence.
Sourcepub const fn with_edge_limits(role: R, limits: EdgeLimits) -> ManagedNode<R>
pub const fn with_edge_limits(role: R, limits: EdgeLimits) -> ManagedNode<R>
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 for ManagedNode<R>where
R: Clone,
impl<R> Clone for ManagedNode<R>where
R: Clone,
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 moreSource§impl<R> Debug for ManagedNode<R>where
R: Debug,
impl<R> Debug for ManagedNode<R>where
R: Debug,
impl<R> Eq for ManagedNode<R>where
R: Eq,
Source§impl<R> ManagedObject for ManagedNode<R>
impl<R> ManagedObject for ManagedNode<R>
Source§fn trace_edges(&self, visitor: &mut dyn EdgeVisitor)
fn trace_edges(&self, visitor: &mut dyn EdgeVisitor)
Source§impl<R> PartialEq for ManagedNode<R>where
R: PartialEq,
impl<R> PartialEq for ManagedNode<R>where
R: PartialEq,
Source§impl<R> RoleBearingManagedObject for ManagedNode<R>
impl<R> RoleBearingManagedObject for ManagedNode<R>
Source§fn managed_role(&self) -> &<ManagedNode<R> as RoleBearingManagedObject>::Role
fn managed_role(&self) -> &<ManagedNode<R> as RoleBearingManagedObject>::Role
Source§fn replace_managed_role(
&mut self,
role: <ManagedNode<R> as RoleBearingManagedObject>::Role,
) -> <ManagedNode<R> as RoleBearingManagedObject>::Role
fn replace_managed_role( &mut self, role: <ManagedNode<R> as RoleBearingManagedObject>::Role, ) -> <ManagedNode<R> as RoleBearingManagedObject>::Role
impl<R> StructuralPartialEq for ManagedNode<R>where
R: PartialEq,
Auto Trait Implementations§
impl<R> Freeze for ManagedNode<R>where
R: Freeze,
impl<R> RefUnwindSafe for ManagedNode<R>where
R: RefUnwindSafe,
impl<R> Send for ManagedNode<R>where
R: Send,
impl<R> Sync for ManagedNode<R>where
R: Sync,
impl<R> Unpin for ManagedNode<R>where
R: Unpin,
impl<R> UnsafeUnpin for ManagedNode<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for ManagedNode<R>where
R: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more