Enum valence_nbt::value::Value
source · pub enum Value<S = String> {
Byte(i8),
Short(i16),
Int(i32),
Long(i64),
Float(f32),
Double(f64),
ByteArray(Vec<i8>),
String(S),
List(List<S>),
Compound(Compound<S>),
IntArray(Vec<i32>),
LongArray(Vec<i64>),
}
Expand description
Represents an arbitrary NBT value.
Variants§
Byte(i8)
Short(i16)
Int(i32)
Long(i64)
Float(f32)
Double(f64)
ByteArray(Vec<i8>)
String(S)
List(List<S>)
Compound(Compound<S>)
IntArray(Vec<i32>)
LongArray(Vec<i64>)
Implementations§
source§impl<S> Value<S>
impl<S> Value<S>
sourcepub fn is_number(&self) -> bool
pub fn is_number(&self) -> bool
Returns whether this value is a number, i.e. a byte, short, int, long, float or double.
sourcepub fn as_i8(&self) -> Option<i8>
pub fn as_i8(&self) -> Option<i8>
If this value is a number, returns the i8
representation of this value.
sourcepub fn as_i16(&self) -> Option<i16>
pub fn as_i16(&self) -> Option<i16>
If this value is a number, returns the i16
representation of this value.
sourcepub fn as_i32(&self) -> Option<i32>
pub fn as_i32(&self) -> Option<i32>
If this value is a number, returns the i32
representation of this value.
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If this value is a number, returns the i64
representation of this value.
sourcepub fn as_f32(&self) -> Option<f32>
pub fn as_f32(&self) -> Option<f32>
If this value is a number, returns the f32
representation of this value.
Trait Implementations§
Auto Trait Implementations§
impl<S> RefUnwindSafe for Value<S>where
S: RefUnwindSafe,
impl<S> Send for Value<S>where
S: Send,
impl<S> Sync for Value<S>where
S: Sync,
impl<S> Unpin for Value<S>where
S: Unpin,
impl<S> UnwindSafe for Value<S>where
S: UnwindSafe + RefUnwindSafe,
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