ServerSession

Struct ServerSession 

Source
pub struct ServerSession<P: Protocol, S: ServerState> { /* private fields */ }
Expand description

A typed server-side reflector session.

P is the protocol marker (crate::session::client::DExtra, crate::session::client::DPlus, crate::session::client::Dcs). S is the server state marker (super::Unknown, super::Link1Received, super::Linked, etc.).

Implementations§

Source§

impl<P: Protocol, S: ServerState> ServerSession<P, S>

Source

pub const fn state_kind(&self) -> ServerStateKind

Runtime state discriminator.

Source

pub const fn peer(&self) -> SocketAddr

Peer address.

Source

pub fn pop_event(&mut self) -> Option<ServerEvent<P>>

Drain the next server event.

Source§

impl<P: Protocol> ServerSession<P, Streaming>

Source

pub fn handle_voice_data( self, now: Instant, bytes: &[u8], ) -> Result<Self, Error>

Process a voice data packet on a streaming client.

Only available when S = Streaming — calling this in any other state is a compile error.

§Errors

Returns any Error the core propagates while processing the event.

Source§

impl ServerSession<DPlus, Link1Received>

Source

pub fn handle_link2( self, now: Instant, _callsign: Callsign, bytes: &[u8], ) -> Result<ServerSession<DPlus, Linked>, Error>

Process a DPlus LINK2 packet after a LINK1 has been received.

Only available on ServerSession<DPlus, Link1Received> — calling this before LINK1 (in the super::Unknown state) is a compile error.

§Errors

Returns any Error the core propagates.

Source§

impl<P: Protocol> ServerSession<P, Linked>

Process an UNLINK packet on a linked client.

Only available on ServerSession<P, Linked> — calling this after the session has already reached Closed is a compile error.

§Errors

Returns any Error the core propagates.

Trait Implementations§

Source§

impl<P: Debug + Protocol, S: Debug + ServerState> Debug for ServerSession<P, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P, S> Freeze for ServerSession<P, S>

§

impl<P, S> RefUnwindSafe for ServerSession<P, S>

§

impl<P, S> Send for ServerSession<P, S>
where S: Send,

§

impl<P, S> Sync for ServerSession<P, S>
where S: Sync,

§

impl<P, S> Unpin for ServerSession<P, S>
where P: Unpin, S: Unpin,

§

impl<P, S> UnwindSafe for ServerSession<P, S>
where P: UnwindSafe, S: UnwindSafe,

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.

§

impl<T> Instrument for T

§

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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