roopes_core/primitives/handler/mod.rs
1//!
2#![cfg_attr(feature = "doc-images",
3 cfg_attr(
4 all(),
5 doc = ::embed_doc_image::embed_image!(
6 "handler-diagram",
7 "src/primitives/handler/handler.svg"
8)))]
9//! Provides types which receive a borrowed value.
10//!
11//! ![handler diagram][handler-diagram]
12
13pub mod hash;
14pub mod heap;
15pub mod lambda;
16
17pub use hash::Hashable;
18pub use heap::Heap;
19pub use lambda::Lambda;
20
21#[cfg(test)]
22mod tests;
23
24/// Defines a primitive interface which handles
25/// messages via borrowing.
26pub trait Handler<M>
27{
28 /// Receives a borrowed value.
29 fn handle(
30 &self,
31 message: &M,
32 );
33}
34
35// impl<C, M> From<Lambda<C, M>> for Heap<M>
36// where
37// C: Delegate<M> + 'static,
38// M: 'static,
39// {
40// fn from(handler: Lambda<C, M>) -> Heap<M>
41// {
42// Heap::new(Box::new(handler))
43// }
44// }
45
46/// Exposes the [`Handler`] type at the library
47/// level.
48pub mod prelude
49{
50 pub use super::Handler;
51}