pub struct TofPacket {
pub packet_type: PacketType,
pub payload: Vec<u8>,
pub no_write_to_disk: bool,
pub no_send_over_nw: bool,
pub creation_time: Instant,
pub valid: bool,
}
Expand description
The most basic of all packets
A type and a payload. This wraps all other packets.
Format when in bytestream HEAD : u16 PAYLOAD_SIZE : u32 PAYLOAD : [u8;PAYLOAD_SIZE] TAIL : u16
=> Fixed size is 13
Fields§
§packet_type: PacketType
Type of the structure encoded in payload
payload: Vec<u8>
The bytestream encoded structure
no_write_to_disk: bool
mark a packet as not eligible to be written to disk
no_send_over_nw: bool
mark a packet as not eligible to be sent over network FIXME - future extension
creation_time: Instant
creation_time for the instance
valid: bool
Implementations§
Source§impl TofPacket
impl TofPacket
pub fn new() -> Self
Sourcepub fn zmq_payload_brdcast(&self) -> Vec<u8> ⓘ
pub fn zmq_payload_brdcast(&self) -> Vec<u8> ⓘ
Generate a bytestream of self for ZMQ, prefixed with BRCT so all RBs will see it
Sourcepub fn zmq_payload_rb(&self, rb_id: u8) -> Vec<u8> ⓘ
pub fn zmq_payload_rb(&self, rb_id: u8) -> Vec<u8> ⓘ
Generate a bytestream of self for ZMQ, prefixed with RBX, to address only a certain board
Sourcepub fn unpack<T>(&self) -> Result<T, SerializationError>where
T: Packable + Serialization,
pub fn unpack<T>(&self) -> Result<T, SerializationError>where
T: Packable + Serialization,
Unpack the TofPacket and return its content
pub fn age(&self) -> u64
Trait Implementations§
Source§impl CRSerializeable for TofPacket
impl CRSerializeable for TofPacket
Source§fn deserialize(
stream: &Vec<u8>,
pos: &mut usize,
) -> Result<Self, CRSerializationError>
fn deserialize( stream: &Vec<u8>, pos: &mut usize, ) -> Result<Self, CRSerializationError>
const CRHEAD: u16 = 43_690u16
const CRTAIL: u16 = 21_845u16
Source§const CRSIZE: usize = 0usize
const CRSIZE: usize = 0usize
Source§fn verify_fixed(
stream: &Vec<u8>,
pos: &mut usize,
) -> Result<(), CRSerializationError>
fn verify_fixed( stream: &Vec<u8>, pos: &mut usize, ) -> Result<(), CRSerializationError>
Source§impl Frameable for TofPacket
impl Frameable for TofPacket
const CRFRAMEOBJECT_TYPE: CRFrameObjectType = CRFrameObjectType::TofPacket
Source§fn pack(&self) -> CRFrameObjectwhere
Self: CRSerializeable,
fn pack(&self) -> CRFrameObjectwhere
Self: CRSerializeable,
Source§impl From<&CPUMoniData> for TofPacket
impl From<&CPUMoniData> for TofPacket
Source§fn from(moni: &CPUMoniData) -> Self
fn from(moni: &CPUMoniData) -> Self
Source§impl From<&MasterTriggerEvent> for TofPacket
impl From<&MasterTriggerEvent> for TofPacket
Source§fn from(mt: &MasterTriggerEvent) -> TofPacket
fn from(mt: &MasterTriggerEvent) -> TofPacket
Source§impl From<&MtbMoniData> for TofPacket
impl From<&MtbMoniData> for TofPacket
Source§fn from(moni: &MtbMoniData) -> TofPacket
fn from(moni: &MtbMoniData) -> TofPacket
Source§impl From<&RBCalibrations> for TofPacket
impl From<&RBCalibrations> for TofPacket
Source§fn from(calib: &RBCalibrations) -> Self
fn from(calib: &RBCalibrations) -> Self
Source§impl From<&RBEventHeader> for TofPacket
impl From<&RBEventHeader> for TofPacket
Source§fn from(ev_header: &RBEventHeader) -> TofPacket
fn from(ev_header: &RBEventHeader) -> TofPacket
Source§impl From<&RBWaveform> for TofPacket
FIXME - all these can go away now, because we have the
Packable trait! Amazing!
impl From<&RBWaveform> for TofPacket
FIXME - all these can go away now, because we have the Packable trait! Amazing!
Source§fn from(rbwave: &RBWaveform) -> Self
fn from(rbwave: &RBWaveform) -> Self
Source§impl From<&TofCommand> for TofPacket
impl From<&TofCommand> for TofPacket
Source§fn from(cmd: &TofCommand) -> Self
fn from(cmd: &TofCommand) -> Self
Source§impl From<&TofEventSummary> for TofPacket
impl From<&TofEventSummary> for TofPacket
Source§fn from(tsum: &TofEventSummary) -> Self
fn from(tsum: &TofEventSummary) -> Self
Source§impl From<&mut RBCalibrations> for TofPacket
impl From<&mut RBCalibrations> for TofPacket
Source§fn from(calib: &mut RBCalibrations) -> Self
fn from(calib: &mut RBCalibrations) -> Self
Source§impl PartialEq for TofPacket
Implement because TofPacket saves the creation time,
which never will be the same for 2 different instances
impl PartialEq for TofPacket
Implement because TofPacket saves the creation time, which never will be the same for 2 different instances
Source§impl Serialization for TofPacket
impl Serialization for TofPacket
const HEAD: u16 = 43_690u16
const TAIL: u16 = 21_845u16
Source§const SIZE: usize = 0usize
const SIZE: usize = 0usize
Source§fn from_bytestream(
stream: &Vec<u8>,
pos: &mut usize,
) -> Result<Self, SerializationError>
fn from_bytestream( stream: &Vec<u8>, pos: &mut usize, ) -> Result<Self, SerializationError>
Source§fn verify_fixed(
stream: &Vec<u8>,
pos: &mut usize,
) -> Result<(), SerializationError>
fn verify_fixed( stream: &Vec<u8>, pos: &mut usize, ) -> Result<(), SerializationError>
Source§fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>where
Self: Sized,
fn from_tofpacket(packet: &TofPacket) -> Result<Self, SerializationError>where
Self: Sized,
fn from_slice(
_slice: &[u8],
_start_pos: usize,
) -> Result<Self, SerializationError>where
Self: Sized,
Auto Trait Implementations§
impl Freeze for TofPacket
impl RefUnwindSafe for TofPacket
impl Send for TofPacket
impl Sync for TofPacket
impl Unpin for TofPacket
impl UnwindSafe for TofPacket
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT
modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL
modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self
to an expression for Diesel’s query builder. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString
. Read more