Skip to main content

NbtValueInput

Trait NbtValueInput 

Source
pub trait NbtValueInput {
    // Required method
    fn numeric_tag(&self, name: &str) -> Option<NumericTag>;

    // Provided methods
    fn byte_value(&self, name: &str) -> Option<i8> { ... }
    fn short_value(&self, name: &str) -> Option<i16> { ... }
    fn int_value(&self, name: &str) -> Option<i32> { ... }
    fn long_value(&self, name: &str) -> Option<i64> { ... }
    fn float_value(&self, name: &str) -> Option<f32> { ... }
    fn double_value(&self, name: &str) -> Option<f64> { ... }
}
Expand description

Numeric reads accepting any numeric tag, unlike simdnbt’s getters which return None when the tag type differs.

getIntOr(name, default) is int_value(name).unwrap_or(default) here, and getBooleanOr(name, false) is byte_value(name).is_some_and(|v| v != 0).

Required Methods§

Source

fn numeric_tag(&self, name: &str) -> Option<NumericTag>

Returns the tag called name if it exists and is numeric.

Provided Methods§

Source

fn byte_value(&self, name: &str) -> Option<i8>

Reads name as an i8, see NumericTag::byte_value.

Source

fn short_value(&self, name: &str) -> Option<i16>

Reads name as an i16, see NumericTag::short_value.

Source

fn int_value(&self, name: &str) -> Option<i32>

Reads name as an i32, see NumericTag::int_value.

Source

fn long_value(&self, name: &str) -> Option<i64>

Reads name as an i64, see NumericTag::long_value.

Source

fn float_value(&self, name: &str) -> Option<f32>

Reads name as an f32, see NumericTag::float_value.

Source

fn double_value(&self, name: &str) -> Option<f64>

Reads name as an f64, see NumericTag::double_value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl NbtValueInput for NbtCompound

Source§

impl NbtValueInput for NbtCompound<'_, '_>

Implementors§