Enum ProtocolEvent

Source
pub enum ProtocolEvent<const CONFIG: u64, LocalMessages: ReactiveMessagingSerializer<LocalMessages> + Send + Sync + PartialEq + Debug + 'static, SenderChannel: FullDuplexUniChannel<ItemType = LocalMessages, DerivedItemType = LocalMessages> + Send + Sync, StateType: Send + Sync + Clone + Debug + 'static = ()> {
    PeerArrived {
        peer: Arc<Peer<CONFIG, LocalMessages, SenderChannel, StateType>>,
    },
    PeerLeft {
        peer: Arc<Peer<CONFIG, LocalMessages, SenderChannel, StateType>>,
        stream_stats: Arc<dyn StreamExecutorStats + Sync + Send>,
    },
    LocalServiceTermination,
}
Expand description

Event issued by Composite Protocol Clients & Servers to their Reactive Processors.
The user code may use those events to maintain a list of connected parties, be notified of stop/close/quit requests, init/de-init sessions, etc. Note that the Peer objects received in those events may be used, at any time, to send messages to the remote party – like “Shutting down. Goodbye”. IMPLEMENTATION NOTE: GAT traits (to reduce the number of generic parameters) couldn’t be used here – even after applying this compiler bug workaround https://github.com/rust-lang/rust/issues/102211#issuecomment-1513931928 – the “error: implementation of std::marker::Send is not general enough” bug kept on popping up in user provided closures that called other async functions.

Variants§

§

PeerArrived

Happens when a remote party is first made available to the reactive processor (caused either by a new connection or by a reactive protocol transition)

Fields

§peer: Arc<Peer<CONFIG, LocalMessages, SenderChannel, StateType>>
§

PeerLeft

Happens when the remote party leaves the reactive processor (caused either by a dropped connection or by a reactive protocol transition)

Fields

§peer: Arc<Peer<CONFIG, LocalMessages, SenderChannel, StateType>>
§stream_stats: Arc<dyn StreamExecutorStats + Sync + Send>
§

LocalServiceTermination

Happens when the local code has commanded the service (and all opened connections) to stop

Trait Implementations§

Source§

impl<const CONFIG: u64, LocalMessages: Debug + ReactiveMessagingSerializer<LocalMessages> + Send + Sync + PartialEq + Debug + 'static, SenderChannel: Debug + FullDuplexUniChannel<ItemType = LocalMessages, DerivedItemType = LocalMessages> + Send + Sync, StateType: Debug + Send + Sync + Clone + Debug + 'static> Debug for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const CONFIG: u64, LocalMessages, SenderChannel, StateType> Freeze for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

§

impl<const CONFIG: u64, LocalMessages, SenderChannel, StateType = ()> !RefUnwindSafe for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

§

impl<const CONFIG: u64, LocalMessages, SenderChannel, StateType> Send for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

§

impl<const CONFIG: u64, LocalMessages, SenderChannel, StateType> Sync for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

§

impl<const CONFIG: u64, LocalMessages, SenderChannel, StateType> Unpin for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

§

impl<const CONFIG: u64, LocalMessages, SenderChannel, StateType = ()> !UnwindSafe for ProtocolEvent<CONFIG, LocalMessages, SenderChannel, StateType>

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
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.

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<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