pub enum Byml {
}
Expand description
Represents a Nintendo binary YAML (BYML) document or node.
Variants§
String(String)
String value.
BinaryData(Vec<u8>)
Binary data (not used in BOTW).
FileData(Vec<u8>)
File data
Array(Vec<Byml>)
Array of BYML nodes.
Map(Map)
Hash map of BYML nodes with string keys.
HashMap(HashMap)
Hash map of BYML nodes with u32 keys.
ValueHashMap(ValueHashMap)
Hash map of BYML nodes with u32 keys and additional value.
Bool(bool)
Boolean value.
I32(i32)
32-bit signed integer.
Float(f32)
32-bit float.
U32(u32)
32-bit unsigned integer.
I64(i64)
64-bit signed integer.
U64(u64)
64-bit unsigned integer.
Double(f64)
64-bit float.
Null
Null value.
Implementations§
source§impl Byml
impl Byml
sourcepub fn write<W: Write + Seek>(
&self,
writer: &mut W,
endian: Endian,
version: u16
) -> Result<()>
pub fn write<W: Write + Seek>( &self, writer: &mut W, endian: Endian, version: u16 ) -> Result<()>
Serialize the document to binary into the given writer. This can only be done for Null, Array, or Hash nodes.
source§impl Byml
impl Byml
sourcepub fn as_int<T>(&self) -> Result<T>where
T: Copy + 'static,
i32: AsPrimitive<T>,
u32: AsPrimitive<T>,
i64: AsPrimitive<T>,
u64: AsPrimitive<T>,
pub fn as_int<T>(&self) -> Result<T>where
T: Copy + 'static,
i32: AsPrimitive<T>,
u32: AsPrimitive<T>,
i64: AsPrimitive<T>,
u64: AsPrimitive<T>,
Get the inner value as an integer of any type. Casts the value using
as
where necessary.
Note that this is subject to all the normal risks of casting with as
.
sourcepub fn as_num<T>(&self) -> Result<T>where
T: Copy + 'static,
i32: AsPrimitive<T>,
u32: AsPrimitive<T>,
i64: AsPrimitive<T>,
u64: AsPrimitive<T>,
f32: AsPrimitive<T>,
f64: AsPrimitive<T>,
pub fn as_num<T>(&self) -> Result<T>where
T: Copy + 'static,
i32: AsPrimitive<T>,
u32: AsPrimitive<T>,
i64: AsPrimitive<T>,
u64: AsPrimitive<T>,
f32: AsPrimitive<T>,
f64: AsPrimitive<T>,
Get the inner value as a number of any type. Casts the value using
as
where necessary.
Note that this is subject to all the normal risks of casting with as
.
sourcepub fn as_binary_data(&self) -> Result<&[u8]>
pub fn as_binary_data(&self) -> Result<&[u8]>
Get a reference to the inner byte slice.
sourcepub fn as_map(&self) -> Result<&Map>
pub fn as_map(&self) -> Result<&Map>
Get a reference to the inner string-keyed hash map of BYML nodes.
sourcepub fn as_hash_map(&self) -> Result<&HashMap>
pub fn as_hash_map(&self) -> Result<&HashMap>
Get a reference to the inner u32-keyed hash map of BYML nodes.
sourcepub fn as_value_hash_map(&self) -> Result<&ValueHashMap>
pub fn as_value_hash_map(&self) -> Result<&ValueHashMap>
Get a reference to the inner u32-keyed hash map of BYML nodes.
sourcepub fn as_mut_string(&mut self) -> Result<&mut String>
pub fn as_mut_string(&mut self) -> Result<&mut String>
Get a mutable reference to the inner string value.
sourcepub fn as_mut_bool(&mut self) -> Result<&mut bool>
pub fn as_mut_bool(&mut self) -> Result<&mut bool>
Get a mutable reference to the inner bool value.
sourcepub fn as_mut_i32(&mut self) -> Result<&mut i32>
pub fn as_mut_i32(&mut self) -> Result<&mut i32>
Get a mutable reference to the inner i32 value.
sourcepub fn as_mut_u32(&mut self) -> Result<&mut u32>
pub fn as_mut_u32(&mut self) -> Result<&mut u32>
Get a mutable reference to the inner u32 value.
sourcepub fn as_mut_i64(&mut self) -> Result<&mut i64>
pub fn as_mut_i64(&mut self) -> Result<&mut i64>
Get a mutable reference to the inner i64 value.
sourcepub fn as_mut_u64(&mut self) -> Result<&mut u64>
pub fn as_mut_u64(&mut self) -> Result<&mut u64>
Get a mutable reference to the inner u64 value.
sourcepub fn as_mut_float(&mut self) -> Result<&mut f32>
pub fn as_mut_float(&mut self) -> Result<&mut f32>
Get a mutable reference to the inner f32 value.
sourcepub fn as_mut_double(&mut self) -> Result<&mut f64>
pub fn as_mut_double(&mut self) -> Result<&mut f64>
Get a mutable reference to the inner f64 value.
sourcepub fn as_mut_binary_data(&mut self) -> Result<&mut [u8]>
pub fn as_mut_binary_data(&mut self) -> Result<&mut [u8]>
Get a mutable reference to the inner byte slice.
sourcepub fn as_mut_array(&mut self) -> Result<&mut Vec<Byml>>
pub fn as_mut_array(&mut self) -> Result<&mut Vec<Byml>>
Get a mutable reference to the inner array of BYML nodes.
sourcepub fn as_mut_map(&mut self) -> Result<&mut Map>
pub fn as_mut_map(&mut self) -> Result<&mut Map>
Get a mutable reference to the inner hash map of BYML nodes.
sourcepub fn as_mut_hash_map(&mut self) -> Result<&mut HashMap>
pub fn as_mut_hash_map(&mut self) -> Result<&mut HashMap>
Get a reference to the inner u32-keyed hash map of BYML nodes.
sourcepub fn as_mut_value_hash_map(&mut self) -> Result<&mut ValueHashMap>
pub fn as_mut_value_hash_map(&mut self) -> Result<&mut ValueHashMap>
Get a reference to the inner u32-keyed hash map of BYML nodes.
sourcepub fn into_string(self) -> Result<String>
pub fn into_string(self) -> Result<String>
Extract the inner string value.
sourcepub fn into_float(self) -> Result<f32>
pub fn into_float(self) -> Result<f32>
Extract the inner f32 value.
sourcepub fn into_double(self) -> Result<f64>
pub fn into_double(self) -> Result<f64>
Extract the inner f64 value.
sourcepub fn into_binary_data(self) -> Result<Vec<u8>>
pub fn into_binary_data(self) -> Result<Vec<u8>>
Extract the inner byte slice value.
sourcepub fn into_array(self) -> Result<Vec<Byml>>
pub fn into_array(self) -> Result<Vec<Byml>>
Extract the inner Byml array value.
sourcepub fn into_hash_map(self) -> Result<HashMap>
pub fn into_hash_map(self) -> Result<HashMap>
Extract the inner hash map value.
sourcepub fn into_value_hash_map(self) -> Result<ValueHashMap>
pub fn into_value_hash_map(self) -> Result<ValueHashMap>
Extract the inner value hash map value.