pub trait NbtNumeric {
// Required methods
fn codec_bool(&self) -> Option<bool>;
fn codec_i8(&self) -> Option<i8>;
fn codec_i32(&self) -> Option<i32>;
fn codec_i64(&self) -> Option<i64>;
fn codec_f32(&self) -> Option<f32>;
fn codec_f64(&self) -> Option<f64>;
fn int_value(&self) -> Option<i32>;
// Provided methods
fn short_value(&self) -> Option<i16> { ... }
fn byte_value(&self) -> Option<i8> { ... }
}Expand description
Decodes numeric NBT tags with vanilla’s numeric conversions.
codec_* mirror DynamicOps number codecs, which truncate floating values.
*_value mirror NumericTag, used by ValueInput.get*Or, which floors them.
Floating-point reads agree, so codec_f32/codec_f64 also serve
getFloatOr/getDoubleOr.
Required Methods§
Sourcefn codec_bool(&self) -> Option<bool>
fn codec_bool(&self) -> Option<bool>
Decodes Codec.BOOL from any numeric NBT tag.
Provided Methods§
Sourcefn short_value(&self) -> Option<i16>
fn short_value(&self) -> Option<i16>
Returns the low 16 bits of int_value.
Sourcefn byte_value(&self) -> Option<i8>
fn byte_value(&self) -> Option<i8>
Returns the low 8 bits of int_value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".