Skip to main content

TableColumnFormat

Enum TableColumnFormat 

Source
pub enum TableColumnFormat {
Show 16 variants String(usize), StringArray(usize, usize), Boolean(usize), Bit(usize), U8(usize), I8(usize), U16(usize), I16(usize), U32(usize), I32(usize), I64(usize), F32(usize), F64(usize), C32(usize), M64(usize), VariableLengthArray { element: TableElementFormat, descriptor: ArrayDescriptor, max: usize, },
}
Expand description

The type and repeat count of one binary table column, from its TFORMn card.

The contained count is the TFORMn repeat count r, not a byte length; use TableColumnFormat::bytes_len for the width of the field in the row.

Variants§

§

String(usize)

rA: one string of r characters.

§

StringArray(usize, usize)

rAw: r characters holding r / w substrings of w characters.

§

Boolean(usize)

rL: r logical values, one byte each.

§

Bit(usize)

rX: r bits, packed into ceil(r / 8) bytes.

§

U8(usize)

rB: r unsigned bytes.

§

I8(usize)

rS: r signed bytes.

§

U16(usize)

rU: r unsigned 16-bit integers.

§

I16(usize)

rI: r signed 16-bit integers.

§

U32(usize)

rV: r unsigned 32-bit integers.

§

I32(usize)

rJ: r signed 32-bit integers.

§

I64(usize)

rK: r signed 64-bit integers.

§

F32(usize)

rE: r single precision floats.

§

F64(usize)

rD: r double precision floats.

§

C32(usize)

rC: r single precision complex values, two f32 each.

§

M64(usize)

rM: r double precision complex values, two f64 each.

§

VariableLengthArray

rPt(max) or rQt(max): a variable length array.

The row itself holds only a descriptor saying how many values there are and where in the table’s heap they start; the values live in the heap, after the last row.

Fields

§element: TableElementFormat

The type of the values in the heap.

§descriptor: ArrayDescriptor

Which descriptor the row carries: P for 32-bit, Q for 64-bit.

§max: usize

The (max) hint on the format, or 0 when it carries none. This is the longest array the column promises, not the length of any particular row’s array.

Implementations§

Source§

impl TableColumnFormat

Source

pub fn parse_into_value(&self, data: &[u8], heap: &[u8]) -> Result<Value>

Decodes this column out of the front of data, which must be the remainder of the row starting at this column’s offset.

heap is the table’s heap, which only a variable length array column reads from; pass an empty slice for a table that has none.

Source

pub fn bytes_len(&self) -> usize

Width of this column in the row, in bytes.

Every column’s offset is the sum of the widths before it, so a wrong answer here misaligns every following column.

Source

pub fn len(&self) -> usize

Number of elements this column holds.

Source

pub fn is_empty(&self) -> bool

Whether this column holds no elements at all.

Trait Implementations§

Source§

impl Clone for TableColumnFormat

Source§

fn clone(&self) -> TableColumnFormat

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 Copy for TableColumnFormat

Source§

impl Debug for TableColumnFormat

Source§

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

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

impl From<TableColumnFormat> for String

Source§

fn from(value: TableColumnFormat) -> String

Converts to this type from the input type.
Source§

impl PartialEq for TableColumnFormat

Source§

fn eq(&self, other: &TableColumnFormat) -> 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 TableColumnFormat

Source§

impl TryFrom<String> for TableColumnFormat

Source§

type Error = Box<dyn Error + Send + Sync>

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

fn try_from(value: String) -> Result<Self, Self::Error>

Performs the conversion.

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, <T as TryFrom<U>>::Error>

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.