pub struct Node { /* private fields */ }Expand description
An actor which helps to manage the IPC connections.
The node can hold multiple IpcListeners to accept incoming IPC connections on several
endpoints in parallel. Outbound connections are initiated by sending a
Connect<C> command.
Implementations§
Source§impl Node
impl Node
Sourcepub fn with_listener<L>(self, listener: L) -> Selfwhere
L: IpcListener,
pub fn with_listener<L>(self, listener: L) -> Selfwhere
L: IpcListener,
Adds an IPC listener to the node.
If the node already has a listener listening on the same endpoint, the new listener will
replace the existing one. Note this is not the same as the
AddListener command, which will not replace the existing
listener.
Sourcepub fn with_actor<A>(self, actor: Address<A>) -> Selfwhere
A: RemoteActor,
pub fn with_actor<A>(self, actor: Address<A>) -> Selfwhere
A: RemoteActor,
Adds an actor which implements RemoteActor trait to the node.
Sourcepub fn with_actor_factory<A>(self) -> Selfwhere
A: RemoteActorFactory,
pub fn with_actor_factory<A>(self) -> Selfwhere
A: RemoteActorFactory,
Adds an actor factory so that remote peers can create instances of A by sending a
CreateActor node command to this node.
Trait Implementations§
Source§impl Actor for Node
impl Actor for Node
Source§fn stopping(
&mut self,
ctx: &mut Self::Context,
) -> impl Future<Output = Result<Stopping, Self::Error>> + Send
fn stopping( &mut self, ctx: &mut Self::Context, ) -> impl Future<Output = Result<Stopping, Self::Error>> + Send
Source§fn run<S>(
self,
label: S,
) -> Result<(Address<Self>, JoinHandle<()>), Self::Error>
fn run<S>( self, label: S, ) -> Result<(Address<Self>, JoinHandle<()>), Self::Error>
Starts an actor and spawns it to the tokio runtime, returns its actor address and the
join handle.
Source§fn create<S, F>(
label: S,
f: F,
) -> Result<(Address<Self>, JoinHandle<()>), Self::Error>
fn create<S, F>( label: S, f: F, ) -> Result<(Address<Self>, JoinHandle<()>), Self::Error>
Creates a new actor, starts it and spawns it to the tokio runtime, returns its actor
address and the join handle.
Source§fn create_in_span<S, F>(
label: S,
parent_span: Option<&Span>,
f: F,
) -> Result<(Address<Self>, JoinHandle<()>), Self::Error>
fn create_in_span<S, F>( label: S, parent_span: Option<&Span>, f: F, ) -> Result<(Address<Self>, JoinHandle<()>), Self::Error>
Source§fn type_erased_recipient_fn() -> Option<fn(&Address<Self>) -> TypeErasedRecipient>
fn type_erased_recipient_fn() -> Option<fn(&Address<Self>) -> TypeErasedRecipient>
Available on crate feature
type-erased-recipient-hook only.Opt-in hook that turns an
Address<A> into a type-erased trait object which can be
downcast into a concrete Recipient<M>, where M is a specific message type
chosen in the overridden implementation of this method. Read moreSource§impl<L> Handler<AddListener<L>> for Nodewhere
L: IpcListener,
impl<L> Handler<AddListener<L>> for Nodewhere
L: IpcListener,
Source§impl Handler<CreateRemoteActor> for Node
impl Handler<CreateRemoteActor> for Node
Source§type Result = FutureMessageResult<CreateRemoteActor>
type Result = FutureMessageResult<CreateRemoteActor>
The return type of the handler, which must implement
MessageResponse.Source§impl Handler<GetRemoteActor> for Node
impl Handler<GetRemoteActor> for Node
Source§type Result = FutureMessageResult<GetRemoteActor>
type Result = FutureMessageResult<GetRemoteActor>
The return type of the handler, which must implement
MessageResponse.Source§impl Handler<RemoveActor> for Node
impl Handler<RemoveActor> for Node
Source§impl Handler<RemoveListener> for Node
impl Handler<RemoveListener> for Node
Source§impl SubjectActor<NodeEvent> for Node
impl SubjectActor<NodeEvent> for Node
Source§fn observers_mut(&mut self) -> &mut ObserverSet<NodeEvent>
fn observers_mut(&mut self) -> &mut ObserverSet<NodeEvent>
Returns a mutable reference to the set of observers for this event type.
Source§fn register_observer(&mut self, observer: Recipient<Event>)
fn register_observer(&mut self, observer: Recipient<Event>)
Registers an observer.
Source§fn unregister_observer(&mut self, observer: Recipient<Event>)
fn unregister_observer(&mut self, observer: Recipient<Event>)
Unregisters an observer.
Source§fn notify_observers(&mut self, event: Event) -> impl Future<Output = ()> + Send
fn notify_observers(&mut self, event: Event) -> impl Future<Output = ()> + Send
Notifies all observers. Read more
Source§fn try_notify_observers(&mut self, event: Event)
fn try_notify_observers(&mut self, event: Event)
Notifies all observers. Read more
Auto Trait Implementations§
impl Freeze for Node
impl !RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl !UnwindSafe for Node
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