Skip to main content

PingStream

Struct PingStream 

Source
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: u64

Sent Ping messages

§pong_count: u64

Received Pong messages

Implementations§

Source§

impl PingStream

Source

pub fn new(target: ActorPath, period: Duration) -> Self

creates a PingStream actor that sends PingMsg to target every period Target should be a PongerAct.

Source

pub fn start_pinging(&mut self)

method to start pinging

Source

pub fn stop_pinging(&mut self)

method to stop pinging

Trait Implementations§

Source§

impl Actor for PingStream

Source§

type Message = !

The type of local messages the actor accepts
Source§

fn receive_local(&mut self, _: Self::Message) -> HandlerResult

Handle an incoming local message Read more
Source§

fn receive_network(&mut self, msg: NetMessage) -> HandlerResult

Handle an incoming network message Read more
Source§

impl ComponentDefinition for PingStream

Source§

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

Execute events on the component’s ports Read more
Source§

fn ctx_mut(&mut self) -> &mut ComponentContext<Self>

Return a mutable reference the component’s context field
Source§

fn ctx(&self) -> &ComponentContext<Self>

Return a reference the component’s context field
Source§

fn type_name() -> &'static str

Return the name of the component’s type Read more
Source§

fn spawn_local<F>( &mut self, f: impl FnOnce(ComponentDefinitionAccess<Self>) -> F, )
where Self: 'static, F: Future<Output = Result<Handled, HandlerError>> + Send + 'static,

Run a Future on this component, allowing it mutable access to the component’s internal state on every poll. Read more
Source§

fn spawn_off<R>( &self, future: impl Future<Output = R> + Send + 'static, ) -> Receiver<R>
where R: Send + 'static,

Run a Future on this system’s executor pool and return a handle to the result Read more
Source§

impl ComponentLifecycle for PingStream

Source§

fn on_start(&mut self) -> HandlerResult

Gets invoked every time a component receives a Start event Read more
Source§

fn on_stop(&mut self) -> Result<Handled, HandlerError>
where Self: 'static,

Gets invoked every time a component receives a Stop event Read more
Source§

fn on_kill(&mut self) -> Result<Handled, HandlerError>
where Self: 'static,

Gets invoked every time a component receives a Kill event Read more
Source§

impl DynamicPortAccess for PingStream

Source§

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 more
Source§

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 more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<CD> ActorPathFactory for CD
where CD: ComponentTraits,

Source§

fn actor_path(&self) -> ActorPath

Returns the associated actor path.
Source§

impl<A, M> ActorRaw for A
where M: MessageBounds, A: Actor<Message = M>,

Source§

type Message = M

The type of local messages the actor accepts
Source§

fn receive(&mut self, env: MsgEnvelope<M>) -> Result<Handled, HandlerError>

Handle an incoming message Read more
Source§

impl<CD> ActorRefFactory for CD

Source§

type Message = <CD as ActorRaw>::Message

The type of messages carried by references produced by this factory
Source§

fn actor_ref(&self) -> ActorRef<<CD as ActorRefFactory>::Message>

Returns the associated actor reference
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<CD> ComponentLogging for CD

Source§

fn log(&self) -> &Logger<Arc<Fuse<Async>>>

Returns a reference to the component’s logger instance Read more
Source§

impl<CD> Dispatching for CD
where CD: ComponentTraits,

Source§

fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>

Returns the associated dispatcher reference.
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<M, T, A> Receiver<T> for A
where T: Debug + 'static, M: From<T> + MessageBounds, A: ActorRefFactory<Message = M>,

Source§

fn recipient(&self) -> Recipient<T>

Produce a recipient for T
Source§

impl<CD> Timer<CD> for CD
where CD: ComponentTraits,

Source§

fn schedule_once<F>(&mut self, timeout: Duration, action: F) -> ScheduledTimer

Schedule the action to be run once after timeout expires Read more
Source§

fn schedule_periodic<F>( &mut self, delay: Duration, period: Duration, action: F, ) -> ScheduledTimer
where F: Fn(&mut CD, ScheduledTimer) -> Result<Handled, HandlerError> + Send + 'static,

Schedule the action to be run every timeout time units Read more
Source§

fn cancel_timer(&mut self, handle: ScheduledTimer)

Cancel the timer indicated by the handle 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<CD> ComponentTraits for CD
where CD: ComponentDefinition + ActorRaw + 'static,

Source§

impl<T> DynamicComponentDefinition for T

Source§

impl<T> Erased for T