pub struct Metadata { /* private fields */ }Expand description
Raw Draco metadata map.
Entries store the exact byte payload written to the Draco bitstream. Typed helpers encode values using the same little-endian layout as C++ Draco.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true when there are no entries or nested metadata blocks.
Sourcepub fn sub_metadata(&self) -> &BTreeMap<String, Metadata>
pub fn sub_metadata(&self) -> &BTreeMap<String, Metadata>
Returns all nested metadata blocks.
Sourcepub fn set_raw(
&mut self,
name: impl Into<String>,
value: impl Into<Vec<u8>>,
) -> Result<(), DracoError>
pub fn set_raw( &mut self, name: impl Into<String>, value: impl Into<Vec<u8>>, ) -> Result<(), DracoError>
Sets a raw byte metadata entry.
Sourcepub fn set_i32(
&mut self,
name: impl Into<String>,
value: i32,
) -> Result<(), DracoError>
pub fn set_i32( &mut self, name: impl Into<String>, value: i32, ) -> Result<(), DracoError>
Stores an i32 metadata entry.
Sourcepub fn set_i32_array(
&mut self,
name: impl Into<String>,
values: &[i32],
) -> Result<(), DracoError>
pub fn set_i32_array( &mut self, name: impl Into<String>, values: &[i32], ) -> Result<(), DracoError>
Stores an array of i32 metadata values.
Sourcepub fn get_i32_array(&self, name: &str) -> Option<Vec<i32>>
pub fn get_i32_array(&self, name: &str) -> Option<Vec<i32>>
Reads an array of i32 metadata values.
Sourcepub fn set_f64(
&mut self,
name: impl Into<String>,
value: f64,
) -> Result<(), DracoError>
pub fn set_f64( &mut self, name: impl Into<String>, value: f64, ) -> Result<(), DracoError>
Stores an f64 metadata entry.
Sourcepub fn set_f64_array(
&mut self,
name: impl Into<String>,
values: &[f64],
) -> Result<(), DracoError>
pub fn set_f64_array( &mut self, name: impl Into<String>, values: &[f64], ) -> Result<(), DracoError>
Stores an array of f64 metadata values.
Sourcepub fn get_f64_array(&self, name: &str) -> Option<Vec<f64>>
pub fn get_f64_array(&self, name: &str) -> Option<Vec<f64>>
Reads an array of f64 metadata values.
Sourcepub fn set_string(
&mut self,
name: impl Into<String>,
value: impl AsRef<str>,
) -> Result<(), DracoError>
pub fn set_string( &mut self, name: impl Into<String>, value: impl AsRef<str>, ) -> Result<(), DracoError>
Stores a UTF-8 string metadata entry.
Sourcepub fn get_string(&self, name: &str) -> Option<&str>
pub fn get_string(&self, name: &str) -> Option<&str>
Reads a UTF-8 string metadata entry.
Sourcepub fn remove_entry(&mut self, name: &str) -> Option<Vec<u8>>
pub fn remove_entry(&mut self, name: &str) -> Option<Vec<u8>>
Removes and returns a raw metadata entry.
Sourcepub fn get_sub_metadata(&self, name: &str) -> Option<&Metadata>
pub fn get_sub_metadata(&self, name: &str) -> Option<&Metadata>
Returns a nested metadata block by name.
Sourcepub fn get_sub_metadata_mut(&mut self, name: &str) -> Option<&mut Metadata>
pub fn get_sub_metadata_mut(&mut self, name: &str) -> Option<&mut Metadata>
Returns a mutable nested metadata block by name.
Sourcepub fn insert_sub_metadata(
&mut self,
name: impl Into<String>,
metadata: Metadata,
) -> Result<(), DracoError>
pub fn insert_sub_metadata( &mut self, name: impl Into<String>, metadata: Metadata, ) -> Result<(), DracoError>
Inserts a nested metadata block.
Sourcepub fn decode(buffer: &mut DecoderBuffer<'_>) -> Result<Self, DracoError>
Available on crate feature decoder only.
pub fn decode(buffer: &mut DecoderBuffer<'_>) -> Result<Self, DracoError>
decoder only.Decodes a metadata block from a Draco bitstream buffer.
Sourcepub fn encode(&self, buffer: &mut EncoderBuffer) -> Result<(), DracoError>
Available on crate feature encoder only.
pub fn encode(&self, buffer: &mut EncoderBuffer) -> Result<(), DracoError>
encoder only.Encodes this metadata block to a Draco bitstream buffer.