Skip to main content

KeyedPayloadGraph

Struct KeyedPayloadGraph 

Source
pub struct KeyedPayloadGraph<Key, NodePayload, EdgePayload> { /* private fields */ }
Expand description

A GraphMap-style key index backed by generation-stable graph handles.

Keys provide domain lookup while algorithms continue to use compact stable handles from StablePayloadGraph.

Implementations§

Source§

impl<Key, NodePayload, EdgePayload> KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: Clone + Eq + Hash + Ord,

Source

pub fn new() -> Self

Source

pub fn with_capacity(nodes: usize, edges: usize) -> Self

Source

pub fn insert_node( &mut self, key: Key, payload: NodePayload, ) -> Result<(StableNodeKey, Option<NodePayload>)>

Inserts a key or replaces its node payload without changing its handle.

Returns the stable handle and the previous payload, when one existed.

§Errors

Returns an error when the stable node index space is exhausted.

Source

pub fn node_key(&self, key: &Key) -> Option<StableNodeKey>

Source

pub fn node(&self, key: &Key) -> Option<&NodePayload>

Source

pub fn node_mut(&mut self, key: &Key) -> Option<&mut NodePayload>

Source

pub fn add_edge( &mut self, source: &Key, target: &Key, payload: EdgePayload, ) -> Result<StableEdgeKey>

Adds a directed edge between two existing domain keys.

§Errors

Returns an error for a missing endpoint or exhausted edge indices.

Source

pub fn remove_node(&mut self, key: &Key) -> Option<NodePayload>

Source

pub const fn graph(&self) -> &StablePayloadGraph<NodePayload, EdgePayload>

Source

pub fn node_count(&self) -> usize

Source

pub fn edge_count(&self) -> usize

Source

pub fn into_parts( self, ) -> (StablePayloadGraph<NodePayload, EdgePayload>, impl Iterator<Item = (Key, StableNodeKey)>)

Trait Implementations§

Source§

impl<Key: Clone, NodePayload: Clone, EdgePayload: Clone> Clone for KeyedPayloadGraph<Key, NodePayload, EdgePayload>

Source§

fn clone(&self) -> KeyedPayloadGraph<Key, NodePayload, EdgePayload>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Key: Debug, NodePayload: Debug, EdgePayload: Debug> Debug for KeyedPayloadGraph<Key, NodePayload, EdgePayload>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Key, NodePayload, EdgePayload> Default for KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: Clone + Eq + Hash + Ord,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Key, NodePayload, EdgePayload> Freeze for KeyedPayloadGraph<Key, NodePayload, EdgePayload>

§

impl<Key, NodePayload, EdgePayload> RefUnwindSafe for KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: RefUnwindSafe, NodePayload: RefUnwindSafe, EdgePayload: RefUnwindSafe,

§

impl<Key, NodePayload, EdgePayload> Send for KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: Send, NodePayload: Send, EdgePayload: Send,

§

impl<Key, NodePayload, EdgePayload> Sync for KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: Sync, NodePayload: Sync, EdgePayload: Sync,

§

impl<Key, NodePayload, EdgePayload> Unpin for KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: Unpin, NodePayload: Unpin, EdgePayload: Unpin,

§

impl<Key, NodePayload, EdgePayload> UnsafeUnpin for KeyedPayloadGraph<Key, NodePayload, EdgePayload>

§

impl<Key, NodePayload, EdgePayload> UnwindSafe for KeyedPayloadGraph<Key, NodePayload, EdgePayload>
where Key: UnwindSafe, NodePayload: UnwindSafe, EdgePayload: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.