### Example of using ser_json with SerJsonState Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html Shows how to serialize a u32 value to JSON using ser_json and a SerJsonState. The example creates a new SerJsonState, calls ser_json on 42u32, and asserts that the output is "42". ```rust let mut s = SerJsonState::new(String::new()); 42u32.ser_json(0, &mut s); assert_eq!(s.out, "42"); ``` -------------------------------- ### ser_bin usage example Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Shows how to use ser_bin to serialize a u32 value into a byte vector. ```rust let mut s = Vec::new(); 42u32.ser_bin(&mut s); assert_eq!(s, vec![42, 0, 0, 0]) ``` -------------------------------- ### Example: using de_ron to parse an integer Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeRon.html Shows how to manually parse a RON string using DeRonState and the de_ron method. The example parses the string "42" and asserts the result equals 42. ```rust let mut state = DeRonState::default(); let mut chars = "42".chars(); state.next(&mut chars); state.next_tok(&mut chars).unwrap(); let out = u32::de_ron(&mut state, &mut chars).unwrap(); assert_eq!(out, 42); ``` -------------------------------- ### Example usage of ser_ron Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html Shows how to serialize a value using ser_ron with a SerRonState and assert the output. ```rust let mut s = SerRonState { out: String::new() }; 42u32.ser_ron(0, &mut s); assert_eq!(s.out, "42"); ``` -------------------------------- ### Toml::arr Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Get the TOML value as a table. Panics if the TOML value isn't actually a table. ```APIDOC ## Toml::arr ### Description Get the TOML value as a table. Panics if the TOML value isn't actually a table. ### Method `pub fn arr(&self) -> &Vec>` ### Parameters - `self` - The `Toml` value. ### Returns - `&Vec>` - The table value. ### Panics Panics if the TOML value is not a table. ``` -------------------------------- ### SerBin derive macro attribute syntax Source: https://docs.rs/nanoserde/latest/nanoserde/derive.SerBin.html Shows the syntax for using the SerBin derive macro with the #[nserde] attribute. This is the only code example on the page. ```rust #[derive(SerBin)] { // Attributes available to this derive: #[nserde] } ``` -------------------------------- ### Toml::str Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Get the TOML value as a string. Panics if the TOML value isn't actually a string. ```APIDOC ## Toml::str ### Description Get the TOML value as a string. Panics if the TOML value isn't actually a string. ### Method `pub fn str(&self) -> &str` ### Parameters - `self` - The `Toml` value. ### Returns - `&str` - The string value. ### Panics Panics if the TOML value is not a string. ``` -------------------------------- ### Manual JSON parsing with DeJson::de_json Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeJson.html Shows how to manually parse a JSON number using DeJsonState and the de_json method. The example parses the string "42" and asserts the result is 42. ```rust let mut state = DeJsonState::default(); let mut chars = "42".chars(); state.next(&mut chars); state.next_tok(&mut chars).unwrap(); let out = u32::de_json(&mut state, &mut chars).unwrap(); assert_eq!(out, 42); ``` -------------------------------- ### de_bin Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeBin.html Parses Self from the input bytes starting at the given offset. After deserialization, the offset is updated to point at the byte after the last one used. ```APIDOC ## de_bin ### Description Parses Self from the input bytes starting at index `offset`. After deserialization, `offset` is updated to point at the byte after the last one used. ### Method `fn de_bin(offset: &mut usize, bytes: &[u8]) -> Result` ### Parameters - **offset** (`&mut usize`) - Required - The starting index in `bytes` from which to begin parsing. Updated to point after the last byte used. - **bytes** (`&[u8]`) - Required - The input byte slice to parse from. ### Returns - `Result` - The deserialized value or an error. ### Example ```rust let bytes = [1, 0, 0, 0, 2, 0, 0, 0]; let mut offset = 4; let two = u32::de_bin(&mut offset, &bytes).unwrap(); assert_eq!(two, 2); assert_eq!(offset, 8); ``` ``` -------------------------------- ### impl SerRon for BTreeMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html SerRon implementation for BTreeMap, where K and V implement SerRon. ```APIDOC ## impl SerRon for BTreeMap ### Description SerRon implementation for BTreeMap, where K and V implement SerRon. ### Method `fn ser_ron(&self, d: usize, s: &mut SerRonState)` ### Parameters - `d` (usize) - Indentation depth. - `s` (&mut SerRonState) - The RON serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_ron.rs.html#1255-1266) ``` -------------------------------- ### impl SerRon for HashMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html SerRon implementation for HashMap, where K and V implement SerRon. Available on crate feature `std` only. ```APIDOC ## impl SerRon for HashMap ### Description SerRon implementation for HashMap, where K and V implement SerRon. Available on crate feature `std` only. ### Method `fn ser_ron(&self, d: usize, s: &mut SerRonState)` ### Parameters - `d` (usize) - Indentation depth. - `s` (&mut SerRonState) - The RON serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_ron.rs.html#1215-1226) ``` -------------------------------- ### Toml::simple_arr Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Get the TOML value as an array. Panics if the TOML value isn't actually an array. ```APIDOC ## Toml::simple_arr ### Description Get the TOML value as an array. Panics if the TOML value isn't actually an array. ### Method `pub fn simple_arr(&self) -> &Vec` ### Parameters - `self` - The `Toml` value. ### Returns - `&Vec` - The array value. ### Panics Panics if the TOML value is not an array. ``` -------------------------------- ### Toml::boolean Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Get the TOML value as a boolean. Panics if the TOML value isn't actually a boolean. ```APIDOC ## Toml::boolean ### Description Get the TOML value as a boolean. Panics if the TOML value isn't actually a boolean. ### Method `pub fn boolean(&self) -> bool` ### Parameters - `self` - The `Toml` value. ### Returns - `bool` - The boolean value. ### Panics Panics if the TOML value is not a boolean. ``` -------------------------------- ### impl SerRon for BTreeSet Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html SerRon implementation for BTreeSet, where T implements SerRon. ```APIDOC ## impl SerRon for BTreeSet ### Description SerRon implementation for BTreeSet, where T implements SerRon. ### Method `fn ser_ron(&self, d: usize, s: &mut SerRonState)` ### Parameters - `d` (usize) - Indentation depth. - `s` (&mut SerRonState) - The RON serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_ron.rs.html#977-995) ``` -------------------------------- ### SerJson derive macro usage Source: https://docs.rs/nanoserde/latest/nanoserde/derive.SerJson.html Shows the basic syntax for deriving SerJson and the available #[nserde] attribute. ```rust #[derive(SerJson)] { // Attributes available to this derive: #[nserde] } ``` -------------------------------- ### fn ser_bin(&self, output: &mut Vec) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes the value to binary bytes and appends them to the provided output vector. This is the required method for implementing the SerBin trait. ```APIDOC ## fn ser_bin(&self, output: &mut Vec) ### Description Serializes the value to binary bytes and appends them to the provided output vector. ### Method ser_bin ### Signature fn ser_bin(&self, output: &mut Vec) ### Parameters - **output** (`&mut Vec`) - Required - The vector to which the serialized bytes are appended. ### Example ```rust let mut s = Vec::new(); 42u32.ser_bin(&mut s); assert_eq!(s, vec![42, 0, 0, 0]) ``` ``` -------------------------------- ### Toml::num Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Get the TOML value as a float. Panics if the TOML value isn't actually a float. ```APIDOC ## Toml::num ### Description Get the TOML value as a float. Panics if the TOML value isn't actually a float. ### Method `pub fn num(&self) -> f64` ### Parameters - `self` - The `Toml` value. ### Returns - `f64` - The float value. ### Panics Panics if the TOML value is not a float. ``` -------------------------------- ### impl SerRon for (A, B) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html SerRon implementation for a tuple of two elements, where both A and B implement SerRon. ```APIDOC ## impl SerRon for (A, B) ### Description SerRon implementation for a tuple of two elements, where both A and B implement SerRon. ### Method `fn ser_ron(&self, d: usize, s: &mut SerRonState)` ### Parameters - `d` (usize) - Indentation depth. - `s` (&mut SerRonState) - The RON serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_ron.rs.html#1112-1118) ``` -------------------------------- ### Toml::date Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Get the TOML value as a date string. Panics if the TOML value isn't actually a date string. ```APIDOC ## Toml::date ### Description Get the TOML value as a date string. Panics if the TOML value isn't actually a date string. See the TOML spec for what 'date string' means. ### Method `pub fn date(&self) -> String` ### Parameters - `self` - The `Toml` value. ### Returns - `String` - The date string. ### Panics Panics if the TOML value is not a date string. ``` -------------------------------- ### impl SerBin for HashMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html SerBin implementation for HashMap where both key and value implement SerBin. Provides the ser_bin method to serialize the map into a byte vector. ```APIDOC ## impl SerBin for HashMap ### Description SerBin implementation for HashMap where both key and value implement SerBin. Provides the ser_bin method to serialize the map into a byte vector. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The map value to serialize. - `s: &mut Vec` - The mutable byte vector to append the serialized data to. ### Type Parameters - `K: SerBin` - `V: SerBin` ### Source [serde_bin.rs#574-587](https://docs.rs/nanoserde/latest/src/nanoserde/serde_bin.rs.html#574-587) ``` -------------------------------- ### as_f64 Source: https://docs.rs/nanoserde/latest/nanoserde/struct.DeJsonState.html Parses the current token as a 64-bit floating-point number. ```APIDOC ## Method: as_f64 ### Description Parses the current token as a 64-bit floating-point number. ### Signature `pub fn as_f64(&mut self) -> Result` ### Returns - `Result` - The parsed value or error. ``` -------------------------------- ### impl SerBin for HashMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes a HashMap where both keys and values implement SerBin. Available on crate feature `std` only. ```APIDOC ## impl SerBin for HashMap ### Description Serializes a HashMap where both keys and values implement SerBin. Available on crate feature `std` only. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `s` (`&mut Vec`) - The output buffer to append the serialized bytes to. ### Trait Bound - `K: SerBin` - `V: SerBin` ### Availability - crate feature `std` only. ``` -------------------------------- ### TomlParser::parse usage example Source: https://docs.rs/nanoserde/latest/nanoserde/struct.TomlParser.html Parses a TOML string and accesses a value using dot notation. The parse method returns a Result with a BTreeMap or a TomlErr. ```rust let toml = "[Section]\nvalue=1"; let parsed = TomlParser::parse(toml).unwrap(); assert_eq!(parsed["Section.value"], Toml::Num(1.)); ``` -------------------------------- ### impl SerJson for (A, B, C) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html SerJson implementation for 3-element tuples where all elements implement SerJson. Provides the ser_json method to serialize the tuple. ```APIDOC ## Trait Implementation: SerJson for (A, B, C) ### Description Implements the SerJson trait for 3-element tuples (A, B, C) where A, B, and C implement SerJson. This allows serializing tuples into JSON format. ### Method `fn ser_json(&self, d: usize, s: &mut SerJsonState)` ### Parameters - `d` (usize) - Depth parameter for serialization. - `s` (&mut SerJsonState) - Mutable reference to the serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#1136-1144) ``` -------------------------------- ### impl SerBin for HashSet Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes a HashSet into a byte vector. Available on crate feature 'std' only. ```APIDOC ## impl SerBin for HashSet ### Description Serializes a HashSet into a byte vector. Available on crate feature 'std' only. ### Method fn ser_bin(&self, s: &mut Vec) ### Parameters - **self** (&HashSet) - The HashSet to serialize. - **s** (&mut Vec) - The byte vector to append the serialized data to. ### Requirements T: SerBin ``` -------------------------------- ### impl SerBin for (A, B) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html SerBin implementation for 2-tuples where each element implements SerBin. Provides the ser_bin method to serialize the tuple into a byte vector. ```APIDOC ## impl SerBin for (A, B) ### Description SerBin implementation for 2-tuples where each element implements SerBin. Provides the ser_bin method to serialize the tuple into a byte vector. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The tuple value to serialize. - `s: &mut Vec` - The mutable byte vector to append the serialized data to. ### Type Parameters - `A: SerBin` - `B: SerBin` ### Source [serde_bin.rs#497-500](https://docs.rs/nanoserde/latest/src/nanoserde/serde_bin.rs.html#497-500) ``` -------------------------------- ### impl SerJson for (A, B) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html SerJson implementation for 2-element tuples where both elements implement SerJson. Provides the ser_json method to serialize the tuple. ```APIDOC ## Trait Implementation: SerJson for (A, B) ### Description Implements the SerJson trait for 2-element tuples (A, B) where both A and B implement SerJson. This allows serializing tuples into JSON format. ### Method `fn ser_json(&self, d: usize, s: &mut SerJsonState)` ### Parameters - `d` (usize) - Depth parameter for serialization. - `s` (&mut SerJsonState) - Mutable reference to the serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#1108-1114) ``` -------------------------------- ### impl SerBin for (A, B, C) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html SerBin implementation for 3-tuples where each element implements SerBin. Provides the ser_bin method to serialize the tuple into a byte vector. ```APIDOC ## impl SerBin for (A, B, C) ### Description SerBin implementation for 3-tuples where each element implements SerBin. Provides the ser_bin method to serialize the tuple into a byte vector. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The tuple value to serialize. - `s: &mut Vec` - The mutable byte vector to append the serialized data to. ### Type Parameters - `A: SerBin` - `B: SerBin` - `C: SerBin` ### Source [serde_bin.rs#519-523](https://docs.rs/nanoserde/latest/src/nanoserde/serde_bin.rs.html#519-523) ``` -------------------------------- ### impl DeBin for HashMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeBin.html Deserializes a HashMap from binary data. The keys and values must implement DeBin, and keys must also implement Eq and Hash. This implementation is only available with the `std` feature. ```APIDOC ## DeBin for HashMap ### Description Deserializes a HashMap from binary data. The keys and values must implement DeBin, and keys must also implement Eq and Hash. This implementation is only available with the `std` feature. ### Method `fn de_bin(o: &mut usize, d: &[u8]) -> Result` ### Parameters - `o` (`&mut usize`) - Required - A mutable reference to the current offset in the binary data. - `d` (`&[u8]`) - Required - The binary data to deserialize from. ### Return Value - `Result` - The deserialized HashMap or an error. ### Type Constraints - `K: DeBin + Eq + Hash` - `V: DeBin` ### Availability - Requires the `std` feature. ``` -------------------------------- ### as_string Source: https://docs.rs/nanoserde/latest/nanoserde/struct.DeJsonState.html Parses the current token as a string. ```APIDOC ## Method: as_string ### Description Parses the current token as a string. ### Signature `pub fn as_string(&mut self) -> Result` ### Returns - `Result` - The parsed string or error. ``` -------------------------------- ### impl SerRon for [T; N] Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html SerRon implementation for arrays of fixed size N, where T implements SerRon. ```APIDOC ## impl SerRon for [T; N] ### Description SerRon implementation for arrays of fixed size N, where T implements SerRon. ### Method `fn ser_ron(&self, d: usize, s: &mut SerRonState)` ### Parameters - `d` (usize) - Indentation depth. - `s` (&mut SerRonState) - The RON serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_ron.rs.html#1036-1038) ``` -------------------------------- ### fn serialize_bin(&self) -> Vec Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes the value to binary bytes and returns them as a new vector. This is a convenient wrapper around `ser_bin`. ```APIDOC ## fn serialize_bin(&self) -> Vec ### Description Serializes the value to binary bytes and returns them as a new vector. This is a convenient wrapper around `ser_bin`. ### Method serialize_bin ### Signature fn serialize_bin(&self) -> Vec ### Returns - **Vec** - The serialized binary bytes. ``` -------------------------------- ### impl SerBin for BTreeMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html SerBin implementation for BTreeMap where both key and value implement SerBin. Provides the ser_bin method to serialize the map into a byte vector. ```APIDOC ## impl SerBin for BTreeMap ### Description SerBin implementation for BTreeMap where both key and value implement SerBin. Provides the ser_bin method to serialize the map into a byte vector. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The map value to serialize. - `s: &mut Vec` - The mutable byte vector to append the serialized data to. ### Type Parameters - `K: SerBin` - `V: SerBin` ### Source [serde_bin.rs#612-619](https://docs.rs/nanoserde/latest/src/nanoserde/serde_bin.rs.html#612-619) ``` -------------------------------- ### impl Index for Toml Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Provides indexing support for the Toml enum, allowing access to elements by index. ```APIDOC ## impl Index for Toml ### Description Performs the indexing (`container[index]`) operation. ### Associated Type - **Output** = BTreeMap - The returned type after indexing. ### Method fn index(&self, index: usize) -> &Self::Output ### Parameters - **self** (&Toml) - The Toml instance. - **index** (usize) - The index to access. ### Returns - **&Self::Output** - A reference to the indexed value. ``` -------------------------------- ### SerRon for (A, B, C) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html Implementation of the SerRon trait for 3-element tuples where each element implements SerRon. ```APIDOC ## SerRon for (A, B, C) ### Description Implementation of the SerRon trait for 3-element tuples (A, B, C) where all elements implement SerRon. This allows tuples to be serialized into RON format. ### Method ser_ron ### Signature fn ser_ron(&self, d: usize, s: &mut SerRonState) ### Parameters - **&self** - The tuple value to serialize. - **d** (usize) - Depth parameter. - **s** (&mut SerRonState) - The serializer state to write to. ### Type Constraints - A: SerRon - B: SerRon - C: SerRon ### Return Value None (writes to the provided SerRonState). ``` -------------------------------- ### SerRon derive macro usage Source: https://docs.rs/nanoserde/latest/nanoserde/derive.SerRon.html Shows the syntax for deriving SerRon on a type, with the nserde attribute available for customization. ```rust #[derive(SerRon)] { // Attributes available to this derive: #[nserde] } ``` -------------------------------- ### impl SerBin for (A, B, C, D) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html SerBin implementation for 4-tuples where each element implements SerBin. Provides the ser_bin method to serialize the tuple into a byte vector. ```APIDOC ## impl SerBin for (A, B, C, D) ### Description SerBin implementation for 4-tuples where each element implements SerBin. Provides the ser_bin method to serialize the tuple into a byte vector. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The tuple value to serialize. - `s: &mut Vec` - The mutable byte vector to append the serialized data to. ### Type Parameters - `A: SerBin` - `B: SerBin` - `C: SerBin` - `D: SerBin` ### Source [serde_bin.rs#548-553](https://docs.rs/nanoserde/latest/src/nanoserde/serde_bin.rs.html#548-553) ``` -------------------------------- ### impl SerBin for Option Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes an Option into a byte vector. ```APIDOC ## impl SerBin for Option ### Description Serializes an Option into a byte vector. ### Method fn ser_bin(&self, s: &mut Vec) ### Parameters - **self** (&Option) - The Option to serialize. - **s** (&mut Vec) - The byte vector to append the serialized data to. ### Requirements T: SerBin ``` -------------------------------- ### SerRon for (A, B) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html Implementation of the SerRon trait for 2-element tuples where each element implements SerRon. ```APIDOC ## SerRon for (A, B) ### Description Implementation of the SerRon trait for 2-element tuples (A, B) where both A and B implement SerRon. This allows tuples to be serialized into RON format. ### Method ser_ron ### Signature fn ser_ron(&self, d: usize, s: &mut SerRonState) ### Parameters - **&self** - The tuple value to serialize. - **d** (usize) - Depth parameter. - **s** (&mut SerRonState) - The serializer state to write to. ### Type Constraints - A: SerRon - B: SerRon ### Return Value None (writes to the provided SerRonState). ``` -------------------------------- ### impl PartialEq for Toml Source: https://docs.rs/nanoserde/latest/nanoserde/enum.Toml.html Provides equality comparison for the Toml enum. ```APIDOC ## impl PartialEq for Toml ### Description Equality operator `==`. ### Method fn eq(&self, other: &Toml) -> bool ### Parameters - **self** (&Toml) - The Toml instance. - **other** (&Toml) - The other Toml to compare. ### Returns - **bool** - Whether the two values are equal. ### Method fn ne(&self, other: &Rhs) -> bool ### Description Inequality operator `!=`. ### Parameters - **self** (&Toml) - The Toml instance. - **other** (&Rhs) - The other value to compare. ### Returns - **bool** - Whether the two values are not equal. ``` -------------------------------- ### SerRon for (A, B, C, D) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html Implementation of the SerRon trait for 4-element tuples where each element implements SerRon. ```APIDOC ## SerRon for (A, B, C, D) ### Description Implementation of the SerRon trait for 4-element tuples (A, B, C, D) where all elements implement SerRon. This allows tuples to be serialized into RON format. ### Method ser_ron ### Signature fn ser_ron(&self, d: usize, s: &mut SerRonState) ### Parameters - **&self** - The tuple value to serialize. - **d** (usize) - Depth parameter. - **s** (&mut SerRonState) - The serializer state to write to. ### Type Constraints - A: SerRon - B: SerRon - C: SerRon - D: SerRon ### Return Value None (writes to the provided SerRonState). ``` -------------------------------- ### impl SerJson for HashMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html SerJson implementation for HashMap (available with the std feature) where both key and value types implement SerJson. Provides the ser_json method to serialize the map. ```APIDOC ## Trait Implementation: SerJson for HashMap ### Description Implements the SerJson trait for HashMap where K and V implement SerJson. This allows serializing HashMap instances into JSON format. This implementation is available only with the `std` feature. ### Method `fn ser_json(&self, d: usize, s: &mut SerJsonState)` ### Parameters - `d` (usize) - Depth parameter for serialization. - `s` (&mut SerJsonState) - Mutable reference to the serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#1206-1226) ``` -------------------------------- ### impl SerJson for BTreeMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html SerJson implementation for BTreeMap where both key and value types implement SerJson. Provides the ser_json method to serialize the map. ```APIDOC ## Trait Implementation: SerJson for BTreeMap ### Description Implements the SerJson trait for BTreeMap where K and V implement SerJson. This allows serializing BTreeMap instances into JSON format. ### Method `fn ser_json(&self, d: usize, s: &mut SerJsonState)` ### Parameters - `d` (usize) - Depth parameter for serialization. - `s` (&mut SerJsonState) - Mutable reference to the serialization state. ### Source [Source](https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#1249-1269) ``` -------------------------------- ### impl SerJson for HashSet Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html SerJson implementation for HashSet. Serializes the set as a JSON array. Available on crate feature `std` only. ```APIDOC ## impl SerJson for HashSet ### Description SerJson implementation for HashSet. Serializes the set as a JSON array. Available on crate feature `std` only. ### Method `fn ser_json(&self, d: usize, s: &mut SerJsonState)` ### Parameters - `d` (usize) - Depth parameter for serialization. - `s` (&mut SerJsonState) - Mutable reference to the serialization state. ### Requirements - `T: SerJson` - Crate feature `std` must be enabled. ### Source [serde_json.rs#912-930](https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#912-930) ``` -------------------------------- ### as_f64 Source: https://docs.rs/nanoserde/latest/nanoserde/struct.DeRonState.html Parses a floating-point number from the RON input. Returns a Result containing the parsed f64 or a DeRonErr. ```APIDOC ## as_f64 ### Description Parses a floating-point number from the RON input. Returns a Result containing the parsed f64 or a DeRonErr. ### Method as_f64 ### Signature pub fn as_f64(&mut self) -> Result ### Parameters None. ### Returns - **Result** - Ok(value) on success, or Err(DeRonErr) on failure. ``` -------------------------------- ### deserialize_bin Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeBin.html Parses Self from the input bytes. This is a convenient wrapper around `de_bin`. ```APIDOC ## deserialize_bin ### Description Parses Self from the input bytes. This is a convenient wrapper around `de_bin`. ### Method `fn deserialize_bin(d: &[u8]) -> Result` ### Parameters - **d** (`&[u8]`) - Required - The input byte slice to deserialize from. ### Returns - `Result` - The deserialized value or an error. ``` -------------------------------- ### SerBin for i64 Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Implementation of the SerBin trait for the i64 type, providing the ser_bin method to serialize an i64 value into a byte vector. ```APIDOC ## SerBin for i64 ### Description Implementation of the SerBin trait for the i64 type, providing the ser_bin method to serialize an i64 value into a byte vector. ### Method ser_bin ### Signature fn ser_bin(&self, s: &mut Vec) ### Parameters - **self** (&i64) - The value to serialize. - **s** (&mut Vec) - The byte vector to append the serialized data to. ### Return No return value; the serialized bytes are appended to the provided vector. ``` -------------------------------- ### as_string Source: https://docs.rs/nanoserde/latest/nanoserde/struct.DeRonState.html Parses a string from the RON input. Returns a Result containing the parsed String or a DeRonErr. ```APIDOC ## as_string ### Description Parses a string from the RON input. Returns a Result containing the parsed String or a DeRonErr. ### Method as_string ### Signature pub fn as_string(&mut self) -> Result ### Parameters None. ### Returns - **Result** - Ok(value) on success, or Err(DeRonErr) on failure. ``` -------------------------------- ### DeBinErr::new Source: https://docs.rs/nanoserde/latest/nanoserde/struct.DeBinErr.html Constructs a new DeBinErr instance. This helper method takes the offset, expected length, and actual length to create an error with the appropriate offset and reason. ```APIDOC ## DeBinErr::new ### Description Constructs a new `DeBinErr` instance. This helper method takes the offset, expected length, and actual length to create an error with the appropriate offset and reason. ### Method `pub fn new(offset: usize, expected_length: usize, actual_length: usize) -> Self` ### Parameters - **offset** (usize) - Required - The offset where the error occurred. - **expected_length** (usize) - Required - The expected length of the data. - **actual_length** (usize) - Required - The actual length of the data. ### Returns - **Self** - A new `DeBinErr` instance. ### Example ```rust let err = DeBinErr::new(0, 10, 5); ``` ``` -------------------------------- ### SerBin::ser_bin Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html The ser_bin method is the core method of the SerBin trait. It serializes the value into a byte vector. Implementations exist for unit, String, bool, f32, f64, and i8. ```APIDOC ## SerBin::ser_bin ### Description Serializes the value into a byte vector. This is the primary method of the SerBin trait. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The value to serialize. - `s: &mut Vec` - The byte vector to append the serialized data to. ### Implementations - `impl SerBin for ()` - `impl SerBin for String` - `impl SerBin for bool` - `impl SerBin for f32` - `impl SerBin for f64` - `impl SerBin for i8` ### Usage Call `ser_bin` on any type that implements `SerBin` to serialize it into a byte vector. ``` -------------------------------- ### SerRon for u64 Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerRon.html Implementation of the SerRon trait for the u64 primitive type, providing the ser_ron method to serialize a u64 value. ```APIDOC ## SerRon for u64 ### Description Implementation of the SerRon trait for the u64 primitive type. This allows u64 values to be serialized into RON format using the ser_ron method. ### Method ser_ron ### Signature fn ser_ron(&self, _d: usize, s: &mut SerRonState) ### Parameters - **&self** - The u64 value to serialize. - **_d** (usize) - Depth parameter (unused). - **s** (&mut SerRonState) - The serializer state to write to. ### Return Value None (writes to the provided SerRonState). ``` -------------------------------- ### SerJson for (A, B, C, D) Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html Implementation of the SerJson trait for 4-element tuples where each element implements SerJson, providing the ser_json method to serialize the tuple to JSON. ```APIDOC ## SerJson for (A, B, C, D) ### Description Implements the SerJson trait for tuples of four elements (A, B, C, D) where each element type implements SerJson. This allows serialization of such tuples to JSON. ### Method ser_json(&self, d: usize, s: &mut SerJsonState) ### Parameters - **&self** - The tuple value to serialize. - **d** (usize) - Depth parameter. - **s** (&mut SerJsonState) - Mutable reference to the JSON serialization state. ### Type Constraints - A: SerJson - B: SerJson - C: SerJson - D: SerJson ### Return Value None (writes serialized data to the state). ``` -------------------------------- ### DeBin derive attribute syntax Source: https://docs.rs/nanoserde/latest/nanoserde/derive.DeBin.html Shows the attribute syntax for the DeBin derive macro. The #[nserde] attribute is available for customization. ```rust #[derive(DeBin)] { // Attributes available to this derive: #[nserde] } ``` -------------------------------- ### impl SerBin for u64 Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Implements the SerBin trait for the u64 type, providing binary serialization. ```APIDOC ## impl SerBin for u64 ### Description Implements the SerBin trait for the u64 type, providing binary serialization. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `&self` - The value to serialize. - `s` (`&mut Vec`) - The buffer to append the serialized bytes to. ### Return No return value; appends serialized bytes to `s`. ``` -------------------------------- ### SerJson for u64 Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html Implementation of the SerJson trait for the u64 type, providing the ser_json method to serialize a u64 value to JSON. ```APIDOC ## SerJson for u64 ### Description Implements the SerJson trait for the u64 type, allowing serialization of u64 values to JSON. ### Method ser_json(&self, _d: usize, s: &mut SerJsonState) ### Parameters - **&self** - The u64 value to serialize. - **_d** (usize) - Depth parameter (unused). - **s** (&mut SerJsonState) - Mutable reference to the JSON serialization state. ### Return Value None (writes serialized data to the state). ``` -------------------------------- ### SerBin for i32 Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Implementation of the SerBin trait for the i32 type, providing the ser_bin method to serialize an i32 value into a byte vector. ```APIDOC ## SerBin for i32 ### Description Implementation of the SerBin trait for the i32 type, providing the ser_bin method to serialize an i32 value into a byte vector. ### Method ser_bin ### Signature fn ser_bin(&self, s: &mut Vec) ### Parameters - **self** (&i32) - The value to serialize. - **s** (&mut Vec) - The byte vector to append the serialized data to. ### Return No return value; the serialized bytes are appended to the provided vector. ``` -------------------------------- ### impl SerJson for Box Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html SerJson implementation for Box. Serializes the boxed value. ```APIDOC ## impl SerJson for Box ### Description SerJson implementation for Box. Serializes the boxed value. ### Method `fn ser_json(&self, d: usize, s: &mut SerJsonState)` ### Parameters - `d` (usize) - Depth parameter for serialization. - `s` (&mut SerJsonState) - Mutable reference to the serialization state. ### Requirements - `T: SerJson` ### Source [serde_json.rs#1291-1298](https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#1291-1298) ``` -------------------------------- ### impl SerBin for [T; N] Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes a fixed-size array of elements that implement SerBin. ```APIDOC ## impl SerBin for [T; N] ### Description Serializes a fixed-size array of elements that implement SerBin. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `s` (`&mut Vec`) - The output buffer to append the serialized bytes to. ### Trait Bound - `T: SerBin` ``` -------------------------------- ### impl SerBin for HashSet Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Serializes a HashSet where the element type implements SerBin. ```APIDOC ## impl SerBin for HashSet ### Description Serializes a HashSet where the element type implements SerBin. ### Method `fn ser_bin(&self, s: &mut Vec)` ### Parameters - `s` (`&mut Vec`) - The output buffer to append the serialized bytes to. ### Trait Bound - `T: SerBin` ``` -------------------------------- ### impl SerJson for Option Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerJson.html Serializes an Option to JSON using the ser_json method. Requires T to implement SerJson. ```APIDOC ## impl SerJson for Option ### Description Serializes an Option to JSON. Requires T to implement SerJson. ### Method ser_json ### Signature fn ser_json(&self, d: usize, s: &mut SerJsonState) ### Parameters - **d** (usize) - Required - Depth parameter for serialization. - **s** (&mut SerJsonState) - Required - Mutable reference to the serialization state. ### Type Parameters - **T** - Must implement SerJson. ### Source https://docs.rs/nanoserde/latest/src/nanoserde/serde_json.rs.html#779-785 ``` -------------------------------- ### SerBin for i16 Source: https://docs.rs/nanoserde/latest/nanoserde/trait.SerBin.html Implementation of the SerBin trait for the i16 type, providing the ser_bin method to serialize an i16 value into a byte vector. ```APIDOC ## SerBin for i16 ### Description Implementation of the SerBin trait for the i16 type, providing the ser_bin method to serialize an i16 value into a byte vector. ### Method ser_bin ### Signature fn ser_bin(&self, s: &mut Vec) ### Parameters - **self** (&i16) - The value to serialize. - **s** (&mut Vec) - The byte vector to append the serialized data to. ### Return No return value; the serialized bytes are appended to the provided vector. ``` -------------------------------- ### DeRon derive macro usage Source: https://docs.rs/nanoserde/latest/nanoserde/derive.DeRon.html Shows the syntax for deriving DeRon on a type. The #[nserde] attribute is available for customization. ```rust #[derive(DeRon)] { // Attributes available to this derive: #[nserde] } ``` -------------------------------- ### impl DeBin for BTreeMap Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeBin.html Deserializes a BTreeMap from binary data. The keys and values must implement DeBin, and keys must also implement Eq and Ord. ```APIDOC ## DeBin for BTreeMap ### Description Deserializes a BTreeMap from binary data. The keys and values must implement DeBin, and keys must also implement Eq and Ord. ### Method `fn de_bin(o: &mut usize, d: &[u8]) -> Result` ### Parameters - `o` (`&mut usize`) - Required - A mutable reference to the current offset in the binary data. - `d` (`&[u8]`) - Required - The binary data to deserialize from. ### Return Value - `Result` - The deserialized BTreeMap or an error. ### Type Constraints - `K: DeBin + Eq + Ord` - `V: DeBin` ``` -------------------------------- ### impl DeBin for HashSet Source: https://docs.rs/nanoserde/latest/nanoserde/trait.DeBin.html Deserializes a HashSet from binary data. Requires T to implement DeBin, Hash, and Eq. Available on crate feature `std` only. ```APIDOC ## DeBin for HashSet ### Description Deserializes a HashSet from binary data. Requires T to implement DeBin, Hash, and Eq. Available on crate feature `std` only. ### Method `fn de_bin(o: &mut usize, d: &[u8]) -> Result` ### Parameters - `o` (usize) - Required - Offset into the byte slice. - `d` (u8 slice) - Required - Binary data to deserialize from. ### Returns - `Result` - The deserialized HashSet or an error. ```