pub struct VrtPacket<'a> {
pub header: Header,
pub stream_id: Option<u32>,
pub class_id: Option<ClassId>,
pub tsi: Option<u32>,
pub tsf: Option<u64>,
pub payload: &'a [u8],
pub trailer: Option<Trailer>,
}Expand description
VRT Packet
Fields§
§header: HeaderVRT Packet Header
stream_id: Option<u32>Optional Stream Id
class_id: Option<ClassId>Optional Class Id
tsi: Option<u32>Optional Integer-Seconds Timestamp
tsf: Option<u64>Optional Fractional-Seconds Timestamp
payload: &'a [u8]Data Payload
trailer: Option<Trailer>Optional VRT Packet Trailer
Implementations§
Source§impl VrtPacket<'_>
impl VrtPacket<'_>
Sourcepub fn serialize(&mut self, buffer: &mut [u8]) -> Result<usize, Error>
pub fn serialize(&mut self, buffer: &mut [u8]) -> Result<usize, Error>
Serialize the VITA-49 packet into the provided buffer.
§Arguments
buffer- The buffer to serialize the packet into.
§Returns
Ok(usize)- The number of bytes written to the buffer.Err(Error)- An error if the buffer is too small or if serialization fails.
§Example
use vrt::VrtPacket;
let mut packet = VrtPacket::default();
// Set the fields of the packet as needed
// packet.header.packet_type = ...;
let mut buffer = [0u8; 1024]; // Ensure the buffer is large enough
match packet.serialize(&mut buffer) {
Ok(size) => println!("Serialized {} bytes", size),
Err(e) => eprintln!("Error: {:?}", e),
}Trait Implementations§
impl<'a> StructuralPartialEq for VrtPacket<'a>
Auto Trait Implementations§
impl<'a> Freeze for VrtPacket<'a>
impl<'a> RefUnwindSafe for VrtPacket<'a>
impl<'a> Send for VrtPacket<'a>
impl<'a> Sync for VrtPacket<'a>
impl<'a> Unpin for VrtPacket<'a>
impl<'a> UnwindSafe for VrtPacket<'a>
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