pub struct NamedTypeAnnotation<'src> {
pub name: Name<'src>,
pub nullability: Nullability<'src>,
pub span: ByteSpan,
}Expand description
A named type reference (e.g. String, String!).
See
Type References
in the spec. The span covers the full annotation
including ! when present. The underlying name span is
available via name.span.
Unlike most other AST node types, this struct has no
syntax field. The grammar contains no tokens beyond
what the child nodes already capture: the name token
is in Name’s syntax and the ! token (if present)
is in Nullability::NonNull’s syntax.
Fields§
§name: Name<'src>§nullability: Nullability<'src>§span: ByteSpanImplementations§
Source§impl<'src> NamedTypeAnnotation<'src>
impl<'src> NamedTypeAnnotation<'src>
Source§impl NamedTypeAnnotation<'_>
impl NamedTypeAnnotation<'_>
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 type annotation’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 NamedTypeAnnotation<'_>
impl AstNode for NamedTypeAnnotation<'_>
Source§fn byte_span(&self) -> ByteSpan
fn byte_span(&self) -> ByteSpan
Returns this type annotation’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 NamedTypeAnnotation<'src>
impl<'src> Clone for NamedTypeAnnotation<'src>
Source§fn clone(&self) -> NamedTypeAnnotation<'src>
fn clone(&self) -> NamedTypeAnnotation<'src>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more