#[repr(u8)]pub enum MessageFormat {
New = 0,
SameSource = 1,
TimerChange = 2,
Continue = 3,
}
Expand description
The first 2 bits to indicate a format of message header.
Variants correspond to respectively formats:
Pattern | Format(length) |
---|---|
New | 11 bytes |
SameSource | 7 bytes |
TimerChange | 3 bytes |
Continue | 0 bytes |
Variants§
Trait Implementations§
Source§impl Clone for MessageFormat
impl Clone for MessageFormat
Source§fn clone(&self) -> MessageFormat
fn clone(&self) -> MessageFormat
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MessageFormat
impl Debug for MessageFormat
Source§impl From<MessageFormat> for u8
impl From<MessageFormat> for u8
Source§fn from(message_format: MessageFormat) -> Self
fn from(message_format: MessageFormat) -> Self
Converts to this type from the input type.
Source§impl From<u8> for MessageFormat
impl From<u8> for MessageFormat
Source§fn from(message_format: u8) -> Self
fn from(message_format: u8) -> Self
Converts message format bits into a variant.
§Panics
Because of the RTMP specification, this is implemented in such a way as to emit a panic when is passed any value above 3.
§Examples
use std::panic::catch_unwind;
use sheave_core::messages::headers::{
MessageFormat,
MessageFormat::*
};
assert_eq!(New, MessageFormat::from(0)); // => ok
assert_eq!(SameSource, MessageFormat::from(1)); // => ok
assert_eq!(TimerChange, MessageFormat::from(2)); // => ok
assert_eq!(Continue, MessageFormat::from(3)); // => ok
assert!(catch_unwind(|| MessageFormat::from(4)).is_err()); // => this will be backtrace.
Source§impl PartialEq for MessageFormat
impl PartialEq for MessageFormat
impl Copy for MessageFormat
impl Eq for MessageFormat
impl StructuralPartialEq for MessageFormat
Auto Trait Implementations§
impl Freeze for MessageFormat
impl RefUnwindSafe for MessageFormat
impl Send for MessageFormat
impl Sync for MessageFormat
impl Unpin for MessageFormat
impl UnwindSafe for MessageFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more