Skip to main content

IntoKeyValue

Trait IntoKeyValue 

Source
pub trait IntoKeyValue<T: KeyValue> {
    // Required method
    fn into_key_value(self) -> T;
}
Expand description

What a key’s default may be written as.

env_key("depth", 3) and env_key("greeting", "hello") should both work, and Into cannot do it: 3.into() with an i64 target is ambiguous, because every integer width has a From into i64. This has one impl per destination, so the literal’s type is decided by the key’s.

Required Methods§

Source

fn into_key_value(self) -> T

The value itself.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IntoKeyValue<String> for &str

Implementors§

Source§

impl<T: KeyValue> IntoKeyValue<T> for T