pub struct Packet {
pub header: PrimaryHeader,
pub data: Vec<u8>,
}Expand description
Packet represents a single CCSDS space packet and its associated data.
This packet contains the primary header data as well as the user data,
which may or may not container a secondary header. See the header’s
has_secondary_header flag.
§Example
Create a packet from the minimum number of bytes.
use ccsds::{Packet, PrimaryHeader};
let dat: &[u8] = &[
// primary header bytes
0xd, 0x59, 0xd2, 0xab, 0x0, 07,
// CDS timecode bytes in secondary header (not decoded here)
0x52, 0xc0, 0x0, 0x0, 0x0, 0xa7, 0x0, 0xdb, 0xff,
// minimum 1 byte of user data
0xff
];
let mut r = std::io::BufReader::new(dat);
let packet = Packet::read(&mut r).unwrap();Fields§
§header: PrimaryHeaderAll packets have a primary header
data: Vec<u8>All packet bytes, including header and user data
Implementations§
source§impl Packet
impl Packet
pub fn is_first(&self) -> bool
pub fn is_last(&self) -> bool
pub fn is_cont(&self) -> bool
pub fn is_standalone(&self) -> bool
Trait Implementations§
source§impl<'de> Deserialize<'de> for Packet
impl<'de> Deserialize<'de> for Packet
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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