terrazzo-client 0.2.10

A simple macro to clone variables before passing them into a `move` closure or async block.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Templates

use crate::debug_correlation_id::DebugCorrelationId;
use crate::signal::depth::Depth;

/// A trait implemented by element templates, e.g. node and attribute templates.
pub trait IsTemplate: Clone + 'static {
    type Value;
    fn apply<R: Into<Self::Value>>(self, new: impl FnOnce() -> R);
    fn depth(&self) -> Depth;
    fn debug_id(&self) -> &DebugCorrelationId<impl std::fmt::Display>;
}

/// A trait implemented by templatable elements, e.g. node and attributes.
pub trait IsTemplated {
    type Template: IsTemplate<Value = Self>;
}