# Trait rustc_const_eval::interpret::Projectable

source ·

    pub trait Projectable<'tcx, Prov: Provenance>: Sized + Debug {
        // Required methods
        fn layout(&self) -> TyAndLayout<'tcx>;
        fn meta(&self) -> MemPlaceMeta<Prov>;
        fn offset_with_meta<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
            &self,
            offset: Size,
            mode: OffsetMode,
            meta: MemPlaceMeta<Prov>,
            layout: TyAndLayout<'tcx>,
            ecx: &InterpCx<'mir, 'tcx, M>
        ) -> 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<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
            &self,
            offset: Size,
            layout: TyAndLayout<'tcx>,
            ecx: &InterpCx<'mir, 'tcx, M>
        ) -> InterpResult<'tcx, Self> { ... }
        fn transmute<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>(
            &self,
            layout: TyAndLayout<'tcx>,
            ecx: &InterpCx<'mir, 'tcx, M>
        ) -> InterpResult<'tcx, Self> { ... }
    }

Expand description

A thing that we can project into, and that has a layout.

## Required Methods§

source

#### fn layout(&self) -> TyAndLayout<'tcx>

Get the layout.

source

#### fn meta(&self) -> MemPlaceMeta<Prov>

Get the metadata of a wide value.

source

#### fn offset_with_meta<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>( &self, offset: Size, mode: OffsetMode, meta: MemPlaceMeta<Prov>, layout: TyAndLayout<'tcx>, ecx: &InterpCx<'mir, 'tcx, M> ) -> InterpResult<'tcx, Self>

Offset the value by the given amount, replacing the layout and metadata.

source

#### 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.

## Provided Methods§

source

#### fn len<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>( &self, ecx: &InterpCx<'mir, 'tcx, M> ) -> InterpResult<'tcx, u64>

Get the length of a slice/string/array stored here.

source

#### fn offset<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>( &self, offset: Size, layout: TyAndLayout<'tcx>, ecx: &InterpCx<'mir, 'tcx, M> ) -> InterpResult<'tcx, Self>

source

#### fn transmute<'mir, M: Machine<'mir, 'tcx, Provenance = Prov>>( &self, layout: TyAndLayout<'tcx>, ecx: &InterpCx<'mir, 'tcx, M> ) -> InterpResult<'tcx, Self>

## Object Safety§

This trait is not object safe.

## Implementors§

source§

### impl<'tcx, Prov: Provenance> Projectable<'tcx, Prov> for ImmTy<'tcx, Prov>

source§

### impl<'tcx, Prov: Provenance> Projectable<'tcx, Prov> for OpTy<'tcx, Prov>

source§

### impl<'tcx, Prov: Provenance> Projectable<'tcx, Prov> for MPlaceTy<'tcx, Prov>

source§

### impl<'tcx, Prov: Provenance> Projectable<'tcx, Prov> for PlaceTy<'tcx, Prov>