pub struct NbtList {
pub element_type: u8,
pub elements: Vec<NbtTag>,
}Expand description
A homogeneous ordered list of NBT tags.
All elements in an NBT list must have the same tag type. The wire format
encodes the element type once (as a single byte), followed by the count
(as a big-endian i32), then each element’s payload without type bytes
or names. An empty list uses End (0) as the element type.
Fields§
§element_type: u8The tag type ID shared by all elements.
For empty lists, this is tag_id::END (0).
elements: Vec<NbtTag>The list elements. All must have a tag_id() matching element_type,
or element_type must be tag_id::END when the list is empty.
Implementations§
Source§impl NbtList
impl NbtList
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty NBT list.
The element type is set to End (0), which is the standard
encoding for empty lists in the NBT format.
Creates an NBT list from a vector of tags.
All tags must have the same type. The element type is inferred
from the first element. Returns None if the tags have mixed types.
Returns an empty list with End element type if the vector is empty.