Enum valence_nbt::value::ValueRef
source · pub enum ValueRef<'a, S = String> {
Byte(&'a i8),
Short(&'a i16),
Int(&'a i32),
Long(&'a i64),
Float(&'a f32),
Double(&'a f64),
ByteArray(&'a [i8]),
String(&'a S),
List(&'a List<S>),
Compound(&'a Compound<S>),
IntArray(&'a [i32]),
LongArray(&'a [i64]),
}
Expand description
Represents a reference to an arbitrary NBT value, where the tag is not part of the reference.
Variants§
Byte(&'a i8)
Short(&'a i16)
Int(&'a i32)
Long(&'a i64)
Float(&'a f32)
Double(&'a f64)
ByteArray(&'a [i8])
String(&'a S)
List(&'a List<S>)
Compound(&'a Compound<S>)
IntArray(&'a [i32])
LongArray(&'a [i64])
Implementations§
source§impl<'a, S> ValueRef<'a, S>
impl<'a, S> ValueRef<'a, 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§
impl<'a, S: Copy> Copy for ValueRef<'a, S>
Auto Trait Implementations§
impl<'a, S> Freeze for ValueRef<'a, S>
impl<'a, S> RefUnwindSafe for ValueRef<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for ValueRef<'a, S>where
S: Sync,
impl<'a, S> Sync for ValueRef<'a, S>where
S: Sync,
impl<'a, S> Unpin for ValueRef<'a, S>
impl<'a, S> UnwindSafe for ValueRef<'a, S>where
S: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)