Enum Tag
pub enum Tag {
}Expand description
Float and double variants hold their IEEE bit patterns. Java’s disk output
canonicalizes NaNs (DataOutputStream.writeFloat); its network output
keeps their bits (Netty’s ByteBuf.writeFloat). Loading, like vanilla’s
valueOf factories, normalizes negative zero to positive zero.
Variants§
End
Byte(i8)
Short(i16)
Int(i32)
Long(i64)
Float(u32)
Double(u64)
ByteArray(Vec<u8>)
String(JavaString)
List(Vec<Tag>)
Compound(BTreeMap<JavaString, Tag>)
IntArray(Vec<i32>)
LongArray(Vec<i64>)
Implementations§
§impl Tag
impl Tag
pub fn to_network_bytes(&self) -> Result<Vec<u8>, Error>
pub fn to_network_bytes(&self) -> Result<Vec<u8>, Error>
Encode a nameless network root. End (also vanilla’s null marker) is [0].
Uses the engine’s network writer, preserving NaN bits; refuses depth over
512 and strings whose modified UTF-8 exceeds 65535 bytes.
Vanilla applies heap quotas when reading, not writing.
pub fn from_network_bytes(
bytes: &[u8],
quota: Option<u64>,
) -> Result<(Tag, usize), Error>
pub fn from_network_bytes( bytes: &[u8], quota: Option<u64>, ) -> Result<(Tag, usize), Error>
Decode one nameless network root and return its consumed byte count.
Trailing bytes remain unread. None uses vanilla’s 2 MiB heap quota;
Some(quota) supplies a caller quota in NbtAccounter bytes, not encoded
bytes. Container nesting is limited to 512. End represents vanilla null.
Malformed input, quota exhaustion and excessive depth return an Error.
Trait Implementations§
impl Eq for Tag
impl StructuralPartialEq for Tag
§impl TryFrom<&Tag> for Vec<u8>
A tag as its network NBT bytes (write_network), the form it crosses to a wasm mod in; a
tag past the default limits is refused, with the reason.
impl TryFrom<&Tag> for Vec<u8>
A tag as its network NBT bytes (write_network), the form it crosses to a wasm mod in; a
tag past the default limits is refused, with the reason.
§impl TryFrom<Tag> for BTreeMap<JavaString, Tag>
The compound a compound tag holds; any other tag is refused as itself.
impl TryFrom<Tag> for BTreeMap<JavaString, Tag>
The compound a compound tag holds; any other tag is refused as itself.