pub struct StringValue<'src> {
pub is_block: bool,
pub span: ByteSpan,
pub syntax: Option<Box<StringValueSyntax<'src>>>,
pub value: Cow<'src, str>,
}Expand description
A GraphQL string value.
Per the String Value section of the spec, string values may be quoted strings or block strings. This struct contains the processed string after escape-sequence resolution and block-string indentation stripping. Borrows from source when no transformation was needed; owned when escapes were resolved or block-string stripping produced a non-contiguous result.
Fields§
§is_block: boolWhether this string was written as a block string
("""...""") rather than a quoted string ("...").
Both forms produce the same semantic value after
processing, but tools (formatters, schema differs)
may need to preserve or inspect the original form.
span: ByteSpan§syntax: Option<Box<StringValueSyntax<'src>>>§value: Cow<'src, str>The processed string value after escape-sequence resolution and block-string indentation stripping.
Implementations§
Source§impl StringValue<'_>
impl StringValue<'_>
Sourcepub fn append_source(&self, sink: &mut String, source: Option<&str>)
pub fn append_source(&self, sink: &mut String, source: Option<&str>)
Sourcepub fn byte_span(&self) -> ByteSpan
pub fn byte_span(&self) -> ByteSpan
Returns this string value’s byte-offset span within the source text.
The returned ByteSpan can be resolved to line/column
positions via source_span() or
ByteSpan::resolve().
Sourcepub fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
pub fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
Trait Implementations§
Source§impl AstNode for StringValue<'_>
impl AstNode for StringValue<'_>
Source§fn byte_span(&self) -> ByteSpan
fn byte_span(&self) -> ByteSpan
Returns this string value’s byte-offset span within the source text.
The returned ByteSpan can be resolved to line/column
positions via source_span() or
ByteSpan::resolve().
Source§fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
fn source_span(&self, source_map: &SourceMap<'_>) -> Option<SourceSpan>
Source§impl<'src> Clone for StringValue<'src>
impl<'src> Clone for StringValue<'src>
Source§fn clone(&self) -> StringValue<'src>
fn clone(&self) -> StringValue<'src>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more