Skip to main content

ServerEvent

Enum ServerEvent 

Source
#[non_exhaustive]
pub enum ServerEvent {
Show 13 variants ClientConnected { id: String, hello: Hello, }, ClientDisconnected { id: String, }, ClientVolumeChanged { client_id: String, volume: u16, muted: bool, }, ClientLatencyChanged { client_id: String, latency: i32, }, ClientNameChanged { client_id: String, name: String, }, GroupStreamChanged { group_id: String, stream_id: String, }, GroupMuteChanged { group_id: String, muted: bool, }, StreamStatus { stream_id: String, status: String, }, StreamMetaChanged { stream_id: String, metadata: HashMap<String, Value>, }, GroupNameChanged { group_id: String, name: String, }, ServerUpdated, StreamControl { stream_id: String, command: String, params: Value, }, CustomMessage { client_id: String, message: CustomMessage, },
}
Expand description

Events emitted by the server to the consumer.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ClientConnected

A client connected via the binary protocol.

Fields

§id: String

Unique client identifier.

§hello: Hello

The client’s Hello message with all connection metadata.

§

ClientDisconnected

A client disconnected.

Fields

§id: String

Unique client identifier.

§

ClientVolumeChanged

A client’s volume changed.

Fields

§client_id: String

Client ID.

§volume: u16

New volume (0–100).

§muted: bool

Mute state.

§

ClientLatencyChanged

A client’s latency changed.

Fields

§client_id: String

Client ID.

§latency: i32

New latency in ms.

§

ClientNameChanged

A client’s name changed.

Fields

§client_id: String

Client ID.

§name: String

New name.

§

GroupStreamChanged

A group’s stream assignment changed.

Fields

§group_id: String

Group ID.

§stream_id: String

New stream ID.

§

GroupMuteChanged

A group’s mute state changed.

Fields

§group_id: String

Group ID.

§muted: bool

Mute state.

§

StreamStatus

A stream’s status changed (playing, idle, unknown).

Fields

§stream_id: String

Stream identifier.

§status: String

New status.

§

StreamMetaChanged

Stream metadata/properties changed.

Fields

§stream_id: String

Stream identifier.

§metadata: HashMap<String, Value>

Updated properties.

§

GroupNameChanged

A group’s name changed.

Fields

§group_id: String

Group ID.

§name: String

New name.

§

ServerUpdated

Server state changed — groups were reorganized (created, deleted, merged).

Emitted after structural changes like SetGroupClients or DeleteClient when the group topology changes. Mirrors Server.OnUpdate in the C++ snapserver. The consumer should re-read server status via GetStatus.

§

StreamControl

A stream control command was received (play, pause, next, seek, etc.).

The library forwards this to the embedder since it doesn’t own stream readers.

Fields

§stream_id: String

Stream ID.

§command: String

Command name.

§params: Value

Optional parameters.

§

CustomMessage

Custom binary protocol message from a streaming client.

Fields

§client_id: String

Client ID.

§message: CustomMessage

The custom message.

Trait Implementations§

Source§

impl Debug for ServerEvent

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

Source§

type Output = T

Should always be Self
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<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