pub enum NumericTag {
Byte(i8),
Short(i16),
Int(i32),
Long(i64),
Float(f32),
Double(f64),
}Expand description
A numeric NBT tag that converts to any numeric type.
Integer conversions floor floating point tags, while the codec_* methods
of NbtNumeric truncate them. Use this type for
getIntOr-style reads and NbtNumeric for Codec.INT-style reads.
Variants§
Implementations§
Source§impl NumericTag
impl NumericTag
const fn floor(value: f64) -> i32
Sourcepub fn byte_value(self) -> i8
pub fn byte_value(self) -> i8
Keeps the low bits of the integer value, flooring floating point tags first.
Sourcepub fn short_value(self) -> i16
pub fn short_value(self) -> i16
Keeps the low bits of the integer value, flooring floating point tags first.
Sourcepub fn long_value(self) -> i64
pub fn long_value(self) -> i64
Truncates float tags but floors double tags, as vanilla does.
Sourcepub fn float_value(self) -> f32
pub fn float_value(self) -> f32
Converts the value to the nearest f32.
Sourcepub fn double_value(self) -> f64
pub fn double_value(self) -> f64
Converts the value to the nearest f64.
Trait Implementations§
Source§impl Clone for NumericTag
impl Clone for NumericTag
impl Copy for NumericTag
Source§impl Debug for NumericTag
impl Debug for NumericTag
Source§impl PartialEq for NumericTag
impl PartialEq for NumericTag
impl StructuralPartialEq for NumericTag
Source§impl TryFrom<&NbtTag<'_, '_>> for NumericTag
impl TryFrom<&NbtTag<'_, '_>> for NumericTag
Auto Trait Implementations§
impl Freeze for NumericTag
impl RefUnwindSafe for NumericTag
impl Send for NumericTag
impl Sync for NumericTag
impl Unpin for NumericTag
impl UnsafeUnpin for NumericTag
impl UnwindSafe for NumericTag
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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 moreWraps this value in an
Arc<SyncMutex<>>