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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use Deref;
/// A reference to a static string that a view can store without copying.
///
/// Use this when interpolating a string constant into a view:
///
/// ```rust
/// # use topcoat::view::{PromotedStr, View, component, view};
/// # #[component]
/// # async fn example() -> topcoat::Result<impl View> {
/// Ok(view! {
/// <div>(PromotedStr(&"hello"))</div>
/// })
/// # }
/// ```
///
/// The leading `&` borrows the constant for the `'static` lifetime. Use
/// [`StaticStr`] for a static string selected at runtime.
;
/// A static string a view records without copying it.
///
/// Wrap a `&'static str` in this type to avoid the copy made when a view
/// captures an ordinary `&str`:
///
/// ```rust
/// # use topcoat::view::{StaticStr, View, component, view};
/// # #[component]
/// # async fn example() -> topcoat::Result<impl View> {
/// # let name: &'static str = "hello";
/// Ok(view! {
/// <div>(StaticStr(name))</div>
/// })
/// # }
/// ```
///
/// A string written as a literal can be further optimized by using [`PromotedStr`].
;
/// A wrapper that marks its contents as already-safe HTML.
///
/// Use this only for trusted markup such as pre-rendered or sanitized HTML.
/// Passing untrusted input through this type defeats the runtime's escaping.
T);