Skip to main content

SpanEncoder

Trait SpanEncoder 

Source
pub trait SpanEncoder: Encoder {
    // Required methods
    fn encode_span(&mut self, span: Span);
    fn encode_symbol(&mut self, sym: Symbol);
    fn encode_byte_symbol(&mut self, byte_sym: ByteSymbol);
    fn encode_expn_id(&mut self, expn_id: ExpnId);
    fn encode_syntax_context(&mut self, syntax_context: SyntaxContext);
    fn encode_crate_num(&mut self, crate_num: CrateNum);
    fn encode_def_index(&mut self, def_index: DefIndex);
    fn encode_def_id(&mut self, def_id: DefId);

    // Provided methods
    fn encode_local_def_id(&mut self, def_id: LocalDefId) { ... }
    fn encode_def_key(
        &mut self,
        parent: Option<DefIndex>,
        disambiguated_data: impl Encodable<Self>,
    )
       where Self: Sized { ... }
}
Expand description

This trait is used to allow encoder specific encodings of certain types. It is similar to rustc_type_ir’s TyEncoder.

Required Methods§

Source

fn encode_span(&mut self, span: Span)

Source

fn encode_symbol(&mut self, sym: Symbol)

Source

fn encode_byte_symbol(&mut self, byte_sym: ByteSymbol)

Source

fn encode_expn_id(&mut self, expn_id: ExpnId)

Source

fn encode_syntax_context(&mut self, syntax_context: SyntaxContext)

Source

fn encode_crate_num(&mut self, crate_num: CrateNum)

As a local identifier, a CrateNum is only meaningful within its context, e.g. within a tcx. Therefore, make sure to include the context when encode a CrateNum.

Source

fn encode_def_index(&mut self, def_index: DefIndex)

Source

fn encode_def_id(&mut self, def_id: DefId)

Provided Methods§

Source

fn encode_local_def_id(&mut self, def_id: LocalDefId)

Source

fn encode_def_key( &mut self, parent: Option<DefIndex>, disambiguated_data: impl Encodable<Self>, )
where Self: Sized,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SpanEncoder for FileEncoder<'_>

Source§

fn encode_span(&mut self, span: Span)

Source§

fn encode_symbol(&mut self, sym: Symbol)

Source§

fn encode_byte_symbol(&mut self, byte_sym: ByteSymbol)

Source§

fn encode_expn_id(&mut self, _expn_id: ExpnId)

Source§

fn encode_syntax_context(&mut self, _syntax_context: SyntaxContext)

Source§

fn encode_crate_num(&mut self, crate_num: CrateNum)

Source§

fn encode_def_index(&mut self, _def_index: DefIndex)

Source§

fn encode_def_id(&mut self, def_id: DefId)

Source§

impl SpanEncoder for MemEncoder

Source§

fn encode_span(&mut self, span: Span)

Source§

fn encode_symbol(&mut self, sym: Symbol)

Source§

fn encode_byte_symbol(&mut self, byte_sym: ByteSymbol)

Source§

fn encode_expn_id(&mut self, _expn_id: ExpnId)

Source§

fn encode_syntax_context(&mut self, _syntax_context: SyntaxContext)

Source§

fn encode_crate_num(&mut self, crate_num: CrateNum)

Source§

fn encode_def_index(&mut self, _def_index: DefIndex)

Source§

fn encode_def_id(&mut self, def_id: DefId)

Implementors§