pub struct DataPacket {
pub node_id: u64,
pub port: u32,
pub timestamp_ms: u64,
pub data: Vec<u8>,
pub is_eos: bool,
}Expand description
A unit of data travelling between two ports in the processing graph.
Fields§
§node_id: u64ID of the node that produced this packet.
port: u32Output port index on the producing node.
timestamp_ms: u64Presentation timestamp in milliseconds.
data: Vec<u8>Raw payload bytes.
is_eos: boolIf true this is the last packet in the stream.
Implementations§
Source§impl DataPacket
impl DataPacket
Sourcepub fn new(node_id: u64, port: u32, timestamp_ms: u64, data: Vec<u8>) -> Self
pub fn new(node_id: u64, port: u32, timestamp_ms: u64, data: Vec<u8>) -> Self
Creates a normal (non-EOS) data packet.
Sourcepub fn eos(node_id: u64, port: u32, timestamp_ms: u64) -> Self
pub fn eos(node_id: u64, port: u32, timestamp_ms: u64) -> Self
Creates an end-of-stream sentinel packet with an empty payload.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Returns the size of the payload in bytes.
Sourcepub fn is_end_of_stream(&self) -> bool
pub fn is_end_of_stream(&self) -> bool
Returns true if this is an end-of-stream packet.
Trait Implementations§
Source§impl Clone for DataPacket
impl Clone for DataPacket
Source§fn clone(&self) -> DataPacket
fn clone(&self) -> DataPacket
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DataPacket
impl RefUnwindSafe for DataPacket
impl Send for DataPacket
impl Sync for DataPacket
impl Unpin for DataPacket
impl UnsafeUnpin for DataPacket
impl UnwindSafe for DataPacket
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more