[][src]Trait contralog::Logger

pub trait Logger<I> {
    type Error;
    fn log(&mut self, item: I) -> Result<(), Self::Error>;

    fn by_ref(&mut self) -> &mut Self { ... }
fn chain<L>(self, other: L) -> Chain<Self, L>
    where
        Self: Sized
, { ... }
fn filter<F>(self, f: F) -> Filter<Self, F>
    where
        Self: Sized,
        F: FnMut(&I) -> bool
, { ... }
fn map<F, B>(self, f: F) -> Map<Self, F, B>
    where
        Self: Sized
, { ... }
fn safe<E>(self) -> Safe<Self, E>
    where
        Self: Sized
, { ... } }

A logger is a routine that takes input and has side-effects.

See the documentation for the contralog crate for a general overview of loggers.

Associated Types

type Error

Loading content...

Required methods

fn log(&mut self, item: I) -> Result<(), Self::Error>

Loading content...

Provided methods

fn by_ref(&mut self) -> &mut Self

Create a “by reference” adaptor for this logger.

fn chain<L>(self, other: L) -> Chain<Self, L> where
    Self: Sized

Combine two loggers, creating a new logger that logs each input to both loggers.

fn filter<F>(self, f: F) -> Filter<Self, F> where
    Self: Sized,
    F: FnMut(&I) -> bool

Apply a function to each input and pass it to the logger only if the function returns true for it.

fn map<F, B>(self, f: F) -> Map<Self, F, B> where
    Self: Sized

Apply a function to each input before passing it to the logger.

fn safe<E>(self) -> Safe<Self, E> where
    Self: Sized

Return a logger that silently drops errors reported by this logger.

Loading content...

Implementations on Foreign Types

impl<'a, I, L> Logger<I> for &'a mut L where
    L: Logger<I>, 
[src]

type Error = L::Error

Loading content...

Implementors

impl<C, I> Logger<I> for Extender<C, I> where
    C: Extend<I>, 
[src]

type Error = Infallible

impl<I, E> Logger<I> for Empty<I, E>[src]

type Error = E

impl<I, L, E> Logger<I> for Safe<L, E> where
    L: Logger<I>, 
[src]

type Error = E

impl<I, L, F> Logger<I> for Filter<L, F> where
    L: Logger<I>,
    F: FnMut(&I) -> bool
[src]

type Error = L::Error

impl<I, L, F, B> Logger<B> for Map<L, F, B> where
    L: Logger<I>,
    F: FnMut(B) -> I, 
[src]

type Error = L::Error

impl<I, L, M> Logger<I> for Chain<L, M> where
    L: Logger<I>,
    M: Logger<I, Error = L::Error>,
    I: Clone
[src]

type Error = L::Error

Loading content...