pub trait RefDecodable<'tcx>: PointeeSized {
// Required method
fn decode(d: &mut impl TyDecoder<'tcx>) -> &'tcx Self;
}Expand description
Trait for decoding to a reference.
This is a separate trait from Decodable so that we can easily implement it for
upstream types, such as FxHashSet.
The TyDecodable derive macro will use this
trait for fields that are references (and don’t use a type alias to hide that).
Decodable can still be implemented in cases where Decodable is required
by a trait bound; see impl_decodable_via_ref_decodable_for_local_types! for examples.
Implementations of this trait will typically allocate into an arena or interner,
e.g. see impl_ref_decodable_into_arena! in rustc_middle::arena.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".