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
#[cfg(feature = "compile-with-external-structures")]
use crate::containers::ExternalPtr;
#[cfg(feature = "compile-with-external-structures")]
type Ptr<T> = ExternalPtr<T>;
#[cfg(not(feature = "compile-with-external-structures"))]
type Ptr<T> = Box<T>;
use crate::containers::helpers::UnPtr;
use crate::{Bytes, BytesTrait};
use crate::{Token, TokenTrait};
#[derive(Debug, Clone, PartialEq)]
#[repr(C)]
pub struct StringValue {
pub bytes: Bytes,
}
impl StringValue {
pub(crate) fn new(token: Ptr<Token>) -> Self {
Self {
bytes: token.unptr().into_token_value(),
}
}
pub(crate) fn empty() -> Self {
Self {
bytes: Bytes::empty(),
}
}
}