Enum valence_nbt::value::ValueMut

source ·
pub enum ValueMut<'a, S = String> {
    Byte(&'a mut i8),
    Short(&'a mut i16),
    Int(&'a mut i32),
    Long(&'a mut i64),
    Float(&'a mut f32),
    Double(&'a mut f64),
    ByteArray(&'a mut Vec<i8>),
    String(&'a mut S),
    List(&'a mut List<S>),
    Compound(&'a mut Compound<S>),
    IntArray(&'a mut Vec<i32>),
    LongArray(&'a mut Vec<i64>),
}
Expand description

Represents a mutable reference to an arbitrary NBT value, where the tag is not part of the reference.

Variants§

§

Byte(&'a mut i8)

§

Short(&'a mut i16)

§

Int(&'a mut i32)

§

Long(&'a mut i64)

§

Float(&'a mut f32)

§

Double(&'a mut f64)

§

ByteArray(&'a mut Vec<i8>)

§

String(&'a mut S)

§

List(&'a mut List<S>)

§

Compound(&'a mut Compound<S>)

§

IntArray(&'a mut Vec<i32>)

§

LongArray(&'a mut Vec<i64>)

Implementations§

source§

impl<'a, S> ValueMut<'a, S>

source

pub fn tag(&self) -> Tag

Returns the type of this value.

source

pub fn is_number(&self) -> bool

Returns whether this value is a number, i.e. a byte, short, int, long, float or double.

source

pub fn as_i8(&self) -> Option<i8>

If this value is a number, returns the i8 representation of this value.

source

pub fn as_i16(&self) -> Option<i16>

If this value is a number, returns the i16 representation of this value.

source

pub fn as_i32(&self) -> Option<i32>

If this value is a number, returns the i32 representation of this value.

source

pub fn as_i64(&self) -> Option<i64>

If this value is a number, returns the i64 representation of this value.

source

pub fn as_f32(&self) -> Option<f32>

If this value is a number, returns the f32 representation of this value.

source

pub fn as_f64(&self) -> Option<f64>

If this value is a number, returns the f64 representation of this value.

source

pub fn as_bool(&self) -> Option<bool>

If this value is a number, returns the bool representation of this value.

source§

impl<S> ValueMut<'_, S>
where S: Clone,

source

pub fn to_value(&self) -> Value<S>

Clones this mutable value reference to a new owned Value.

source§

impl<'a, S> ValueMut<'a, S>

source

pub fn into_value_ref(self) -> ValueRef<'a, S>

Downgrades this mutable value reference into an immutable ValueRef.

Trait Implementations§

source§

impl<'a, S: Debug> Debug for ValueMut<'a, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S> From<&ValueMut<'_, S>> for Value<S>
where S: Clone,

source§

fn from(v: &ValueMut<'_, S>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut Compound<S>> for ValueMut<'a, S>

source§

fn from(v: &'a mut Compound<S>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut List<S>> for ValueMut<'a, S>

source§

fn from(v: &'a mut List<S>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut String> for ValueMut<'a, String>

source§

fn from(v: &'a mut String) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut Value<S>> for ValueMut<'a, S>

source§

fn from(v: &'a mut Value<S>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut Vec<i32>> for ValueMut<'a, S>

source§

fn from(v: &'a mut Vec<i32>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut Vec<i64>> for ValueMut<'a, S>

source§

fn from(v: &'a mut Vec<i64>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut Vec<i8>> for ValueMut<'a, S>

source§

fn from(v: &'a mut Vec<i8>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut f32> for ValueMut<'a, S>

source§

fn from(v: &'a mut f32) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut f64> for ValueMut<'a, S>

source§

fn from(v: &'a mut f64) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut i16> for ValueMut<'a, S>

source§

fn from(v: &'a mut i16) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut i32> for ValueMut<'a, S>

source§

fn from(v: &'a mut i32) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut i64> for ValueMut<'a, S>

source§

fn from(v: &'a mut i64) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<&'a mut i8> for ValueMut<'a, S>

source§

fn from(v: &'a mut i8) -> Self

Converts to this type from the input type.
source§

impl<S> From<ValueMut<'_, S>> for Value<S>
where S: Clone,

source§

fn from(v: ValueMut<'_, S>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> From<ValueMut<'a, S>> for ValueRef<'a, S>

source§

fn from(v: ValueMut<'a, S>) -> Self

Converts to this type from the input type.
source§

impl<'a, S> PartialEq for ValueMut<'a, S>
where S: Ord + Hash,

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl<'a, S> Freeze for ValueMut<'a, S>

§

impl<'a, S> RefUnwindSafe for ValueMut<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for ValueMut<'a, S>
where S: Send,

§

impl<'a, S> Sync for ValueMut<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for ValueMut<'a, S>

§

impl<'a, S = String> !UnwindSafe for ValueMut<'a, S>

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.