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
50
51
52
53
54
55
56
57
pub(crate) mod private {
use crate::{
layout::Typography,
paint::{
Appearance,
IntoResources,
Resource,
},
};
use taffy::Style;
/// Sealed avoids exposing private methods and stops crates
/// other than decal from implementing any traits that use it.
/// https://docs.rs/byteorder/1.5.0/src/byteorder/lib.rs.html#169
pub trait Sealed {
/// Returns a reference to the node layout.
fn layout(&self) -> &Style;
/// Returns a reference to the node visual appearance.
fn visual(&self) -> &Appearance;
/// Returns a reference to the node typography.
#[allow(private_interfaces)]
fn typography(&self) -> &Typography;
/// Returns a reference to the resources associated with the node.
#[allow(private_interfaces)]
fn resources(&self) -> &Vec<Resource>;
/// Returns a mutable reference to the node layout.
fn layout_mut(&mut self) -> &mut Style;
/// Returns a mutable reference to the node visual appearance.
fn visual_mut(&mut self) -> &mut Appearance;
/// Returns a mutable reference to the node typography.
#[allow(private_interfaces)]
fn typography_mut(&mut self) -> &mut Typography;
/// Returns a mutable reference to the resources associated with the
/// node.
#[allow(private_interfaces)]
fn resources_mut(&mut self) -> &mut Vec<Resource>;
/// Adds resources derived from the provided value to the node.
///
/// # Arguments
/// - `value`: The resource source convertible using [`IntoResources`].
#[allow(private_bounds)]
fn add_resources<T>(&mut self, value: T)
where
T: IntoResources,
{
self.resources_mut().extend(value.into_resources());
}
}
}