pub struct PingStream {
pub ping_count: u64,
pub pong_count: u64,
/* private fields */
}Expand description
An actor that continuously sends PingMsg to a target over the network.
Target should be a PongerAct.
Fields§
§ping_count: u64Sent Ping messages
pong_count: u64Received Pong messages
Implementations§
Source§impl PingStream
impl PingStream
Sourcepub fn new(target: ActorPath, period: Duration) -> Self
pub fn new(target: ActorPath, period: Duration) -> Self
creates a PingStream actor that sends PingMsg to target every period
Target should be a PongerAct.
Sourcepub fn start_pinging(&mut self)
pub fn start_pinging(&mut self)
method to start pinging
Sourcepub fn stop_pinging(&mut self)
pub fn stop_pinging(&mut self)
method to stop pinging
Trait Implementations§
Source§impl Actor for PingStream
impl Actor for PingStream
Source§fn receive_local(&mut self, _: Self::Message) -> HandlerResult
fn receive_local(&mut self, _: Self::Message) -> HandlerResult
Handle an incoming local message Read more
Source§fn receive_network(&mut self, msg: NetMessage) -> HandlerResult
fn receive_network(&mut self, msg: NetMessage) -> HandlerResult
Handle an incoming network message Read more
Source§impl ComponentDefinition for PingStream
impl ComponentDefinition for PingStream
Source§fn setup(&mut self, self_component: Arc<Component<Self>>)
fn setup(&mut self, self_component: Arc<Component<Self>>)
Prepare the component for being run Read more
Source§fn execute(&mut self, _max_events: usize, _skip: usize) -> ExecuteResult
fn execute(&mut self, _max_events: usize, _skip: usize) -> ExecuteResult
Execute events on the component’s ports Read more
Source§fn ctx_mut(&mut self) -> &mut ComponentContext<Self>
fn ctx_mut(&mut self) -> &mut ComponentContext<Self>
Return a mutable reference the component’s context field
Source§fn ctx(&self) -> &ComponentContext<Self>
fn ctx(&self) -> &ComponentContext<Self>
Return a reference the component’s context field
Source§fn spawn_local<F>(
&mut self,
f: impl FnOnce(ComponentDefinitionAccess<Self>) -> F,
)
fn spawn_local<F>( &mut self, f: impl FnOnce(ComponentDefinitionAccess<Self>) -> F, )
Run a Future on this component, allowing it mutable
access to the component’s internal state on every poll. Read more
Source§impl ComponentLifecycle for PingStream
impl ComponentLifecycle for PingStream
Source§impl DynamicPortAccess for PingStream
impl DynamicPortAccess for PingStream
Source§fn get_provided_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
fn get_provided_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
Internal API. Dynamically obtain a mutable reference to a
ProvidedPort if self
provides a port of the type indicated by the passed port_id. Read moreSource§fn get_required_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
fn get_required_port_as_any(&mut self, port_id: TypeId) -> Option<&mut dyn Any>
Internal API. Dynamically obtain a mutable reference to a
RequiredPort if self
requires a port of the type indicated by the passed port_id. Read moreAuto Trait Implementations§
impl !Freeze for PingStream
impl !RefUnwindSafe for PingStream
impl Send for PingStream
impl !Sync for PingStream
impl Unpin for PingStream
impl UnsafeUnpin for PingStream
impl !UnwindSafe for PingStream
Blanket Implementations§
Source§impl<CD> ActorPathFactory for CDwhere
CD: ComponentTraits,
impl<CD> ActorPathFactory for CDwhere
CD: ComponentTraits,
Source§fn actor_path(&self) -> ActorPath
fn actor_path(&self) -> ActorPath
Returns the associated actor path.
Source§impl<A, M> ActorRaw for Awhere
M: MessageBounds,
A: Actor<Message = M>,
impl<A, M> ActorRaw for Awhere
M: MessageBounds,
A: Actor<Message = M>,
Source§impl<CD> ActorRefFactory for CDwhere
CD: ComponentDefinition,
impl<CD> ActorRefFactory for CDwhere
CD: ComponentDefinition,
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<CD> ComponentLogging for CDwhere
CD: ComponentTraits + ComponentLifecycle,
impl<CD> ComponentLogging for CDwhere
CD: ComponentTraits + ComponentLifecycle,
Source§impl<CD> Dispatching for CDwhere
CD: ComponentTraits,
impl<CD> Dispatching for CDwhere
CD: ComponentTraits,
Source§fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>
fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>
Returns the associated dispatcher reference.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<CD> Timer<CD> for CDwhere
CD: ComponentTraits,
impl<CD> Timer<CD> for CDwhere
CD: ComponentTraits,
Source§fn schedule_once<F>(&mut self, timeout: Duration, action: F) -> ScheduledTimer
fn schedule_once<F>(&mut self, timeout: Duration, action: F) -> ScheduledTimer
Source§fn schedule_periodic<F>(
&mut self,
delay: Duration,
period: Duration,
action: F,
) -> ScheduledTimer
fn schedule_periodic<F>( &mut self, delay: Duration, period: Duration, action: F, ) -> ScheduledTimer
Source§fn cancel_timer(&mut self, handle: ScheduledTimer)
fn cancel_timer(&mut self, handle: ScheduledTimer)
Cancel the timer indicated by the
handle Read more