Struct BTreeMapToArray

Source
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>

Source

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.

Source

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.
Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn always_inline_schema() -> bool

👎Deprecated: Use inline_schema() instead
Only included for backward-compatibility - use inline_schema() instead“. Read more
Source§

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 more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more

Auto 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>
where K: Send, V: Send, N: Send, T: Send,

§

impl<K, V, N, T> Sync for BTreeMapToArray<K, V, N, T>
where K: Sync, V: Sync, N: Sync, T: Sync,

§

impl<K, V, N, T> Unpin for BTreeMapToArray<K, V, N, T>
where K: Unpin, V: Unpin, N: Unpin, T: Unpin,

§

impl<K, V, N, T> UnwindSafe for BTreeMapToArray<K, V, N, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.