pub struct BTreeMapToArray<K, V, N = DefaultLabels, T = BTreeMap<K, V>>(/* private fields */);
Expand description
A converter between a BTreeMap
or BTreeMap
-like type and a sequence of named key-value pairs
for human-readable encoding formats.
See top-level docs for example usage.
Implementations§
Source§impl<K, V, N, T> BTreeMapToArray<K, V, N, T>
impl<K, V, N, T> BTreeMapToArray<K, V, N, T>
Sourcepub fn serialize<'a, S>(map: &'a T, serializer: S) -> Result<S::Ok, S::Error>where
K: 'a + Serialize,
V: 'a + Serialize,
N: KeyValueLabels,
&'a T: IntoIterator<Item = (&'a K, &'a V)> + Serialize,
S: Serializer,
pub fn serialize<'a, S>(map: &'a T, serializer: S) -> Result<S::Ok, S::Error>where
K: 'a + Serialize,
V: 'a + Serialize,
N: KeyValueLabels,
&'a T: IntoIterator<Item = (&'a K, &'a V)> + Serialize,
S: Serializer,
Serializes the given map
to an array of named key-values if the serializer is
human-readable. Otherwise serializes the map
as a map.
Sourcepub fn deserialize<'de, D>(deserializer: D) -> Result<T, D::Error>where
K: Deserialize<'de> + Ord,
V: Deserialize<'de>,
N: KeyValueLabels,
BTreeMap<K, V>: Into<T>,
T: Deserialize<'de>,
D: Deserializer<'de>,
pub fn deserialize<'de, D>(deserializer: D) -> Result<T, D::Error>where
K: Deserialize<'de> + Ord,
V: Deserialize<'de>,
N: KeyValueLabels,
BTreeMap<K, V>: Into<T>,
T: Deserialize<'de>,
D: Deserializer<'de>,
Deserializes from a serialized array of named key-values into a map if the serializer is human-readable. Otherwise deserializes from a serialized map.
Trait Implementations§
Source§impl<K, V, N, T> JsonSchema for BTreeMapToArray<K, V, N, T>
Available on crate feature json-schema
only.
impl<K, V, N, T> JsonSchema for BTreeMapToArray<K, V, N, T>
Available on crate feature
json-schema
only.Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn always_inline_schema() -> bool
fn always_inline_schema() -> bool
👎Deprecated: Use
inline_schema()
insteadOnly included for backward-compatibility - use
inline_schema()
instead“. Read moreSource§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref
keyword. Read moreAuto Trait Implementations§
impl<K, V, N, T> Freeze for BTreeMapToArray<K, V, N, T>
impl<K, V, N, T> RefUnwindSafe for BTreeMapToArray<K, V, N, T>
impl<K, V, N, T> Send for BTreeMapToArray<K, V, N, T>
impl<K, V, N, T> Sync for BTreeMapToArray<K, V, N, T>
impl<K, V, N, T> Unpin for BTreeMapToArray<K, V, N, T>
impl<K, V, N, T> UnwindSafe for BTreeMapToArray<K, V, N, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more