cargo fmt

This commit is contained in:
Robin Müller 2022-06-14 17:56:22 +02:00
parent 2b4eb1c8b6
commit 8a3f53145b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -57,12 +57,12 @@ pub struct PacketId {
impl PacketId {
pub fn new(ptype: PacketType, sec_header_flag: bool, apid: u16) -> Option<PacketId> {
if apid > num::pow(2, 11) - 1 {
return None
return None;
}
Some(PacketId{
Some(PacketId {
ptype,
sec_header_flag,
apid
apid,
})
}
@ -102,19 +102,16 @@ pub struct PacketSequenceCtrl {
impl PacketSequenceCtrl {
pub fn new(seq_flags: SequenceFlags, ssc: u16) -> Option<PacketSequenceCtrl> {
if ssc > num::pow(2, 14) - 1 {
return None
return None;
}
Some(PacketSequenceCtrl {
seq_flags,
ssc
})
Some(PacketSequenceCtrl { seq_flags, ssc })
}
pub fn raw(&self) -> u16 {
((self.seq_flags as u16) << 14) | self.ssc
}
pub fn set_ssc(&mut self, ssc: u16) -> bool {
if ssc > num::pow(2, 14) - 1 {
return false
return false;
}
self.ssc = ssc;
true