Skip to main content

FlvTag

Struct FlvTag 

Source
pub struct FlvTag<'a> {
    pub tag_type: TagType,
    pub timestamp: u32,
    pub stream_id: u32,
    pub body: &'a [u8],
}
Expand description

One FLV tag (§E.4.1): its header fields, body, and the PreviousTagSize that follows it, so a single value is a self-contained slice of an FLV stream.

Fields§

§tag_type: TagType

TagType byte (§E.4.1).

§timestamp: u32

Millisecond timestamp: the UI24 Timestamp field plus the UI8 TimestampExtended as its top byte (§E.4.1).

§stream_id: u32

StreamID (§E.4.1), zero for every tag this crate writes.

§body: &'a [u8]

The tag’s Data bytes (DataSize long).

Implementations§

Source§

impl<'a> FlvTag<'a>

Source

pub fn new(tag_type: TagType, timestamp: u32, body: &'a [u8]) -> Self

A tag on the stream every FLV stream uses (StreamID 0).

Source

pub fn previous_tag_size(&self) -> Result<u32, RtmpError>

The value of the PreviousTagSize field following this tag (§E.4.1): the tag’s header and body, excluding that field itself.

Source

pub fn data_size(bytes: &'a [u8]) -> Result<usize, RtmpError>

The tag’s declared DataSize (§E.4.1), read from bytes’ first FLV_TAG_HEADER_LEN bytes — how many body bytes the tag claims, whether or not they have all arrived yet.

§Errors

RtmpError::BufferTooShort if bytes does not hold a full header.

Trait Implementations§

Source§

impl<'a> Clone for FlvTag<'a>

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<'a> Debug for FlvTag<'a>

Source§

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

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

impl<'de: 'a, 'a> Deserialize<'de> for FlvTag<'a>

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> Eq for FlvTag<'a>

Source§

impl<'a> Parse<'a> for FlvTag<'a>

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

impl<'a> PartialEq for FlvTag<'a>

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<'a> Serialize for FlvTag<'a>

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Serialize for FlvTag<'_>

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§

impl<'a> StructuralPartialEq for FlvTag<'a>

Auto Trait Implementations§

§

impl<'a> Forget for FlvTag<'a>

§

impl<'a> Freeze for FlvTag<'a>

§

impl<'a> Move for FlvTag<'a>

§

impl<'a> RefUnwindSafe for FlvTag<'a>

§

impl<'a> Send for FlvTag<'a>

§

impl<'a> Sync for FlvTag<'a>

§

impl<'a> Unpin for FlvTag<'a>

§

impl<'a> UnsafeUnpin for FlvTag<'a>

§

impl<'a> UnwindSafe for FlvTag<'a>

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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