pub struct UsbPacketBuilder<B> { /* private fields */ }
Expand description
Builds an aggregate usb packet out of vsock packets and gives readiness notifications when there is room to add another packet or data available to send.
Implementations§
Source§impl<B> UsbPacketBuilder<B>
impl<B> UsbPacketBuilder<B>
Source§impl<B> UsbPacketBuilder<B>
impl<B> UsbPacketBuilder<B>
Sourcepub fn available(&self) -> usize
pub fn available(&self) -> usize
Gets the space currently available for another packet in the buffer
Sourcepub fn write_vsock_packet(
&mut self,
packet: &Packet<'_>,
) -> Result<(), PacketTooBigError>
pub fn write_vsock_packet( &mut self, packet: &Packet<'_>, ) -> Result<(), PacketTooBigError>
Writes the given packet into the buffer. The packet and header must be able to fit within the buffer provided at creation time.
Sourcepub fn take_usb_packet(&mut self) -> Option<&mut [u8]>
pub fn take_usb_packet(&mut self) -> Option<&mut [u8]>
Takes the current usb packet, if there is one. The returned mutable slice will be only the data written to the buffer so far, and packet writing will be reset to the beginning of the buffer.
Auto Trait Implementations§
impl<B> !Freeze for UsbPacketBuilder<B>
impl<B> !RefUnwindSafe for UsbPacketBuilder<B>
impl<B> Send for UsbPacketBuilder<B>where
B: Send,
impl<B> Sync for UsbPacketBuilder<B>where
B: Sync,
impl<B> Unpin for UsbPacketBuilder<B>where
B: Unpin,
impl<B> UnwindSafe for UsbPacketBuilder<B>where
B: 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