this should make clippy happy
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
All checks were successful
Rust/spacepackets/pipeline/head This commit looks good
This commit is contained in:
parent
3b11af8d4a
commit
35073a45a5
@ -12,7 +12,7 @@ pub const CRC_CCITT_FALSE: Crc<u16> = Crc::<u16>::new(&CRC_16_IBM_3740);
|
|||||||
pub const CCSDS_HEADER_LEN: usize = size_of::<crate::zc::SpHeader>();
|
pub const CCSDS_HEADER_LEN: usize = size_of::<crate::zc::SpHeader>();
|
||||||
|
|
||||||
/// All PUS versions. Only PUS C is supported by this library.
|
/// All PUS versions. Only PUS C is supported by this library.
|
||||||
#[derive(PartialEq, Copy, Clone, Serialize, Deserialize, Debug)]
|
#[derive(PartialEq, Eq, Copy, Clone, Serialize, Deserialize, Debug)]
|
||||||
pub enum PusVersion {
|
pub enum PusVersion {
|
||||||
EsaPus = 0,
|
EsaPus = 0,
|
||||||
PusA = 1,
|
PusA = 1,
|
||||||
@ -33,7 +33,7 @@ impl TryFrom<u8> for PusVersion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum PusError {
|
pub enum PusError {
|
||||||
VersionNotSupported(PusVersion),
|
VersionNotSupported(PusVersion),
|
||||||
IncorrectCrc(u16),
|
IncorrectCrc(u16),
|
||||||
|
14
src/lib.rs
14
src/lib.rs
@ -59,12 +59,12 @@ pub mod tc;
|
|||||||
pub mod time;
|
pub mod time;
|
||||||
pub mod tm;
|
pub mod tm;
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub struct SizeMissmatch {
|
pub struct SizeMissmatch {
|
||||||
pub found: usize,
|
pub found: usize,
|
||||||
pub expected: usize,
|
pub expected: usize,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum PacketError {
|
pub enum PacketError {
|
||||||
/// The passed slice is too small. Returns the found and expected minimum size
|
/// The passed slice is too small. Returns the found and expected minimum size
|
||||||
ToBytesSliceTooSmall(SizeMissmatch),
|
ToBytesSliceTooSmall(SizeMissmatch),
|
||||||
@ -75,7 +75,7 @@ pub enum PacketError {
|
|||||||
FromBytesZeroCopyError,
|
FromBytesZeroCopyError,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub enum PacketType {
|
pub enum PacketType {
|
||||||
Tm = 0,
|
Tm = 0,
|
||||||
Tc = 1,
|
Tc = 1,
|
||||||
@ -97,7 +97,7 @@ pub fn packet_type_in_raw_packet_id(packet_id: u16) -> PacketType {
|
|||||||
PacketType::try_from((packet_id >> 12) as u8 & 0b1).unwrap()
|
PacketType::try_from((packet_id >> 12) as u8 & 0b1).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub enum SequenceFlags {
|
pub enum SequenceFlags {
|
||||||
ContinuationSegment = 0b00,
|
ContinuationSegment = 0b00,
|
||||||
FirstSegment = 0b01,
|
FirstSegment = 0b01,
|
||||||
@ -121,7 +121,7 @@ impl TryFrom<u8> for SequenceFlags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub struct PacketId {
|
pub struct PacketId {
|
||||||
pub ptype: PacketType,
|
pub ptype: PacketType,
|
||||||
pub sec_header_flag: bool,
|
pub sec_header_flag: bool,
|
||||||
@ -168,7 +168,7 @@ impl From<u16> for PacketId {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub struct PacketSequenceCtrl {
|
pub struct PacketSequenceCtrl {
|
||||||
pub seq_flags: SequenceFlags,
|
pub seq_flags: SequenceFlags,
|
||||||
seq_count: u16,
|
seq_count: u16,
|
||||||
@ -314,7 +314,7 @@ pub trait CcsdsPrimaryHeader {
|
|||||||
/// 13 bits of the first two bytes of the raw header
|
/// 13 bits of the first two bytes of the raw header
|
||||||
/// * `psc` - Packet Sequence Control, occupies the third and fourth byte of the raw header
|
/// * `psc` - Packet Sequence Control, occupies the third and fourth byte of the raw header
|
||||||
/// * `data_len` - Data length field occupies the fifth and the sixth byte of the raw header
|
/// * `data_len` - Data length field occupies the fifth and the sixth byte of the raw header
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Copy, Clone)]
|
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub struct SpHeader {
|
pub struct SpHeader {
|
||||||
pub version: u8,
|
pub version: u8,
|
||||||
pub packet_id: PacketId,
|
pub packet_id: PacketId,
|
||||||
|
@ -134,7 +134,7 @@ pub mod zc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Copy, Clone, Serialize, Deserialize, Debug)]
|
#[derive(PartialEq, Eq, Copy, Clone, Serialize, Deserialize, Debug)]
|
||||||
pub struct PusTcSecondaryHeader {
|
pub struct PusTcSecondaryHeader {
|
||||||
pub service: u8,
|
pub service: u8,
|
||||||
pub subservice: u8,
|
pub subservice: u8,
|
||||||
@ -209,7 +209,7 @@ impl PusTcSecondaryHeader {
|
|||||||
/// [postcard](https://docs.rs/postcard/latest/postcard/).
|
/// [postcard](https://docs.rs/postcard/latest/postcard/).
|
||||||
///
|
///
|
||||||
/// There is no spare bytes support yet.
|
/// There is no spare bytes support yet.
|
||||||
#[derive(PartialEq, Copy, Clone, Serialize, Deserialize, Debug)]
|
#[derive(PartialEq, Eq, Copy, Clone, Serialize, Deserialize, Debug)]
|
||||||
pub struct PusTc<'slice> {
|
pub struct PusTc<'slice> {
|
||||||
sp_header: SpHeader,
|
sp_header: SpHeader,
|
||||||
pub sec_header: PusTcSecondaryHeader,
|
pub sec_header: PusTcSecondaryHeader,
|
||||||
|
@ -14,7 +14,7 @@ pub const CDS_SHORT_LEN: usize = 7;
|
|||||||
pub const DAYS_CCSDS_TO_UNIX: i32 = -4383;
|
pub const DAYS_CCSDS_TO_UNIX: i32 = -4383;
|
||||||
pub const SECONDS_PER_DAY: u32 = 86400;
|
pub const SECONDS_PER_DAY: u32 = 86400;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Copy, Clone)]
|
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||||
pub enum CcsdsTimeCodes {
|
pub enum CcsdsTimeCodes {
|
||||||
None = 0,
|
None = 0,
|
||||||
CucCcsdsEpoch = 0b001,
|
CucCcsdsEpoch = 0b001,
|
||||||
@ -38,7 +38,7 @@ impl TryFrom<u8> for CcsdsTimeCodes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum TimestampError {
|
pub enum TimestampError {
|
||||||
/// Contains tuple where first value is the expected time code and the second
|
/// Contains tuple where first value is the expected time code and the second
|
||||||
/// value is the found raw value
|
/// value is the found raw value
|
||||||
|
@ -103,7 +103,7 @@ pub mod zc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Serialize, Deserialize, Copy, Clone, Debug)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Copy, Clone, Debug)]
|
||||||
pub struct PusTmSecondaryHeader<'slice> {
|
pub struct PusTmSecondaryHeader<'slice> {
|
||||||
pus_version: PusVersion,
|
pus_version: PusVersion,
|
||||||
pub sc_time_ref_status: u8,
|
pub sc_time_ref_status: u8,
|
||||||
@ -197,7 +197,7 @@ impl<'slice> TryFrom<zc::PusTmSecHeader<'slice>> for PusTmSecondaryHeader<'slice
|
|||||||
/// [postcard](https://docs.rs/postcard/latest/postcard/).
|
/// [postcard](https://docs.rs/postcard/latest/postcard/).
|
||||||
///
|
///
|
||||||
/// There is no spare bytes support yet.
|
/// There is no spare bytes support yet.
|
||||||
#[derive(PartialEq, Serialize, Deserialize, Debug, Copy, Clone)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Copy, Clone)]
|
||||||
pub struct PusTm<'slice> {
|
pub struct PusTm<'slice> {
|
||||||
pub sp_header: SpHeader,
|
pub sp_header: SpHeader,
|
||||||
pub sec_header: PusTmSecondaryHeader<'slice>,
|
pub sec_header: PusTmSecondaryHeader<'slice>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user