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
//! Model for values in the WebAssembly syntax.
/// Names are sequences of characters, which are scalar values as defined by Unicode (Section 2.4).
/// Due to the limitations of the binary format,
/// the length of a name is bounded by the length of its UTF-8 encoding.
///
/// See <https://webassembly.github.io/spec/core/syntax/values.html#names>
///
/// # Examples
/// ```rust
/// use wasm_ast::Name;
///
/// let text = "test";
/// let name = Name::new(String::from(text));
///
/// assert_eq!(name, Name::from(text));
/// assert_eq!(name, Name::from(text.to_string()));
/// assert_eq!(name.as_bytes(), text.as_bytes());
/// assert_eq!(name.len(), text.len());
/// assert_eq!(name.is_empty(), false);
/// ```