noticeable 0.2.0

A library for lazy observables
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::marker::Send;
pub(crate) struct Callback<'a, E> {
    inner: Box<dyn FnMut(&E) + Send + 'a>,
}

impl<'a, E> Callback<'a, E> {
    pub fn new(callback: impl FnMut(&E) + Send + 'a) -> Self {
        Self {
            inner: Box::new(callback),
        }
    }

    pub fn call(&mut self, event: &E) {
        (self.inner)(event)
    }
}