Struct fibril::Sdk

source ·
pub struct Sdk<'a, M>(_, _);
Available on crate feature fibers only.

Implementations§

source§

impl<'a, M> Sdk<'a, M>

source

pub fn deadline(&self, duration: Duration) -> Deadline

source

pub fn deadline_elapsed(&self, deadline: Deadline) -> bool

source

pub fn exit(&self) -> !

source

pub fn expect(&self, description: impl ToString) -> Expectation

source

pub fn expectation_met(&self, expectation: Expectation)

source

pub fn id(&self) -> Id

source

pub fn recv(&self) -> (Id, M)

source

pub fn recv_btree_map<K, V>( &self, count: usize, filter_map: impl Fn(Id, M) -> Option<(K, V)> ) -> BTreeMap<K, V>where K: Ord,

source

pub fn recv_btree_set<V>( &self, count: usize, filter_map: impl Fn(Id, M) -> Option<V> ) -> BTreeSet<V>where V: Ord,

source

pub fn recv_response_count(&self, count: usize, filter: impl Fn(Id, M) -> bool)

This is a helper based on Sdk::recv_btree_set for the case where an actor needs to wait for count messages from distinct recipients (e.g. when awaiting quorum).

count will match the number of distinct Ids for which the filter returned true (i.e. accepted messages from the same Id are only counted once).

source

pub fn recv_responses<V>( &self, count: usize, filter_map: impl Fn(Id, M) -> Option<V> ) -> BTreeMap<Id, V>

This is a helper based on Sdk::recv_btree_map for the case where an actor needs to wait for count messages from distinct recipients (e.g. when awaiting quorum).

count will match the number of distinct Ids for which the filter_map returned Some(...) (i.e. accepted messages from the same Id are only counted once).

source

pub fn send(&self, dst: Id, m: M)

source

pub fn send_broadcast(&self, dst: impl IntoIterator<Item = Id>, m: &M)where M: Clone,

source

pub fn sleep_until(&self, deadline: Deadline)

Trait Implementations§

source§

impl<'a, M> Debug for Sdk<'a, M>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, M> !RefUnwindSafe for Sdk<'a, M>

§

impl<'a, M> !Send for Sdk<'a, M>

§

impl<'a, M> !Sync for Sdk<'a, M>

§

impl<'a, M> Unpin for Sdk<'a, M>

§

impl<'a, M> !UnwindSafe for Sdk<'a, M>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more