pub struct PackedSample {
pub timestamp: f64,
pub values: PackedValues,
}Expand description
One sample with reference-counted flat payload (docs/roadmap.md, step 8).
Fields§
§timestamp: f64The timestamp. DEDUCED_TIMESTAMP means the reader derives it.
values: PackedValuesShared payload for all channels.
Implementations§
Source§impl PackedSample
impl PackedSample
Sourcepub fn from_raw_bytes(timestamp: f64, format: Format, bytes: Arc<[u8]>) -> Self
pub fn from_raw_bytes(timestamp: f64, format: Format, bytes: Arc<[u8]>) -> Self
Build a packed numeric sample from pre-packed native-endian bytes.
Sourcepub fn from_f32(timestamp: f64, values: &[f32]) -> Self
pub fn from_f32(timestamp: f64, values: &[f32]) -> Self
Build a packed Float32 sample directly from a flat slice.
Sourcepub fn from_f64(timestamp: f64, values: &[f64]) -> Self
pub fn from_f64(timestamp: f64, values: &[f64]) -> Self
Build a packed Double64 sample directly from a flat slice.
Sourcepub fn from_i32(timestamp: f64, values: &[i32]) -> Self
pub fn from_i32(timestamp: f64, values: &[i32]) -> Self
Build a packed Int32 sample directly from a flat slice.
Sourcepub fn from_i16(timestamp: f64, values: &[i16]) -> Self
pub fn from_i16(timestamp: f64, values: &[i16]) -> Self
Build a packed Int16 sample directly from a flat slice.
Sourcepub fn from_i8(timestamp: f64, values: &[i8]) -> Self
pub fn from_i8(timestamp: f64, values: &[i8]) -> Self
Build a packed Int8 sample directly from a flat slice.
Sourcepub fn from_i64(timestamp: f64, values: &[i64]) -> Self
pub fn from_i64(timestamp: f64, values: &[i64]) -> Self
Build a packed Int64 sample directly from a flat slice.
Sourcepub fn from_strings(timestamp: f64, values: Vec<Vec<u8>>) -> Self
pub fn from_strings(timestamp: f64, values: Vec<Vec<u8>>) -> Self
Build a packed String sample from channel byte vectors.
Sourcepub fn from_sample(s: &Sample) -> Self
pub fn from_sample(s: &Sample) -> Self
Convert a Sample into a PackedSample.
Sourcepub fn with_timestamp(&self, timestamp: f64) -> Self
pub fn with_timestamp(&self, timestamp: f64) -> Self
Return a copy of this sample with a different timestamp, sharing the
underlying Arc payload with zero byte copies.
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Number of channels held in this sample.
Sourcepub fn payload_bytes(&self) -> usize
pub fn payload_bytes(&self) -> usize
Payload size in bytes, for bounded history accounting.
Sourcepub fn as_numeric_bytes(&self, expected: Format) -> Option<&[u8]>
pub fn as_numeric_bytes(&self, expected: Format) -> Option<&[u8]>
Raw native-endian bytes when this sample holds numeric values in expected format.
Sourcepub fn push_into_f32(&self, dst: &mut Vec<f32>)
pub fn push_into_f32(&self, dst: &mut Vec<f32>)
Append channel values into dst as f32, converting if the format differs.
Sourcepub fn push_into_f64(&self, dst: &mut Vec<f64>)
pub fn push_into_f64(&self, dst: &mut Vec<f64>)
Append channel values into dst as f64, converting if the format differs.
Sourcepub fn push_into_i32(&self, dst: &mut Vec<i32>)
pub fn push_into_i32(&self, dst: &mut Vec<i32>)
Append channel values into dst as i32, converting if the format differs.
Sourcepub fn push_into_i16(&self, dst: &mut Vec<i16>)
pub fn push_into_i16(&self, dst: &mut Vec<i16>)
Append channel values into dst as i16, converting if the format differs.
Sourcepub fn push_into_i8(&self, dst: &mut Vec<i8>)
pub fn push_into_i8(&self, dst: &mut Vec<i8>)
Append channel values into dst as i8, converting if the format differs.
Sourcepub fn push_into_i64(&self, dst: &mut Vec<i64>)
pub fn push_into_i64(&self, dst: &mut Vec<i64>)
Append channel values into dst as i64, converting if the format differs.