Struct ICodeBehindBase

pub struct ICodeBehindBase(/* private fields */);

Implementations§

§

impl ICodeBehindBase

pub fn attach_override(&self) -> Result<(), Error>

pub fn detach_override(&self) -> Result<(), Error>

§

impl ICodeBehindBase

pub fn register_command( &self, command_name: impl AsRef<KanziStr>, closure: impl Handler, ) -> Result<(), Error>

Registers a new command handler. A command is a form of user input. The code behind class of a node can register a handler for a command and perform an operation in the handler. You must call this method in register_commands_override.

§Arguments
  • command_name - The name of the command that you want to handle.
  • closure - The handler functor for the command.

pub fn unregister_command( &self, command_name: impl AsRef<KanziStr>, ) -> Result<(), Error>

Unregisters a command handler. You must call this method in unregister_commands_override.

§Arguments
  • command_name - The name of the command for which you previously registered a handler.

Methods from Deref<Target = INodeComponentBase>§

pub fn attach_override(&self) -> Result<(), Error>

pub fn detach_override(&self) -> Result<(), Error>

pub fn add_message_handler<T>( &self, message_type: &MessageType<T>, closure: impl Handler, ) -> Result<MessageSubscriptionToken, Error>

Kanzi calls the message handler that you add using this function when the target name of the incoming message matches the name of this node component, or if the message is broadcast to all node components with an empty target name.

§Arguments
  • message_type - Type of message to handle.
  • closure - The callback that will be invoked when this node component receives a message.
§Returns

Message subscription token.

pub fn remove_message_filter( &self, token: &MessageSubscriptionToken, ) -> Result<(), Error>

Removes message handler added via add_message_handler function.

§Arguments
  • token - Subscription token of message handler to remove.

pub fn dispatch_message<T>( &self, message_type: &MessageType<T>, message_arguments: &T, ) -> Result<(), Error>

Adds the name of the node component to the message arguments and dispatches the message to the node of the node component.

§Arguments
  • message_type - The type of the dispatched message.
  • message_arguments - The arguments of the dispatched message.

pub fn dispatch_abstract_message<T>( &self, message_type: &MessageType<T>, message_arguments: &MessageArguments, ) -> Result<(), Error>

Adds the name of the node component to the abstract message arguments and dispatches the message to the node of the node component.

§Arguments
  • message_type - The abstract type of the dispatched message.
  • message_arguments - The abstract arguments of the dispatched message.

Trait Implementations§

§

impl Deref for ICodeBehindBase

§

type Target = INodeComponentBase

The resulting type after dereferencing.
§

fn deref(&self) -> &<ICodeBehindBase as Deref>::Target

Dereferences the value.
§

impl Inherits<ICodeBehindBase> for IActivityCodeBehindBase

§

fn upcast(self) -> Base

§

fn upcast_ref(&self) -> &Base

§

impl Inherits<INodeComponentBase> for ICodeBehindBase

§

fn upcast(self) -> Base

§

fn upcast_ref(&self) -> &Base

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
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

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.

§

impl<T> Inherits<T> for T

§

fn upcast(self) -> Base

§

fn upcast_ref(&self) -> &Base

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.