pub trait CompileVisitor {
// Provided methods
fn register_meta(&mut self, _meta: MetaRef<'_>) -> Result<(), MetaError> { ... }
fn visit_meta(
&mut self,
_location: &dyn Located,
_meta: MetaRef<'_>,
) -> Result<(), MetaError> { ... }
fn visit_variable_use(
&mut self,
_source_id: SourceId,
_var_span: &dyn Spanned,
_span: &dyn Spanned,
) -> Result<(), MetaError> { ... }
fn visit_mod(&mut self, _location: &dyn Located) -> Result<(), MetaError> { ... }
fn visit_doc_comment(
&mut self,
_location: &dyn Located,
_item: &Item,
_hash: Hash,
_docstr: &str,
) -> Result<(), MetaError> { ... }
fn visit_field_doc_comment(
&mut self,
_location: &dyn Located,
_item: &Item,
_hash: Hash,
_field: &str,
_docstr: &str,
) -> Result<(), MetaError> { ... }
}
Expand description
A visitor that will be called for every language item compiled.
Provided Methods§
Sourcefn register_meta(&mut self, _meta: MetaRef<'_>) -> Result<(), MetaError>
fn register_meta(&mut self, _meta: MetaRef<'_>) -> Result<(), MetaError>
Called when a meta item is registered.
Sourcefn visit_meta(
&mut self,
_location: &dyn Located,
_meta: MetaRef<'_>,
) -> Result<(), MetaError>
fn visit_meta( &mut self, _location: &dyn Located, _meta: MetaRef<'_>, ) -> Result<(), MetaError>
Mark that we’ve resolved a specific compile meta at the given location.
Sourcefn visit_variable_use(
&mut self,
_source_id: SourceId,
_var_span: &dyn Spanned,
_span: &dyn Spanned,
) -> Result<(), MetaError>
fn visit_variable_use( &mut self, _source_id: SourceId, _var_span: &dyn Spanned, _span: &dyn Spanned, ) -> Result<(), MetaError>
Visit a variable use.
Sourcefn visit_mod(&mut self, _location: &dyn Located) -> Result<(), MetaError>
fn visit_mod(&mut self, _location: &dyn Located) -> Result<(), MetaError>
Visit something that is a module.
Sourcefn visit_doc_comment(
&mut self,
_location: &dyn Located,
_item: &Item,
_hash: Hash,
_docstr: &str,
) -> Result<(), MetaError>
fn visit_doc_comment( &mut self, _location: &dyn Located, _item: &Item, _hash: Hash, _docstr: &str, ) -> Result<(), MetaError>
Visit anterior ///
-style comments, and interior //!
-style doc
comments for an item.
This may be called several times for a single item. Each attribute should eventually be combined for the full doc string.
This can be called in any order, before or after CompileVisitor::visit_meta for any given item.
Sourcefn visit_field_doc_comment(
&mut self,
_location: &dyn Located,
_item: &Item,
_hash: Hash,
_field: &str,
_docstr: &str,
) -> Result<(), MetaError>
fn visit_field_doc_comment( &mut self, _location: &dyn Located, _item: &Item, _hash: Hash, _field: &str, _docstr: &str, ) -> Result<(), MetaError>
Visit anterior ///
-style comments, and interior //!
-style doc
comments for a field contained in a struct / enum variant struct.
This may be called several times for a single field. Each attribute should eventually be combined for the full doc string.