Struct donet_core::dcnumeric::DCNumericType

source ·
pub struct DCNumericType {
    base_type: DCTypeDefinition,
    divisor: u16,
    orig_modulus: f64,
    orig_range: Option<DCNumericRange>,
    modulus: f64,
    range: Option<DCNumericRange>,
    explicit_cast: Option<DCTypeDefinition>,
}

Fields§

§base_type: DCTypeDefinition§divisor: u16§orig_modulus: f64

These are the original range and modulus values from the file, unscaled by the divisor.

§orig_range: Option<DCNumericRange>§modulus: f64

These are the range and modulus values after scaling by the divisor.

§range: Option<DCNumericRange>§explicit_cast: Option<DCTypeDefinition>

Specific to Donet’s DC language

Implementations§

source§

impl DCNumericType

source

pub fn has_modulus(&self) -> bool

source

pub fn has_range(&self) -> bool

source

pub fn get_divisor(&self) -> u16

source

pub fn get_modulus(&self) -> f64

source

pub fn get_range(&self) -> Option<DCNumericRange>

source

pub fn get_explicit_cast(&self) -> Option<DCTypeDefinition>

source

pub fn set_divisor(&mut self, divisor: u16) -> Result<(), String>

source

pub fn set_modulus(&mut self, modulus: f64) -> Result<(), String>

source

pub fn set_range(&mut self, range: DCNumericRange) -> Result<(), String>

source

pub fn set_explicit_cast( &mut self, dtype: DCTypeDefinition, ) -> Result<(), String>

source

pub fn within_range(&self, _data: Vec<u8>, _length: u64) -> Result<(), String>

source

fn _data_to_number(&self, data: Vec<u8>) -> (bool, DCNumber)

Trait Implementations§

source§

impl From<DCTypeEnum> for DCNumericType

source§

fn from(value: DCTypeEnum) -> Self

Converts to this type from the input type.
source§

impl LegacyDCHash for DCNumericType

source§

fn generate_hash(&self, hashgen: &mut DCHashGenerator)

Accumulates the properties of this DC element into the file hash.

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