Trait log::kv::source::Source [−][src]
A source of key-value pairs.
The source may be a single pair, a set of pairs, or a filter over a set of pairs.
Use the Visitor
trait to inspect the structured data
in a source.
Required methods
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
Visit key-value pairs.
A source doesn’t have to guarantee any ordering or uniqueness of key-value pairs. If the given visitor returns an error then the source may early-return with it, even if there are more key-value pairs.
Implementation notes
A source should yield the same key-value pairs to a subsequent visitor unless that visitor itself fails.
Provided methods
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
Get the value for a given key.
If the key appears multiple times in the source then which key is returned is implementation specific.
Implementation notes
A source that can provide a more efficient implementation of this method should override it.
fn count(&self) -> usize
[src]
Count the number of key-value pairs that can be visited.
Implementation notes
A source that knows the number of key-value pairs upfront may provide a more efficient implementation.
A subsequent call to visit
should yield the same number of key-value pairs
to the visitor, unless that visitor fails part way through.
Implementations on Foreign Types
impl<'a, T: ?Sized> Source for &'a T where
T: Source,
[src]
T: Source,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<K, V> Source for (K, V) where
K: ToKey,
V: ToValue,
[src]
K: ToKey,
V: ToValue,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<S> Source for [S] where
S: Source,
[src]
S: Source,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<S> Source for Option<S> where
S: Source,
[src]
S: Source,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<S: ?Sized> Source for Box<S> where
S: Source,
[src]
S: Source,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<S> Source for Vec<S> where
S: Source,
[src]
S: Source,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<K, V, S> Source for HashMap<K, V, S> where
K: ToKey + Borrow<str> + Eq + Hash,
V: ToValue,
S: BuildHasher,
[src]
K: ToKey + Borrow<str> + Eq + Hash,
V: ToValue,
S: BuildHasher,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<K, V> Source for BTreeMap<K, V> where
K: ToKey + Borrow<str> + Ord,
V: ToValue,
[src]
K: ToKey + Borrow<str> + Ord,
V: ToValue,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
Implementors
impl<S> Source for AsList<S> where
S: Source,
[src]
S: Source,
fn visit<'kvs>(&'kvs self, visitor: &mut dyn Visitor<'kvs>) -> Result<(), Error>
[src]
fn get<'v>(&'v self, key: Key<'_>) -> Option<Value<'v>>
[src]
fn count(&self) -> usize
[src]
impl<S> Source for AsMap<S> where
S: Source,
[src]
S: Source,