1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Wrapper shells: [`forward_table_shell!`](crate::forward_table_shell)
//! implements [`TableShell`](crate::TableShell) for a wrapper holding an
//! inner shell in a field, handing every method to it unless the wrapper
//! overrides it.
pub use ForwardShell;
/// Implement [`TableShell`](crate::TableShell) for `$ty`, whose `$field`
/// holds the inner shell (anything that derefs to a `TableShell`, usually a
/// `Box<dyn TableShell>`). `$ty` must be `Clone`; its clone carries the inner
/// shell's clone, narrowing included.
///
/// The block holds the methods the wrapper changes, written as in an
/// `#[async_trait]` impl; every other method answers as the inner shell
/// does. Inside the block a call to the wrapper's own version of a method is
/// spelled `TableShell::list(self)`.
///
/// ```ignore
/// #[derive(Clone)]
/// struct Logged { inner: Box<dyn TableShell>, metadata: VistaMetadata }
///
/// vantage_vista::forward_table_shell!(Logged, inner, {
/// fn metadata(&self) -> &VistaMetadata { &self.metadata }
/// // reads, writes, get_ref...
/// });
///
/// let wrapped = vista.map_shell(|inner| Logged { inner, metadata });
/// ```