Skip to main content

ScalarType

Enum ScalarType 

Source
#[repr(i32)]
pub enum ScalarType {
Show 18 variants Unknown = 0, Int8 = 1, Uint8 = 2, Int16 = 3, Uint16 = 4, Int32 = 5, Uint32 = 6, Int64 = 7, Uint64 = 8, Float16 = 9, Float32 = 10, Float64 = 11, Complex64 = 12, Complex128 = 13, Bool8 = 14, Ascii = 15, Ucs4 = 16, Structured = 17,
}
Expand description

The scalar element types, mirroring asdf_scalar_datatype_t.

Discriminants are part of the C ABI and must not be reordered.

Variants§

§

Unknown = 0

Unsupported or unrecognised.

§

Int8 = 1

Signed 8-bit integer.

§

Uint8 = 2

Unsigned 8-bit integer.

§

Int16 = 3

Signed 16-bit integer.

§

Uint16 = 4

Unsigned 16-bit integer.

§

Int32 = 5

Signed 32-bit integer.

§

Uint32 = 6

Unsigned 32-bit integer.

§

Int64 = 7

Signed 64-bit integer.

§

Uint64 = 8

Unsigned 64-bit integer.

§

Float16 = 9

Half-precision float.

§

Float32 = 10

Single-precision float.

§

Float64 = 11

Double-precision float.

§

Complex64 = 12

A pair of float32s.

§

Complex128 = 13

A pair of float64s.

§

Bool8 = 14

An 8-bit boolean.

§

Ascii = 15

Fixed-length ASCII text, one byte per character.

§

Ucs4 = 16

Fixed-length UCS-4 text, four bytes per character.

§

Structured = 17

A compound or otherwise non-scalar type.

Implementations§

Source§

impl ScalarType

Source

pub fn from_name(name: &str) -> ScalarType

Parse the schema’s name for a scalar type.

Source

pub fn name(self) -> &'static str

The schema’s name for this type.

Source

pub fn size(self) -> u64

Bytes per element for a numeric type.

Returns 0 for the string and non-scalar types, whose width depends on a length the datatype must carry separately.

Source

pub fn is_numeric(self) -> bool

Whether this is a numeric type this library can convert between.

Source

pub fn is_string(self) -> bool

Whether this is one of the fixed-length string types.

Source

pub fn bytes_per_char(self) -> u64

Bytes per character, for the string types.

Trait Implementations§

Source§

impl Clone for ScalarType

Source§

fn clone(&self) -> ScalarType

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 ScalarType

Source§

impl Debug for ScalarType

Source§

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

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

impl Default for ScalarType

Source§

fn default() -> ScalarType

Returns the “default value” for a type. Read more
Source§

impl Eq for ScalarType

Source§

impl PartialEq for ScalarType

Source§

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.