Struct dprint_swc_ecma_ast_view::Span [−][src]
pub struct Span { pub lo: BytePos, pub hi: BytePos, pub ctxt: SyntaxContext, }
Expand description
Spans represent a region of code, used for error reporting. Positions in
spans are absolute positions from the beginning of the source_map
, not
positions relative to SourceFile
s. Methods on the SourceMap
can be used
to relate spans back to the original source.
You must be careful if the span crosses more than one file - you will not be
able to use many of the functions on spans in source_map
and you cannot
assume that the length of the span = hi - lo
; there may be space in the
BytePos
range between files.
Fields
lo: BytePos
hi: BytePos
ctxt: SyntaxContext
Information about where the macro came from, if this piece of code was created by a macro expansion.
Implementations
Returns a new span representing an empty span at the beginning of this span
Returns a new span representing an empty span at the end of this span
Returns self
if self
is not the dummy span, and other
otherwise.
Return true if the spans are equal with regards to the source text.
Use this instead of ==
when either span could be generated code,
and you only care that they point to the same bytes of source text.
Returns Some(span)
, where the start is trimmed by the end of other
Return a Span
between the end of self
to the beginning of end
.
Return a Span
between the beginning of self
to the beginning of
end
.
pub fn glob_adjust(
&mut self,
expansion: Mark,
glob_ctxt: SyntaxContext
) -> Option<Option<Mark>>
pub fn reverse_glob_adjust(
&mut self,
expansion: Mark,
glob_ctxt: SyntaxContext
) -> Option<Option<Mark>>
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Span, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Span, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Always returns true
impl<V> FoldWith<V> for Span where
V: Fold,
impl<V> FoldWith<V> for Span where
V: Fold,
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<V> VisitAllWith<V> for Span where
V: VisitAll,
impl<V> VisitAllWith<V> for Span where
V: VisitAll,
pub fn visit_all_with(&self, _parent: &(dyn Node + 'static), v: &mut V)
pub fn visit_all_children_with(&self, _visitor: &mut V)
pub fn visit_all_children_with(&self, _visitor: &mut V)
Visit children nodes of self with v
impl<V> VisitMutWith<V> for Span where
V: VisitMut,
impl<V> VisitMutWith<V> for Span where
V: VisitMut,
pub fn visit_mut_with(&mut self, v: &mut V)
pub fn visit_mut_children_with(&mut self, _visitor: &mut V)
impl<V> VisitWith<V> for Span where
V: Visit,
impl<V> VisitWith<V> for Span where
V: Visit,
pub fn visit_with(&self, _parent: &(dyn Node + 'static), v: &mut V)
pub fn visit_children_with(&self, _visitor: &mut V)
pub fn visit_children_with(&self, _visitor: &mut V)
Visit children nodes of self with v
Auto Trait Implementations
impl RefUnwindSafe for Span
impl UnwindSafe for Span
Blanket Implementations
Mutably borrows from an owned value. Read more