Struct rtsp_types::Data
source · pub struct Data<Body> { /* private fields */ }Expand description
RTSP data message.
See RFC 7826 section 14 for details about the data message.
Implementations§
source§impl<Body> Data<Body>
impl<Body> Data<Body>
sourcepub fn new(channel_id: u8, body: Body) -> Self
pub fn new(channel_id: u8, body: Body) -> Self
Create a new data message for a given channel id and body.
sourcepub fn write<'b, W: Write + 'b>(&self, w: &'b mut W) -> Result<(), WriteError>
pub fn write<'b, W: Write + 'b>(&self, w: &'b mut W) -> Result<(), WriteError>
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.
sourcepub fn channel_id(&self) -> u8
pub fn channel_id(&self) -> u8
Get the channel id of the data message.
sourcepub fn set_channel_id(&mut self, channel_id: u8)
pub fn set_channel_id(&mut self, channel_id: u8)
Set the channel id of the data message.
sourcepub fn map_body<NewBody, F: FnOnce(Body) -> NewBody>(
self,
func: F,
) -> Data<NewBody>
pub fn map_body<NewBody, F: FnOnce(Body) -> NewBody>( self, func: F, ) -> Data<NewBody>
Modify the body of the data message with a closure.
sourcepub fn replace_body<NewBody>(self, new_body: NewBody) -> Data<NewBody>
pub fn replace_body<NewBody>(self, new_body: NewBody) -> Data<NewBody>
Replace the body of the data message with a different body.
Trait Implementations§
source§impl<BodyA, BodyB: PartialEq<BodyA>> PartialEq<Data<BodyA>> for Data<BodyB>
impl<BodyA, BodyB: PartialEq<BodyA>> PartialEq<Data<BodyA>> for Data<BodyB>
impl<Body: Eq> Eq for Data<Body>
Auto Trait Implementations§
impl<Body> Freeze for Data<Body>where
Body: Freeze,
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§
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