[][src]Trait log::key_values::source::Source

pub trait Source {
    fn visit<'kvs>(
        &'kvs self,
        visitor: &mut dyn Visitor<'kvs>
    ) -> Result<(), Error>; fn erase(&self) -> ErasedSource
    where
        Self: Sized
, { ... }
fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>>
    where
        Q: ToKey
, { ... }
fn by_ref(&self) -> &Self { ... }
fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS>
    where
        Self: Sized
, { ... }
fn try_for_each<F, E>(self, f: F) -> Result<(), Error>
    where
        Self: Sized,
        F: FnMut(Key, Value) -> Result<(), E>,
        E: Into<Error>
, { ... }
fn as_map(self) -> AsMap<Self>
    where
        Self: Sized
, { ... }
fn as_seq(self) -> AsSeq<Self>
    where
        Self: Sized
, { ... } }

A source for key value pairs that can be serialized.

Required methods

fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>

Serialize the key value pairs.

Loading content...

Provided methods

fn erase(&self) -> ErasedSource where
    Self: Sized

Erase this Source so it can be used without requiring generic type parameters.

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey

Find the value for a given key.

If the key is present multiple times, whether or not this method will return the first or last value for a given key is not defined.

The default implementation will scan all key-value pairs. Implementors are encouraged provide a more efficient version if they can. Standard collections like BTreeMap and HashMap will do an indexed lookup instead of a scan.

fn by_ref(&self) -> &Self

An adapter to borrow self.

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized

Chain two Sources together.

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 

Apply a function to each key-value pair.

fn as_map(self) -> AsMap<Self> where
    Self: Sized

Serialize the key-value pairs as a map.

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized

Serialize the key-value pairs as a sequence.

Loading content...

Implementations on Foreign Types

impl<'a, T: ?Sized> Source for &'a T where
    T: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<K, V> Source for (K, V) where
    K: ToKey,
    V: ToValue
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<KVS> Source for [KVS] where
    KVS: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<KVS: ?Sized> Source for Box<KVS> where
    KVS: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<KVS: ?Sized> Source for Arc<KVS> where
    KVS: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<KVS: ?Sized> Source for Rc<KVS> where
    KVS: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<KVS> Source for Vec<KVS> where
    KVS: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<K, V> Source for BTreeMap<K, V> where
    K: Borrow<str> + Ord,
    V: ToValue
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<K, V> Source for HashMap<K, V> where
    K: Borrow<str> + Eq + Hash,
    V: ToValue
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

Loading content...

Implementors

impl<'a> Source for ErasedSource<'a>[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

impl<A, B> Source for Chained<A, B> where
    A: Source,
    B: Source
[src]

fn erase(&self) -> ErasedSource where
    Self: Sized
[src]

fn get<'kvs, Q>(&'kvs self, key: Q) -> Option<Value<'kvs>> where
    Q: ToKey
[src]

fn by_ref(&self) -> &Self[src]

fn chain<KVS>(self, other: KVS) -> Chained<Self, KVS> where
    Self: Sized
[src]

fn try_for_each<F, E>(self, f: F) -> Result<(), Error> where
    Self: Sized,
    F: FnMut(Key, Value) -> Result<(), E>,
    E: Into<Error>, 
[src]

fn as_map(self) -> AsMap<Self> where
    Self: Sized
[src]

fn as_seq(self) -> AsSeq<Self> where
    Self: Sized
[src]

Loading content...