pub struct Name<'src> {
pub span: ByteSpan,
pub syntax: Option<Box<NameSyntax<'src>>>,
pub value: Cow<'src, str>,
}Expand description
A GraphQL name (identifier).
Names are used for type names, field names, argument names,
directive names, enum values, and more. The value field
borrows from the source text when possible
(Cow::Borrowed) or owns the string when the source is not
available (Cow::Owned).
§Syntax Layer
When the parser retains syntax detail, syntax contains the
underlying GraphQLToken with any leading trivia
(whitespace, comments, commas).
Fields§
§span: ByteSpan§syntax: Option<Box<NameSyntax<'src>>>§value: Cow<'src, str>Implementations§
Source§impl Name<'_>
impl Name<'_>
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 name’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 Name<'_>
impl AstNode for Name<'_>
Source§fn byte_span(&self) -> ByteSpan
fn byte_span(&self) -> ByteSpan
Returns this name’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>
impl<'src> StructuralPartialEq for Name<'src>
Auto Trait Implementations§
impl<'src> Freeze for Name<'src>
impl<'src> RefUnwindSafe for Name<'src>
impl<'src> Send for Name<'src>
impl<'src> Sync for Name<'src>
impl<'src> Unpin for Name<'src>
impl<'src> UnsafeUnpin for Name<'src>
impl<'src> UnwindSafe for Name<'src>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more