[−][src]Enum nobility::bin_decode::Tag
Representation for all values that a tag can be.
Variants (Non-exhaustive)
Byte(i8)
A small i8 integer.
Short(i16)
An i16 integer.
Int(i32)
An i32 integer.
Long(i64)
An i64 integer.
Float(f32)
An f32 number.
Double(f64)
An f64 number.
An array of raw bytes.
String(NbtString<'a>)
A string containing CESU-8 encoded text.
IntArray(IntArray<'a>)
An array of i32.
LongArray(LongArray<'a>)
An array of i64.
List(List<'a>)
An array which can only contain a single type. The type can be any tag, including a nested list. When lists are nested, the inner lists do not have to be the same type.
Compound(Compound<'a>)
A list of key/value pairs, creating a dictionary.
Implementations
impl<'a> Tag<'a>
[src]
pub fn tag_type(&self) -> TagType
[src]
Returns the type that represents this tag.
pub fn as_string(&self) -> Option<NbtString<'a>>
[src]
If this tag is a string, returns it. Otherwise, returns None. No coercion is performed.
pub fn as_byte_array(&self) -> Option<&[u8]>
[src]
If this tag is a byte array, returns it. Otherwise, returns None.
pub fn as_compound(&self) -> Option<&Compound<'a>>
[src]
If this tag is a Compound, returns it. Otherwise, returns None.
pub fn as_list(&self) -> Option<&List<'a>>
[src]
If this tag is a List, returns it. Otherwise, returns None.
pub fn to_i64(&self) -> Option<i64>
[src]
Attempts to coerce the tag to an integer. Byte, Short, Int, and Long will return a value, other tags will return None.
pub fn to_f64(&self) -> Option<f64>
[src]
Attempts to coerce the tag to a f64. Byte, Short, Int, Long, Float, and Double will return a value, other tags will return None.
pub fn to_f32(&self) -> Option<f32>
[src]
Attempts to coerce the tag to a f32. Byte, Short, Int, Long, Float, and Double will return a value, other tags will return None.
pub fn to_uuid_bytes(&self) -> Option<[u8; 16]>
[src]
If the tag is in the 1.16+ UUID format (IntArray of length 4), returns it as big endian bytes. Otherwise, returns None.
pub fn to_uuid(&self) -> Option<Uuid>
[src]
Similar to Tag::to_uuid_bytes, but returns a uuid::Uuid. Requires the uuid
feature.
Trait Implementations
impl<'a> Clone for Tag<'a>
[src]
impl<'a> Debug for Tag<'a>
[src]
impl<'a> PartialEq<Tag<'a>> for Tag<'a>
[src]
impl<'a> StructuralPartialEq for Tag<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Tag<'a>
[src]
impl<'a> Send for Tag<'a>
[src]
impl<'a> Sync for Tag<'a>
[src]
impl<'a> Unpin for Tag<'a>
[src]
impl<'a> UnwindSafe for Tag<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,