pub struct Integer(pub BigInt);Tuple Fields§
§0: BigIntImplementations§
Source§impl Integer
impl Integer
pub fn new<T: Into<BigInt>>(value: T) -> Self
Sourcepub fn try_from_string(s: &str) -> Result<Self, NumberParseError>
pub fn try_from_string(s: &str) -> Result<Self, NumberParseError>
Parse an integer from a string in base 10. Returns an error if the string is not a valid integer.
Sourcepub fn from_string_radix(s: &str, radix: u32) -> Result<Self, NumberParseError>
pub fn from_string_radix(s: &str, radix: u32) -> Result<Self, NumberParseError>
Parse an integer from a string in the given radix (base). Returns an error if the string is not a valid integer in the given radix.
Sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Returns true if the integer is negative. Note that zero is neither positive nor negative.
Sourcepub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Returns true if the integer is positive. Note that zero is neither positive nor negative.
Sourcepub fn as_i8(&self) -> Option<i8>
pub fn as_i8(&self) -> Option<i8>
Converts the integer to an i8 if it fits, otherwise returns None.
Sourcepub fn as_u8(&self) -> Option<u8>
pub fn as_u8(&self) -> Option<u8>
Converts the integer to a u8 if it fits, otherwise returns None.
Sourcepub fn as_i16(&self) -> Option<i16>
pub fn as_i16(&self) -> Option<i16>
Converts the integer to an i16 if it fits, otherwise returns None.
Sourcepub fn as_u16(&self) -> Option<u16>
pub fn as_u16(&self) -> Option<u16>
Converts the integer to a u16 if it fits, otherwise returns None.
Sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
Converts the integer to an i32 if it fits, otherwise returns None.
Sourcepub fn as_u32(&self) -> Option<u32>
pub fn as_u32(&self) -> Option<u32>
Converts the integer to a u32 if it fits, otherwise returns None.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Converts the integer to an i64 if it fits, otherwise returns None.
Sourcepub fn as_usize(&self) -> Option<usize>
pub fn as_usize(&self) -> Option<usize>
Converts the integer to a usize if it fits, otherwise returns None.
Sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Converts the integer to a u64 if it fits, otherwise returns None.
Sourcepub fn as_i128(&self) -> Option<i128>
pub fn as_i128(&self) -> Option<i128>
Converts the integer to an i128 if it fits, otherwise returns None.
Sourcepub fn as_u128(&self) -> Option<u128>
pub fn as_u128(&self) -> Option<u128>
Converts the integer to a u128 if it fits, otherwise returns None.
pub fn as_f32(&self) -> f32
pub fn as_f64(&self) -> f64
Sourcepub fn as_wrapped_i8(&self) -> i8
pub fn as_wrapped_i8(&self) -> i8
Converts the integer to an i8, wrapping on overflow.
Sourcepub fn as_wrapped_u8(&self) -> u8
pub fn as_wrapped_u8(&self) -> u8
Converts the integer to a u8, wrapping on overflow.
pub fn as_wrapped_i16(&self) -> i16
pub fn as_wrapped_u16(&self) -> u16
pub fn as_wrapped_i32(&self) -> i32
pub fn as_wrapped_u32(&self) -> u32
pub fn as_wrapped_i64(&self) -> i64
pub fn as_wrapped_u64(&self) -> u64
pub fn as_wrapped_i128(&self) -> i128
pub fn as_wrapped_u128(&self) -> u128
Sourcepub fn to_smallest_fitting(&self) -> TypedInteger
pub fn to_smallest_fitting(&self) -> TypedInteger
Converts the integer to the smallest fitting TypedInteger variant. If it doesn’t fit in any smaller type, returns TypedInteger::Big.
Trait Implementations§
Source§impl BinRead for Integer
impl BinRead for Integer
Source§fn read_options<R: Read + Seek>(
reader: &mut R,
_endian: Endian,
_: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( reader: &mut R, _endian: Endian, _: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Self from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
T from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for Integer
impl BinWrite for Integer
Source§fn write_options<W: Write + Seek>(
&self,
writer: &mut W,
_endian: Endian,
_: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, writer: &mut W, _endian: Endian, _: Self::Args<'_>, ) -> BinResult<()>
Source§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming little-endian byte order. Read moreSource§fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_ne<W>(&self, writer: &mut W) -> Result<(), Error>
Self to the writer assuming native-endian byte order. Read moreSource§fn write_be_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_be_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Self to the writer, assuming big-endian byte order, using the
given arguments. Read moreSource§impl Classification for Integer
impl Classification for Integer
Source§fn entity_type(&self, _cache: &mut SharedReferencesCache) -> Option<EntityType>
fn entity_type(&self, _cache: &mut SharedReferencesCache) -> Option<EntityType>
Source§fn entity_type_address(&self) -> Option<PointerAddress>
fn entity_type_address(&self) -> Option<PointerAddress>
Source§fn tag(&self) -> Option<ValueTag>
fn tag(&self) -> Option<ValueTag>
Source§fn impls(&self) -> Vec<PointerAddress>
fn impls(&self) -> Vec<PointerAddress>
Source§fn classification(
&self,
cache: &mut SharedReferencesCache,
) -> ValueClassification
fn classification( &self, cache: &mut SharedReferencesCache, ) -> ValueClassification
Source§fn unresolved_classification(&self) -> UnresolvedValueClassification
fn unresolved_classification(&self) -> UnresolvedValueClassification
Source§impl ConvertValue for Integer
impl ConvertValue for Integer
fn to_value(self) -> Value
fn try_from_value(value: Value) -> Result<Self, Value>
fn try_borrow_from_value(value: &Value) -> Result<&Integer, ()>
fn try_borrow_mut_from_value(value: &mut Value) -> Result<&mut Integer, ()>
Source§impl DatexHash for Integer
impl DatexHash for Integer
fn datex_hash(&self, state: &mut dyn Hasher)
fn datex_hash_default(&self) -> u64
Source§impl DatexNative for Integer
impl DatexNative for Integer
impl DatexNativeOnlyStructural for Integer
Source§impl DatexNativeOps for Integer
impl DatexNativeOps for Integer
fn add_native(&self, rhs: &dyn DatexNative) -> Option<Box<dyn DatexNative>>
Source§impl DatexNativeStructural for Integer
impl DatexNativeStructural for Integer
Source§fn classification_without_cache(&self) -> ValueClassification
fn classification_without_cache(&self) -> ValueClassification
Source§impl<'de> Deserialize<'de> for Integer
impl<'de> Deserialize<'de> for Integer
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> DeserializeWithSerdeContext<'de> for Integer
impl<'de> DeserializeWithSerdeContext<'de> for Integer
fn deserialize_with_ctx<D: Deserializer<'de>>( _ctx: &SerdeContext<'_>, deserializer: D, ) -> Result<Self, D::Error>
impl Eq for Integer
Source§impl From<Integer> for LiteralTypeDefinition
impl From<Integer> for LiteralTypeDefinition
Source§impl From<TypedInteger> for Integer
impl From<TypedInteger> for Integer
Source§fn from(value: TypedInteger) -> Self
fn from(value: TypedInteger) -> Self
Source§impl FromParts for Integer
impl FromParts for Integer
fn try_from_single_value_with_tag(
value: ValueContainer,
_tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
Source§fn try_from_map_parts(_parts: Map) -> Result<Self, ()>where
Self: Sized,
fn try_from_map_parts(_parts: Map) -> Result<Self, ()>where
Self: Sized,
Source§fn try_from_list_parts(_parts: List) -> Result<Self, ()>where
Self: Sized,
fn try_from_list_parts(_parts: List) -> Result<Self, ()>where
Self: Sized,
Source§fn try_from_single_value(_value: ValueContainer) -> Result<Self, ()>where
Self: Sized,
fn try_from_single_value(_value: ValueContainer) -> Result<Self, ()>where
Self: Sized,
fn try_from_map_parts_with_tag(
_parts: Map,
_tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
fn try_from_list_parts_with_tag(
_parts: List,
_tag: Option<&str>,
) -> Result<Self, ()>where
Self: Sized,
Source§impl GetCoreLibTypeId for Integer
impl GetCoreLibTypeId for Integer
fn core_lib_type_id(&self) -> CoreLibTypeId
Source§impl GetDatexType for Integer
impl GetDatexType for Integer
fn datex_type(_context: &mut SharedReferencesCache) -> Type
Source§impl HasPartsKind for Integer
impl HasPartsKind for Integer
Source§fn parts_kind(&self) -> PartsKind
fn parts_kind(&self) -> PartsKind
PartsKind::None, then the conversion is not possible.
If this returns PartsKind::List, then the conversion is possible and try_into_list_parts() can be called.
If this returns PartsKind::Map, then the conversion is possible and try_into_map_parts() can be called.
If this returns PartsKind::SingleValue, then the conversion is possible and try_from_single_value() can be called.Source§impl IntoParts for Integer
Default implementations - cannot be split into parts
impl IntoParts for Integer
Default implementations - cannot be split into parts
Source§fn try_into_single_value<'a>(self: Box<Self>) -> Result<ValueContainer, ()>where
Self: 'a,
fn try_into_single_value<'a>(self: Box<Self>) -> Result<ValueContainer, ()>where
Self: 'a,
parts_kind()
and checking if it returns PartsKind::SingleValue.Source§fn try_into_map_parts<'a>(self: Box<Self>) -> Result<Map, ()>where
Self: 'a,
fn try_into_map_parts<'a>(self: Box<Self>) -> Result<Map, ()>where
Self: 'a,
parts_kind()
and checking if it returns PartsKind::Map.Source§fn try_into_list_parts<'a>(self: Box<Self>) -> Result<List, ()>where
Self: 'a,
fn try_into_list_parts<'a>(self: Box<Self>) -> Result<List, ()>where
Self: 'a,
parts_kind()
and checking if it returns PartsKind::List.Source§impl IterParts for Integer
impl IterParts for Integer
fn iter_parts<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainer<'a>> + 'a>>
fn iter_list_parts<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainer<'a>> + 'a>>
fn iter_list_parts_mut<'a>( &'a mut self, ) -> Option<Box<dyn Iterator<Item = BorrowedValueContainerMut<'a>> + 'a>>
fn iter_map_parts<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = (BorrowedValueContainer<'a>, BorrowedValueContainer<'a>)> + 'a>>
fn iter_map_parts_mut<'a>( &'a mut self, ) -> Option<Box<dyn Iterator<Item = (BorrowedValueContainer<'a>, BorrowedValueContainerMut<'a>)> + 'a>>
Source§impl LocalChildPathResolver for Integer
impl LocalChildPathResolver for Integer
fn resolve_child( &mut self, _key: &ValueContainer, ) -> Result<&mut ValueContainer, UpdateError>
fn resolve_value_for_path( &mut self, first: &ValueContainer, remaining_path: &[ValueContainer], ) -> Result<&mut Value, UpdateError>
Source§impl PartialOrd for Integer
impl PartialOrd for Integer
Source§impl ReadEndian for Integer
impl ReadEndian for Integer
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
Source§impl SerializeWithSerdeContext for Integer
impl SerializeWithSerdeContext for Integer
fn serialize_with_ctx<S: Serializer>( &self, ctx: &SerdeContext<'_>, serializer: S, ) -> Result<S::Ok, S::Error>
Source§impl StructuralEq for Integer
impl StructuralEq for Integer
Source§fn structural_eq(&self, other: &Self) -> bool
fn structural_eq(&self, other: &Self) -> bool
impl StructuralPartialEq for Integer
Source§impl ToInstructions for Integer
impl ToInstructions for Integer
fn to_instructions<'a>( &'a self, _ctx: &'a mut dyn ValueVisitor, _cache: &'a mut SharedReferencesCache, ) -> Box<dyn Iterator<Item = Instruction> + 'a>
Source§impl ToPrimitive for Integer
impl ToPrimitive for Integer
Source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self to an isize. If the value cannot be
represented by an isize, then None is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self to an i8. If the value cannot be
represented by an i8, then None is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self to an i16. If the value cannot be
represented by an i16, then None is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self to an i32. If the value cannot be
represented by an i32, then None is returned.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self to an i64. If the value cannot be
represented by an i64, then None is returned.Source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
self to an i128. If the value cannot be
represented by an i128 (i64 under the default implementation), then
None is returned. Read moreSource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self to a usize. If the value cannot be
represented by a usize, then None is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self to a u8. If the value cannot be
represented by a u8, then None is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self to a u16. If the value cannot be
represented by a u16, then None is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self to a u32. If the value cannot be
represented by a u32, then None is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self to a u64. If the value cannot be
represented by a u64, then None is returned.Source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
self to a u128. If the value cannot be
represented by a u128 (u64 under the default implementation), then
None is returned. Read moreSource§impl UpdateCallbackDataAccess for Integer
impl UpdateCallbackDataAccess for Integer
fn get_update_callback_data(&self) -> Option<&UpdateCallbackData>
Source§impl UpdateHandlerImpl for Integer
impl UpdateHandlerImpl for Integer
fn try_increment( &mut self, data: IncrementUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_decrement( &mut self, data: DecrementUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
Source§fn try_update(
&mut self,
operation: UpdateOperation,
source_id: Option<TransceiverId>,
cache: &RefCell<SharedReferencesCache>,
) -> UpdateResult
fn try_update( &mut self, operation: UpdateOperation, source_id: Option<TransceiverId>, cache: &RefCell<SharedReferencesCache>, ) -> UpdateResult
fn try_set_entry( &mut self, _data: SetEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<Option<ValueContainer>, UpdateError>
fn try_delete_entry( &mut self, _data: DeleteEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<ValueContainer, UpdateError>
fn try_append_entry( &mut self, _data: AppendEntryUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
fn try_clear( &mut self, _cache: &RefCell<SharedReferencesCache>, ) -> Result<ValueContainer, UpdateError>
fn try_list_splice( &mut self, _data: ListSpliceUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<Vec<ValueContainer>, UpdateError>
fn try_replace( &mut self, _data: ReplaceUpdateData, _cache: &RefCell<SharedReferencesCache>, ) -> Result<(), UpdateError>
Source§impl ValueAccess for Integer
impl ValueAccess for Integer
Source§fn try_get_property(
&self,
_key: &ValueContainer,
) -> Result<BorrowedValueContainer<'_>, AccessError>
fn try_get_property( &self, _key: &ValueContainer, ) -> Result<BorrowedValueContainer<'_>, AccessError>
Source§fn try_get_property_mut(
&mut self,
_key: &ValueContainer,
) -> Result<BorrowedValueContainerMut<'_>, AccessError>
fn try_get_property_mut( &mut self, _key: &ValueContainer, ) -> Result<BorrowedValueContainerMut<'_>, AccessError>
Auto Trait Implementations§
impl Forget for Integer
impl Freeze for Integer
impl Move for Integer
impl RefUnwindSafe for Integer
impl Send for Integer
impl Sync for Integer
impl Unpin for Integer
impl UnsafeUnpin for Integer
impl UnwindSafe for Integer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConvertValueContainer for T
impl<T> ConvertValueContainer for T
Source§fn to_value_container(self) -> ValueContainer
fn to_value_container(self) -> ValueContainer
Source§fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>
fn as_borrowed_value_container(&self) -> BorrowedValueContainer<'_>
Source§fn as_borrowed_value_container_mut(&mut self) -> BorrowedValueContainerMut<'_>
fn as_borrowed_value_container_mut(&mut self) -> BorrowedValueContainerMut<'_>
Source§fn try_from_value_container(
value_container: ValueContainer,
) -> Result<T, ValueContainer>where
T: Sized,
fn try_from_value_container(
value_container: ValueContainer,
) -> Result<T, ValueContainer>where
T: Sized,
Source§fn try_convert_from_value_container(
value_container: ValueContainer,
) -> Result<T, ()>
fn try_convert_from_value_container( value_container: ValueContainer, ) -> Result<T, ()>
Source§fn try_borrow_from_value_container(
value_container: &ValueContainer,
) -> Result<&T, ()>where
T: Sized,
fn try_borrow_from_value_container(
value_container: &ValueContainer,
) -> Result<&T, ()>where
T: Sized,
Source§fn try_borrow_mut_from_value_container(
value_container: &mut ValueContainer,
) -> Result<&mut T, ()>where
T: Sized,
fn try_borrow_mut_from_value_container(
value_container: &mut ValueContainer,
) -> Result<&mut T, ()>where
T: Sized,
Source§fn try_from_bytes(
dxb: Vec<u8>,
runtime: &Runtime,
) -> Result<Self, DeserializationError>
fn try_from_bytes( dxb: Vec<u8>, runtime: &Runtime, ) -> Result<Self, DeserializationError>
Source§impl<T> CustomError for T
impl<T> CustomError for T
impl<T> DatexNativeBase for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DeserializeWithSerdeContextDyn for Twhere
T: for<'de> DeserializeWithSerdeContext<'de>,
impl<T> DeserializeWithSerdeContextDyn for Twhere
T: for<'de> DeserializeWithSerdeContext<'de>,
fn deserialize_with_ctx_dyn<'de>( ctx: &SerdeContext<'_>, deserializer: &mut dyn Deserializer<'de>, ) -> Result<T, Error>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> GetAllowedType for Twhere
T: GetDatexType,
impl<T> GetAllowedType for Twhere
T: GetDatexType,
fn allowed_type(&self, cache: &mut SharedReferencesCache) -> TypeDefinition
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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