Cursor

Struct Cursor 

Source
pub struct Cursor<'this, 'id, T: 'this> { /* private fields */ }
Expand description

A wrapper over a GraphPtr which provides simplified access to Anchor API.

Implementations§

Source§

impl<'this, 'id, N: 'this, NodeType> Cursor<'this, 'id, NodeType>
where NodeType: GraphNode<Node = N> + 'this,

Source

pub fn at(&self) -> GraphPtr<'id, NodeType>

Returns a pointer to the current node the cursor points to.

Source

pub fn is_at(&self, dst: GraphPtr<'id, NodeType>) -> bool

Returns true if the cursor points to dst.

Source

pub fn jump(&mut self, dst: GraphPtr<'id, NodeType>)

Moves the cursor to dst.

Source§

impl<'this, 'id, N: 'this, E: 'this> Cursor<'this, 'id, NamedNode<N, E>>

Source

pub fn get_edge( &self, dst: GraphPtr<'id, NamedNode<N, E>>, ) -> Option<Edge<&N, &E>>

Returns Some if dst is attached to the current node and None otherwise.

Source§

impl<'this, 'id, N: 'this, E: 'this> Cursor<'this, 'id, VecNode<N, E>>

Source

pub fn get_edge(&self, dst: usize) -> Option<Edge<&N, &E>>

Returns Some if dst is attached to the current node and None otherwise.

Source§

impl<'this, 'id, N: 'this, E: 'this> Cursor<'this, 'id, OptionNode<N, E>>

Source

pub fn get_edge(&self, _dst: ()) -> Option<Edge<&N, &E>>

Returns Some if a node is attached to the current node and None otherwise.

Source§

impl<'this, 'id, K, N: 'this, E: 'this> Cursor<'this, 'id, TreeNode<K, N, E>>
where K: Ord + 'this,

Source

pub fn get_edge(&self, dst: &K) -> Option<Edge<&N, &E>>

Returns Some if a node is attached to the current node and None otherwise.

Source§

impl<'this, 'id, K, N: 'this, E: 'this> Cursor<'this, 'id, TreeNode<K, N, E>>
where K: Ord + 'this,

Source

pub fn edges( &self, ) -> impl Iterator<Item = GraphItem<Edge<&N, &E>, GraphPtr<'id, TreeNode<K, N, E>>>>

Returns an iterator over edges and node pointers attached to the current node.

Source§

impl<'this, 'id, N: 'this, E: 'this> Cursor<'this, 'id, NamedNode<N, E>>

Source

pub fn edges( &self, ) -> impl Iterator<Item = GraphItem<Edge<&N, &E>, GraphPtr<'id, NamedNode<N, E>>>>

Returns an iterator over edges and node pointers attached to the current node.

Source§

impl<'this, 'id, N: 'this, E: 'this> Cursor<'this, 'id, VecNode<N, E>>

Source

pub fn edges( &self, ) -> impl Iterator<Item = GraphItem<Edge<&N, &E>, GraphPtr<'id, VecNode<N, E>>>>

Returns an iterator over edges and node pointers attached to the current node.

Source§

impl<'this, 'id, N: 'this, E: 'this> Cursor<'this, 'id, OptionNode<N, E>>

Source

pub fn edges( &self, ) -> impl Iterator<Item = GraphItem<Edge<&N, &E>, GraphPtr<'id, OptionNode<N, E>>>>

Returns an iterator over edges and node pointers attached to the current node.

Trait Implementations§

Source§

impl<'this, 'id, N: 'this, E: 'this> Deref for Cursor<'this, 'id, NamedNode<N, E>>

Source§

type Target = NamedNode<'id, N, E>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'this, 'id, N: 'this, E: 'this> Deref for Cursor<'this, 'id, OptionNode<N, E>>

Source§

type Target = OptionNode<'id, N, E>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'this, 'id, K, N: 'this, E: 'this> Deref for Cursor<'this, 'id, TreeNode<K, N, E>>
where K: Ord + 'this,

Source§

type Target = TreeNode<'id, K, N, E>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'this, 'id, N: 'this, E: 'this> Deref for Cursor<'this, 'id, VecNode<N, E>>

Source§

type Target = VecNode<'id, N, E>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'this, 'id, T> Freeze for Cursor<'this, 'id, T>

§

impl<'this, 'id, T> RefUnwindSafe for Cursor<'this, 'id, T>
where T: RefUnwindSafe,

§

impl<'this, 'id, T> !Send for Cursor<'this, 'id, T>

§

impl<'this, 'id, T> !Sync for Cursor<'this, 'id, T>

§

impl<'this, 'id, T> Unpin for Cursor<'this, 'id, T>

§

impl<'this, 'id, T> UnwindSafe for Cursor<'this, 'id, T>
where T: RefUnwindSafe,

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.