Trait GraphAdapter

Source
pub trait GraphAdapter {
    type NodeId: Id;
    type SocketId: Id;

    // Required methods
    fn nodes(
        &mut self,
    ) -> impl NodeIterator<NodeId = Self::NodeId, SocketId = Self::SocketId>;
    fn connection_hint(
        &self,
        a: Self::SocketId,
        b: Self::SocketId,
    ) -> ConnectionHint;
    fn connect(&mut self, a: Self::SocketId, b: Self::SocketId);
    fn connections(
        &self,
    ) -> impl Iterator<Item = (Self::SocketId, Self::SocketId)>;
}
Expand description

An adapter for a graph to interact with a visual editor.

Required Associated Types§

Source

type NodeId: Id

An identifier used to identify a node over the graph.

Source

type SocketId: Id

An identifier used to identify a socket over the graph.

Required Methods§

Source

fn nodes( &mut self, ) -> impl NodeIterator<NodeId = Self::NodeId, SocketId = Self::SocketId>

An iterator over the node’s adapters of the graph.

Source

fn connection_hint( &self, a: Self::SocketId, b: Self::SocketId, ) -> ConnectionHint

A hint about the connection between the sockets a and b.

This hint is used to provide a feedback to the user before they submit the connection.

Source

fn connect(&mut self, a: Self::SocketId, b: Self::SocketId)

The user submit a connection between the sockets a and b.

Source

fn connections(&self) -> impl Iterator<Item = (Self::SocketId, Self::SocketId)>

An iterator over the connections between sockets.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T> GraphAdapter for &'a mut T
where T: GraphAdapter + ?Sized,

Implementors§