Trait rustc_const_eval::interpret::Projectable
source · pub trait Projectable<'tcx, Prov: Provenance>: Sized + Debug {
// Required methods
fn layout(&self) -> TyAndLayout<'tcx>;
fn meta<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
&self,
ecx: &InterpCx<'mir, 'tcx, M>
) -> InterpResult<'tcx, MemPlaceMeta<M::Provenance>>;
fn offset_with_meta(
&self,
offset: Size,
meta: MemPlaceMeta<Prov>,
layout: TyAndLayout<'tcx>,
cx: &impl HasDataLayout
) -> InterpResult<'tcx, Self>;
fn to_op<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
&self,
ecx: &InterpCx<'mir, 'tcx, M>
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>>;
// Provided methods
fn len<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
&self,
ecx: &InterpCx<'mir, 'tcx, M>
) -> InterpResult<'tcx, u64> { ... }
fn offset(
&self,
offset: Size,
layout: TyAndLayout<'tcx>,
cx: &impl HasDataLayout
) -> InterpResult<'tcx, Self> { ... }
fn transmute(
&self,
layout: TyAndLayout<'tcx>,
cx: &impl HasDataLayout
) -> InterpResult<'tcx, Self> { ... }
}Expand description
A thing that we can project into, and that has a layout.
Required Methods§
sourcefn layout(&self) -> TyAndLayout<'tcx>
fn layout(&self) -> TyAndLayout<'tcx>
Get the layout.
sourcefn meta<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
&self,
ecx: &InterpCx<'mir, 'tcx, M>
) -> InterpResult<'tcx, MemPlaceMeta<M::Provenance>>
fn meta<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>( &self, ecx: &InterpCx<'mir, 'tcx, M> ) -> InterpResult<'tcx, MemPlaceMeta<M::Provenance>>
Get the metadata of a wide value.
sourcefn offset_with_meta(
&self,
offset: Size,
meta: MemPlaceMeta<Prov>,
layout: TyAndLayout<'tcx>,
cx: &impl HasDataLayout
) -> InterpResult<'tcx, Self>
fn offset_with_meta( &self, offset: Size, meta: MemPlaceMeta<Prov>, layout: TyAndLayout<'tcx>, cx: &impl HasDataLayout ) -> InterpResult<'tcx, Self>
Offset the value by the given amount, replacing the layout and metadata.
sourcefn to_op<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
&self,
ecx: &InterpCx<'mir, 'tcx, M>
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>>
fn to_op<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>( &self, ecx: &InterpCx<'mir, 'tcx, M> ) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>>
Convert this to an OpTy. This might be an irreversible transformation, but is useful for
reading from this thing.