cargo fmt
This commit is contained in:
parent
2b4eb1c8b6
commit
8a3f53145b
@ -57,12 +57,12 @@ pub struct PacketId {
|
|||||||
impl PacketId {
|
impl PacketId {
|
||||||
pub fn new(ptype: PacketType, sec_header_flag: bool, apid: u16) -> Option<PacketId> {
|
pub fn new(ptype: PacketType, sec_header_flag: bool, apid: u16) -> Option<PacketId> {
|
||||||
if apid > num::pow(2, 11) - 1 {
|
if apid > num::pow(2, 11) - 1 {
|
||||||
return None
|
return None;
|
||||||
}
|
}
|
||||||
Some(PacketId {
|
Some(PacketId {
|
||||||
ptype,
|
ptype,
|
||||||
sec_header_flag,
|
sec_header_flag,
|
||||||
apid
|
apid,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,19 +102,16 @@ pub struct PacketSequenceCtrl {
|
|||||||
impl PacketSequenceCtrl {
|
impl PacketSequenceCtrl {
|
||||||
pub fn new(seq_flags: SequenceFlags, ssc: u16) -> Option<PacketSequenceCtrl> {
|
pub fn new(seq_flags: SequenceFlags, ssc: u16) -> Option<PacketSequenceCtrl> {
|
||||||
if ssc > num::pow(2, 14) - 1 {
|
if ssc > num::pow(2, 14) - 1 {
|
||||||
return None
|
return None;
|
||||||
}
|
}
|
||||||
Some(PacketSequenceCtrl {
|
Some(PacketSequenceCtrl { seq_flags, ssc })
|
||||||
seq_flags,
|
|
||||||
ssc
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
pub fn raw(&self) -> u16 {
|
pub fn raw(&self) -> u16 {
|
||||||
((self.seq_flags as u16) << 14) | self.ssc
|
((self.seq_flags as u16) << 14) | self.ssc
|
||||||
}
|
}
|
||||||
pub fn set_ssc(&mut self, ssc: u16) -> bool {
|
pub fn set_ssc(&mut self, ssc: u16) -> bool {
|
||||||
if ssc > num::pow(2, 14) - 1 {
|
if ssc > num::pow(2, 14) - 1 {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
self.ssc = ssc;
|
self.ssc = ssc;
|
||||||
true
|
true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user