Skip to main content

NodeRegistry

Struct NodeRegistry 

Source
pub struct NodeRegistry { /* private fields */ }
Expand description

Registry for node kinds.

Implementations§

Source§

impl NodeRegistry

Source

pub fn plan_canonicalize_kinds(&self, graph: &Graph) -> CanonicalizeKindsPlan

Plans a transaction that rewrites aliased node kinds to their canonical kind.

Source

pub fn plan_migrate_nodes(&self, graph: &Graph) -> MigrateNodesPlan

Plans a transaction that upgrades node payloads to the latest registered kind version.

This plan is intentionally best-effort:

  • missing schema -> recorded as a report entry, no edits are produced
  • missing migrator -> recorded as a report entry, no edits are produced
  • migrator errors -> recorded as a report entry, no edits are produced for that node

The returned transaction may also include SetNodeKind ops for aliased kinds.

Source§

impl NodeRegistry

Source

pub fn new() -> Self

Creates an empty registry.

Source

pub fn register(&mut self, schema: NodeSchema)

Registers a schema.

Aliases are mapped to the schema’s canonical kind.

Source

pub fn register_migrator( &mut self, kind: NodeKindKey, migrator: Arc<dyn NodeKindMigrator>, ) -> &mut Self

Registers a per-kind data migrator.

The migrator is stored as an in-memory hook (not serialized as part of the schema data).

Source

pub fn resolve_kind<'a>(&'a self, kind: &'a NodeKindKey) -> &'a NodeKindKey

Resolves an input kind to a canonical kind (via aliases).

Source

pub fn get(&self, kind: &NodeKindKey) -> Option<&NodeSchema>

Looks up a schema by canonical kind key.

Source

pub fn schemas(&self) -> impl Iterator<Item = &NodeSchema>

Iterates all registered schemas in deterministic order (by kind key).

Source

pub fn view_descriptor( &self, kind: &NodeKindKey, ) -> Option<NodeKindViewDescriptor>

Returns the adapter-facing descriptor for a node kind or alias.

Source

pub fn view_descriptors(&self) -> Vec<NodeKindViewDescriptor>

Returns adapter-facing node-kind descriptors in deterministic order.

Source

pub fn instantiate_node( &self, kind: &NodeKindKey, pos: CanvasPoint, ) -> Result<NodeInstantiation, NodeInstantiationError>

Instantiates a node kind or alias with freshly allocated node and port ids.

Source

pub fn instantiate_node_with_ids( &self, kind: &NodeKindKey, node_id: NodeId, pos: CanvasPoint, port_ids: impl IntoIterator<Item = PortId>, ) -> Result<NodeInstantiation, NodeInstantiationError>

Instantiates a node kind or alias with caller-provided ids.

Trait Implementations§

Source§

impl Clone for NodeRegistry

Source§

fn clone(&self) -> NodeRegistry

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 Debug for NodeRegistry

Source§

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

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

impl Default for NodeRegistry

Source§

fn default() -> NodeRegistry

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

Auto Trait Implementations§

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.