DataType

Enum DataType 

Source
pub enum DataType {
Show 21 variants Bool, F32, F64, I32, I64, U8, U64, Usize, Str, String, Object, OptBool, OptF32, OptF64, OptI32, OptI64, OptUsize, VecUsize, DateTime(TimeUnit), TimeDelta, Unknown,
}
Expand description

Represents the various data types supported by the system.

This enum encapsulates both primitive and complex data types, including numeric types, strings, optional types, and time-related types (when the “time” feature is enabled).

Variants§

§

Bool

Boolean type

§

F32

32-bit floating point type

§

F64

64-bit floating point type

§

I32

32-bit signed integer type

§

I64

64-bit signed integer type

§

U8

8-bit unsigned integer type

§

U64

64-bit unsigned integer type

§

Usize

Platform-specific size type

§

Str

String slice type

§

String

Owned String type

§

Object

Generic Object type

§

OptBool

Optional Boolean type

§

OptF32

Optional 32-bit floating point type

§

OptF64

Optional 64-bit floating point type

§

OptI32

Optional 32-bit signed integer type

§

OptI64

Optional 64-bit signed integer type

§

OptUsize

Optional platform-specific size type

§

VecUsize

Vector of platform-specific size type

§

DateTime(TimeUnit)

DateTime type with specified TimeUnit (only available with “time” feature)

§

TimeDelta

TimeDelta type (only available with “time” feature)

§

Unknown

Unknown type

Implementations§

Source§

impl DataType

Source

pub fn is_float(&self) -> bool

Checks if the DataType is a floating-point type.

§Returns

true if the DataType is F32, F64, OptF32, or OptF64, false otherwise.

Source

pub fn is_int(&self) -> bool

Checks if the DataType is an integer type.

§Returns

true if the DataType is I32, I64, Usize, U64, OptUsize, OptI32, or OptI64, false otherwise.

Source

pub fn is_time(&self) -> bool

Checks if the DataType is a time-related type.

§Returns

true if the DataType is DateTime (when the “time” feature is enabled), false otherwise.

Source

pub fn float(self) -> Self

Converts the DataType to its floating-point equivalent.

§Returns

A new DataType that represents the floating-point equivalent of the current type.

Source

pub fn int(self) -> Self

Converts the DataType to its integer equivalent.

§Returns

A new DataType that represents the integer equivalent of the current type.

Trait Implementations§

Source§

impl Debug for DataType

Source§

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

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

impl PartialEq for DataType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for DataType

Source§

impl StructuralPartialEq for DataType

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

Source§

fn cast(self) -> T

Casts the value to the target type T. 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 = Infallible

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.