Struct rupta::util::type_util::FieldByteOffsetCache
source · pub struct FieldByteOffsetCache<'tcx> { /* private fields */ }Expand description
Provides a way to effectively get the byte offsets of an ADT type’s fields
Implementations§
source§impl<'tcx> FieldByteOffsetCache<'tcx>
impl<'tcx> FieldByteOffsetCache<'tcx>
pub fn new() -> FieldByteOffsetCache<'tcx>
sourcepub fn get_field_byte_offset(
&mut self,
tcx: TyCtxt<'tcx>,
base_ty: Ty<'tcx>,
proj: &ProjectionElems
) -> usize
pub fn get_field_byte_offset( &mut self, tcx: TyCtxt<'tcx>, base_ty: Ty<'tcx>, proj: &ProjectionElems ) -> usize
Get or compute the offset of the given proj of base_ty. If we cannot obtain the layout of base_ty, the offset would be 0
sourcepub fn compute_fields_byte_offsets(&mut self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>)
pub fn compute_fields_byte_offsets(&mut self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>)
Compute the byte offset for each field a struct type
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for FieldByteOffsetCache<'tcx>
impl<'tcx> Send for FieldByteOffsetCache<'tcx>
impl<'tcx> Sync for FieldByteOffsetCache<'tcx>
impl<'tcx> Unpin for FieldByteOffsetCache<'tcx>
impl<'tcx> !UnwindSafe for FieldByteOffsetCache<'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