pub struct NodeRegistry { /* private fields */ }Implementations§
Source§impl NodeRegistry
impl NodeRegistry
Sourcepub fn new() -> NodeRegistry
pub fn new() -> NodeRegistry
Create a new empty node registry.
Sourcepub fn register<F>(&mut self, node_type: impl Into<String>, factory: F)
pub fn register<F>(&mut self, node_type: impl Into<String>, factory: F)
Register a node type (e.g. “move_to_goal”) with a factory function.
The factory is called each time a node of this type is created, receiving the JSON
Sourcepub fn create(
&self,
node_type: &str,
config: Value,
) -> Result<Box<dyn BehaviorNode>, Error>
pub fn create( &self, node_type: &str, config: Value, ) -> Result<Box<dyn BehaviorNode>, Error>
Create a node instance from a registered type, looking up its factory and calling it
with config. Errors if the node type isn’t registered or the factory fails.
Sourcepub fn contains(&self, node_type: &str) -> bool
pub fn contains(&self, node_type: &str) -> bool
Check if a node type is registered.
Same check as has_node - both names are kept since callers use
Sourcepub fn registered_types(&self) -> Vec<String>
pub fn registered_types(&self) -> Vec<String>
Get a list of all registered node types.
Trait Implementations§
Source§impl Clone for NodeRegistry
impl Clone for NodeRegistry
Source§fn clone(&self) -> NodeRegistry
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NodeRegistry
impl Debug for NodeRegistry
Source§impl Default for NodeRegistry
impl Default for NodeRegistry
Source§fn default() -> NodeRegistry
fn default() -> NodeRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NodeRegistry
impl RefUnwindSafe for NodeRegistry
impl Send for NodeRegistry
impl Sync for NodeRegistry
impl Unpin for NodeRegistry
impl UnsafeUnpin for NodeRegistry
impl UnwindSafe for NodeRegistry
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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