pub struct StringLiteral {
pub elements: Vec<u32>,
pub encoding: Encoding,
pub remarks: Remarks,
}Expand description
A converted string literal.
Fields§
§elements: Vec<u32>One value per element of the array, without the terminating zero, since the zero belongs
to the type and not to the spelling. An element is a byte in a plain or u8 literal, a
UTF-16 code unit in a u one, and a code point in a U one.
encoding: EncodingThe prefix it was written with.
remarks: RemarksWhat is worth saying about it, for the caller that holds the span.
Implementations§
Source§impl StringLiteral
impl StringLiteral
Sourcepub fn bytes(&self, target: &TargetInfo) -> Vec<u8> ⓘ
pub fn bytes(&self, target: &TargetInfo) -> Vec<u8> ⓘ
The bytes this literal becomes in the object, terminator included, in the target’s byte order.
Sourcepub fn spell(&self) -> String
pub fn spell(&self) -> String
The spelling this literal would be written with, quotes and prefix included.
A byte escape takes three octal digits rather than two hexadecimal ones, because an octal escape stops after three digits and a hexadecimal one runs on until the digits do. Where the elements are too wide for octal there is no such spelling, so the literal is closed and reopened instead, which phase 7 joins back into the one literal it came from.
Trait Implementations§
Source§impl Clone for StringLiteral
impl Clone for StringLiteral
Source§fn clone(&self) -> StringLiteral
fn clone(&self) -> StringLiteral
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more