Skip to main content

MapKeyOut

Trait MapKeyOut 

Source
pub trait MapKeyOut {
    // Required method
    fn as_str(&self) -> &str;
}
Expand description

Sealed adapter from a map’s key type to the borrowed &str form.

JSON object keys are always strings, so any map serialized via ToJson needs its key type to expose a &str view. Implemented for String, &str, and Cow<'_, str> — the same set the parse side supports via MapKey.

Required Methods§

Source

fn as_str(&self) -> &str

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MapKeyOut for &str

Source§

fn as_str(&self) -> &str

Source§

impl MapKeyOut for Cow<'_, str>

Source§

fn as_str(&self) -> &str

Source§

impl MapKeyOut for String

Source§

fn as_str(&self) -> &str

Implementors§