[][src]Struct rtsp_types::Data

pub struct Data<Body> { /* fields omitted */ }

RTSP data message.

See RFC 7826 section 14 for details about the data message.

Implementations

impl<Body> Data<Body>[src]

pub fn new(channel_id: u8, body: Body) -> Self[src]

Create a new data message for a given channel id and body.

pub fn write<'b, W: Write + 'b>(&self, w: &'b mut W) -> Result<(), WriteError> where
    Body: AsRef<[u8]>, 
[src]

Serialize the data to any std::io::Write.

Resuming writing after std::io::ErrorKind::WouldBlock is not supported. Any previously written data will have to be discarded for resuming.

pub fn write_len(&self) -> u64 where
    Body: AsRef<[u8]>, 
[src]

Calculate the number of bytes needed to serialize the data.

pub fn channel_id(&self) -> u8[src]

Get the channel id of the data message.

pub fn set_channel_id(&mut self, channel_id: u8)[src]

Set the channel id of the data message.

pub fn len(&self) -> usize where
    Body: AsRef<[u8]>, 
[src]

Get the length of the data message.

pub fn is_empty(&self) -> bool where
    Body: AsRef<[u8]>, 
[src]

Check if the body of the data message is empty.

pub fn as_slice(&self) -> &[u8] where
    Body: AsRef<[u8]>, 
[src]

Get a &[u8] slice for the body of the data message.

pub fn into_body(self) -> Body[src]

Convert the data message into its body.

pub fn map_body<NewBody, F: FnOnce(Body) -> NewBody>(
    self,
    func: F
) -> Data<NewBody>
[src]

Modify the body of the data message with a closure.

pub fn replace_body<NewBody>(self, new_body: NewBody) -> Data<NewBody>[src]

Replace the body of the data message with a different body.

impl Data<Vec<u8>>[src]

pub fn from_vec(channel_id: u8, body: Vec<u8>) -> Self[src]

Create a new data message from a Vec<u8>.

Trait Implementations

impl<Body: AsRef<[u8]>> AsRef<[u8]> for Data<Body>[src]

impl<Body: Clone> Clone for Data<Body>[src]

impl<Body: Debug> Debug for Data<Body>[src]

impl<Body: Eq> Eq for Data<Body>[src]

impl<BodyA, BodyB: PartialEq<BodyA>> PartialEq<Data<BodyA>> for Data<BodyB>[src]

impl<Body> StructuralEq for Data<Body>[src]

Auto Trait Implementations

impl<Body> RefUnwindSafe for Data<Body> where
    Body: RefUnwindSafe

impl<Body> Send for Data<Body> where
    Body: Send

impl<Body> Sync for Data<Body> where
    Body: Sync

impl<Body> Unpin for Data<Body> where
    Body: Unpin

impl<Body> UnwindSafe for Data<Body> where
    Body: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<A, T> AsBits<T> for A where
    A: AsRef<[T]>,
    T: BitStore + BitRegister, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.