#[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
impl ScalarType
Sourcepub fn from_name(name: &str) -> ScalarType
pub fn from_name(name: &str) -> ScalarType
Parse the schema’s name for a scalar type.
Sourcepub fn size(self) -> u64
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.
Sourcepub fn is_numeric(self) -> bool
pub fn is_numeric(self) -> bool
Whether this is a numeric type this library can convert between.
Sourcepub fn bytes_per_char(self) -> u64
pub fn bytes_per_char(self) -> u64
Bytes per character, for the string types.
Trait Implementations§
Source§impl Clone for ScalarType
impl Clone for ScalarType
Source§fn clone(&self) -> ScalarType
fn clone(&self) -> ScalarType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more