Skip to main content

PackedSample

Struct PackedSample 

Source
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: f64

The timestamp. DEDUCED_TIMESTAMP means the reader derives it.

§values: PackedValues

Shared payload for all channels.

Implementations§

Source§

impl PackedSample

Source

pub fn from_raw_bytes(timestamp: f64, format: Format, bytes: Arc<[u8]>) -> Self

Build a packed numeric sample from pre-packed native-endian bytes.

Source

pub fn from_f32(timestamp: f64, values: &[f32]) -> Self

Build a packed Float32 sample directly from a flat slice.

Source

pub fn from_f64(timestamp: f64, values: &[f64]) -> Self

Build a packed Double64 sample directly from a flat slice.

Source

pub fn from_i32(timestamp: f64, values: &[i32]) -> Self

Build a packed Int32 sample directly from a flat slice.

Source

pub fn from_i16(timestamp: f64, values: &[i16]) -> Self

Build a packed Int16 sample directly from a flat slice.

Source

pub fn from_i8(timestamp: f64, values: &[i8]) -> Self

Build a packed Int8 sample directly from a flat slice.

Source

pub fn from_i64(timestamp: f64, values: &[i64]) -> Self

Build a packed Int64 sample directly from a flat slice.

Source

pub fn from_strings(timestamp: f64, values: Vec<Vec<u8>>) -> Self

Build a packed String sample from channel byte vectors.

Source

pub fn from_sample(s: &Sample) -> Self

Convert a Sample into a PackedSample.

Source

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.

Source

pub fn channel_count(&self) -> usize

Number of channels held in this sample.

Source

pub fn payload_bytes(&self) -> usize

Payload size in bytes, for bounded history accounting.

Source

pub fn as_numeric_bytes(&self, expected: Format) -> Option<&[u8]>

Raw native-endian bytes when this sample holds numeric values in expected format.

Source

pub fn push_into_f32(&self, dst: &mut Vec<f32>)

Append channel values into dst as f32, converting if the format differs.

Source

pub fn push_into_f64(&self, dst: &mut Vec<f64>)

Append channel values into dst as f64, converting if the format differs.

Source

pub fn push_into_i32(&self, dst: &mut Vec<i32>)

Append channel values into dst as i32, converting if the format differs.

Source

pub fn push_into_i16(&self, dst: &mut Vec<i16>)

Append channel values into dst as i16, converting if the format differs.

Source

pub fn push_into_i8(&self, dst: &mut Vec<i8>)

Append channel values into dst as i8, converting if the format differs.

Source

pub fn push_into_i64(&self, dst: &mut Vec<i64>)

Append channel values into dst as i64, converting if the format differs.

Source

pub fn to_sample(&self) -> Sample

Expand this packed sample back into a Sample holding Vec<Value>.

Trait Implementations§

Source§

impl Clone for PackedSample

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PackedSample

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&Sample> for PackedSample

Source§

fn from(s: &Sample) -> Self

Converts to this type from the input type.
Source§

impl From<Sample> for PackedSample

Source§

fn from(s: Sample) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PackedSample

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PackedSample

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.