Skip to main content

UserControl

Enum UserControl 

Source
#[non_exhaustive]
pub enum UserControl { StreamBegin(u32), StreamEof(u32), StreamDry(u32), SetBufferLength { stream_id: u32, buffer: Duration, }, StreamIsRecorded(u32), PingRequest(u32), PingResponse(u32), }
Expand description

A User Control Message event (§5.3, message type id 4; event-data formats per §6.7, spec §7.1.7). SHOULD use message stream id 0 and, over the chunk stream, csid 2. Effective on receipt; timestamps ignored.

#[non_exhaustive]: §6.7’s event-type catalogue (event value 5 is already an unassigned gap) can grow; a new event type must not be a breaking change for existing match callers.

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

StreamBegin(u32)

Stream Begin (event 0, server→client): the stream is now functional/usable. By default sent on stream id 0 right after a successful connect.

§

StreamEof(u32)

Stream EOF (event 1, server→client): playback requested on this stream has ended.

§

StreamDry(u32)

StreamDry (event 2, server→client): no more data on the stream (server-detected idle).

§

SetBufferLength

SetBufferLength (event 3, client→server): the client’s playback buffer size, sent before the server starts sending the stream.

Fields

§stream_id: u32

The stream this buffer length applies to.

§buffer: Duration

The client’s buffer length, a span carried on the wire as whole milliseconds.

§

StreamIsRecorded(u32)

StreamIsRecorded (event 4, server→client): the stream is a recorded (not live) stream.

§

PingRequest(u32)

PingRequest (event 6, server→client): test reachability; the client MUST reply with PingResponse.

§

PingResponse(u32)

PingResponse (event 7, client→server): reply to PingRequest, echoing its timestamp.

Implementations§

Source§

impl UserControl

Source

pub fn name(&self) -> &'static str

The spec token for this user control event.

Source

pub fn event_type(&self) -> u16

This event’s 16-bit event type value (§6.7).

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, RtmpError>

The message payload, built without a fallible length check: the result length is the type’s own Serialize::serialized_len.

§Errors

RtmpError::FieldOverflow if a SetBufferLength span is longer than the message’s 32-bit millisecond field.

Source

pub fn to_message(&self) -> Result<Message, RtmpError>

Wrap this user control event in a Message ready to hand to crate::chunk::ChunkWriter — chunk stream id CONTROL_CHUNK_STREAM_ID, message stream id CONTROL_MESSAGE_STREAM_ID, timestamp 0 (effective on receipt; timestamps are not meaningful).

§Errors

See UserControl::to_bytes.

Trait Implementations§

Source§

impl Clone for UserControl

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for UserControl

Source§

impl Debug for UserControl

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for UserControl

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for UserControl

Source§

impl<'a> Parse<'a> for UserControl

Source§

type Error = RtmpError

The error type this implementer returns. Typically the enclosing crate’s Error enum.
Source§

fn parse(bytes: &'a [u8]) -> Result<Self, RtmpError>

Parse bytes as Self. Returns Err(Self::Error) on any protocol violation or buffer underrun. Read more
Source§

impl PartialEq for UserControl

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for UserControl

Source§

type Error = RtmpError

The error type this implementer returns (usually the same as the corresponding Parse impl, but need not be).
Source§

fn serialized_len(&self) -> usize

Number of bytes serialize_into will write.
Source§

fn serialize_into(&self, buf: &mut [u8]) -> Result<usize, RtmpError>

Write the serialised form into buf. Returns the number of bytes written (always equal to serialized_len()).
Source§

fn try_to_bytes(&self) -> Result<Vec<u8>, Self::Error>

Allocate a Vec and serialize into it, returning the serializer’s error instead of panicking. This is the only allocate-and-serialize entry point: there is deliberately no panicking to_bytes (hand-built values, or values assembled from damaged wire data, can violate a wire constraint, so the error must reach the caller).
Source§

fn serialize_append(&self, out: &mut Vec<u8>) -> Result<usize, Self::Error>

Append the serialised form to out, returning the number of bytes appended. out is left unchanged when the serializer fails.
Source§

impl StructuralPartialEq for UserControl

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.