pub struct ParalegalEncoder<'tcx> {
tcx: TyCtxt<'tcx>,
file_encoder: FileEncoder,
type_shorthands: FxHashMap<Ty<'tcx>, usize>,
predicate_shorthands: FxHashMap<PredicateKind<'tcx>, usize>,
filepath_shorthands: FxHashMap<FileName, usize>,
}
Expand description
A structure that implements TyEncoder
for us.
Fields§
§tcx: TyCtxt<'tcx>
§file_encoder: FileEncoder
§type_shorthands: FxHashMap<Ty<'tcx>, usize>
§predicate_shorthands: FxHashMap<PredicateKind<'tcx>, usize>
§filepath_shorthands: FxHashMap<FileName, usize>
Implementations§
Source§impl<'tcx> ParalegalEncoder<'tcx>
impl<'tcx> ParalegalEncoder<'tcx>
Source§impl ParalegalEncoder<'_>
impl ParalegalEncoder<'_>
fn encode_file_name(&mut self, n: &FileName)
Trait Implementations§
Source§impl<'tcx> Encodable<ParalegalEncoder<'tcx>> for SpanData
Some of this code is lifted from EncodeContext
.
impl<'tcx> Encodable<ParalegalEncoder<'tcx>> for SpanData
Some of this code is lifted from EncodeContext
.
However we directly encode file names because that’s easier.
fn encode(&self, s: &mut ParalegalEncoder<'tcx>)
Source§impl Encoder for ParalegalEncoder<'_>
impl Encoder for ParalegalEncoder<'_>
fn emit_usize(&mut self, value: usize)
fn emit_u128(&mut self, value: u128)
fn emit_u64(&mut self, value: u64)
fn emit_u32(&mut self, value: u32)
fn emit_u16(&mut self, value: u16)
fn emit_u8(&mut self, value: u8)
fn emit_isize(&mut self, value: isize)
fn emit_i128(&mut self, value: i128)
fn emit_i64(&mut self, value: i64)
fn emit_i32(&mut self, value: i32)
fn emit_i16(&mut self, value: i16)
fn emit_raw_bytes(&mut self, value: &[u8])
fn emit_i8(&mut self, v: i8)
fn emit_bool(&mut self, v: bool)
fn emit_char(&mut self, v: char)
fn emit_str(&mut self, v: &str)
Source§impl SpanEncoder for ParalegalEncoder<'_>
impl SpanEncoder for ParalegalEncoder<'_>
fn encode_def_index(&mut self, def_index: DefIndex)
fn encode_span(&mut self, span: Span)
fn encode_syntax_context(&mut self, _syntax_context: SyntaxContext)
Source§fn encode_crate_num(&mut self, crate_num: CrateNum)
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
.fn encode_def_id(&mut self, def_id: DefId)
fn encode_expn_id(&mut self, _expn_id: ExpnId)
fn encode_symbol(&mut self, symbol: Symbol)
Source§impl<'tcx> TyEncoder for ParalegalEncoder<'tcx>
impl<'tcx> TyEncoder for ParalegalEncoder<'tcx>
const CLEAR_CROSS_CRATE: bool = true
type I = TyCtxt<'tcx>
fn position(&self) -> usize
fn type_shorthands( &mut self, ) -> &mut FxHashMap<<Self::I as Interner>::Ty, usize>
fn predicate_shorthands( &mut self, ) -> &mut FxHashMap<PredicateKind<Self::I>, usize>
fn encode_alloc_id(&mut self, alloc_id: &<Self::I as Interner>::AllocId)
Auto Trait Implementations§
impl<'tcx> Freeze for ParalegalEncoder<'tcx>
impl<'tcx> !RefUnwindSafe for ParalegalEncoder<'tcx>
impl<'tcx> !Send for ParalegalEncoder<'tcx>
impl<'tcx> !Sync for ParalegalEncoder<'tcx>
impl<'tcx> Unpin for ParalegalEncoder<'tcx>
impl<'tcx> !UnwindSafe for ParalegalEncoder<'tcx>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more