pub struct SpacePacket {
pub primary_header: PrimaryHeader,
pub payload: Vec<u8>,
}Expand description
SPP Packet as defined by the CCSDS 133.0-B-2 Standard.
Fields§
§primary_header: PrimaryHeaderPrimaryHeader of the Space Packet Protocol
payload: Vec<u8>Payload of Space Packet Protocol
Implementations§
Source§impl SpacePacket
impl SpacePacket
pub fn new( packet_type: PacketType, secondary_header: bool, apid: u16, sequence_flag: SequenceFlag, sequence_number: u16, payload: Vec<u8>, ) -> Self
Sourcepub fn decode(buf: &[u8]) -> Result<Self, Error>
pub fn decode(buf: &[u8]) -> Result<Self, Error>
Decodes the primary header from a slice of bytes. Returns the result of the operation, on success giving the decoded SpacePacket.
Decoding can fail for the following reasons:
- Incomplete header resulting in failure to parse PrimaryHeader
- Insufficient data resulting in failure to parse the user data
- Unsupported Space Packet Protocol resulting in failure to parse SpacePacket
Both Incomplete header and Insufficient data errors are recoverable. In most cases its the result of either corrupted data, or the source not supplying enough data to realize the completed SpacePacket. Unsupported Space Packet Protocol is recoverable but the crate does not support any Space Packet Protocol other then version 0.
Trait Implementations§
Source§impl Clone for SpacePacket
impl Clone for SpacePacket
Source§fn clone(&self) -> SpacePacket
fn clone(&self) -> SpacePacket
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpacePacket
impl Debug for SpacePacket
Source§impl PartialEq for SpacePacket
impl PartialEq for SpacePacket
impl StructuralPartialEq for SpacePacket
Auto Trait Implementations§
impl Freeze for SpacePacket
impl RefUnwindSafe for SpacePacket
impl Send for SpacePacket
impl Sync for SpacePacket
impl Unpin for SpacePacket
impl UnwindSafe for SpacePacket
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