Skip to main content

ComplexSlice

Struct ComplexSlice 

Source
pub struct ComplexSlice<'a, T>(pub &'a [Complex<T>]);
Expand description

A contiguous slice of complex values, serialized as a BEVE complex array with a single bulk write of the borrowed payload — the complex counterpart of TypedSlice.

Both families of complex-array helpers route through this type, so a field using either gets the bulk path with no further opt-in: the complex serialize_with helpers, and the encode half of the complex_array serde(with) helpers.

The encoded bytes are identical to serializing the same values one at a time, so this is a throughput change and not a format change; the complex_slice_bulk_matches_element_wise tests pin that.

An empty slice keeps the element-wise encoding (a generic empty array, not a zero-length complex array), which is what this wrapper has always written. That differs from TypedSlice, whose empty form is a typed empty array, and from crate::to_writer_complex_slice, whose empty form is a zero-length complex array. All three decode back to an empty Vec, but the distinction is visible to consumers that read the element type off the header — notably the MATLAB export, where a typed empty array becomes a cell and a generic one becomes [].

Tuple Fields§

§0: &'a [Complex<T>]

Trait Implementations§

Source§

impl<'a> Serialize for ComplexSlice<'a, f16>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, bf16>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, f32>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, f64>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, i8>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, i16>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, i32>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, i64>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, i128>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, u8>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, u16>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, u32>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, u64>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Serialize for ComplexSlice<'a, u128>

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for ComplexSlice<'a, T>
where &'a [Complex<T>]: Freeze,

§

impl<'a, T> RefUnwindSafe for ComplexSlice<'a, T>
where &'a [Complex<T>]: RefUnwindSafe,

§

impl<'a, T> Send for ComplexSlice<'a, T>
where &'a [Complex<T>]: Send,

§

impl<'a, T> Sync for ComplexSlice<'a, T>
where &'a [Complex<T>]: Sync,

§

impl<'a, T> Unpin for ComplexSlice<'a, T>
where &'a [Complex<T>]: Unpin,

§

impl<'a, T> UnsafeUnpin for ComplexSlice<'a, T>
where &'a [Complex<T>]: UnsafeUnpin,

§

impl<'a, T> UnwindSafe for ComplexSlice<'a, T>
where &'a [Complex<T>]: UnwindSafe,

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> 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, 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.