Enum rustc::mir::repr::ProjectionElem [] [src]

pub enum ProjectionElem<'tcx, V> {
    Deref,
    Field(FieldTy<'tcx>),
    Index(V),
    ConstantIndex {
        offset: u32,
        min_length: u32,
        from_end: bool,
    },
    Downcast(AdtDef<'tcx>, usize),
}
Unstable (rustc_private)

Variants

Deref
Unstable (rustc_private)
Field(FieldTy<'tcx>)
Unstable (rustc_private)
Index(V)
Unstable (rustc_private)
ConstantIndex
Unstable (rustc_private)

These indices are generated by slice patterns. Easiest to explain by example:

[X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
[_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
[_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
[_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },

Fields

offset: u32
Unstable (rustc_private)

index or -index (in Python terms), depending on from_end

min_length: u32
Unstable (rustc_private)

thing being indexed must be at least this long

from_end: bool
Unstable (rustc_private)

counting backwards from end?

Downcast(AdtDef<'tcx>, usize)
Unstable (rustc_private)

"Downcast" to a variant of an ADT. Currently, we only introduce this for ADTs with more than one variant. It may be better to just introduce it always, or always for enums.

Trait Implementations

Derived Implementations

impl<'tcx, V: Decodable> Decodable for ProjectionElem<'tcx, V>
[src]

fn decode<__DV: Decoder>(__arg_0: &mut __DV) -> Result<ProjectionElem<'tcx, V>, __DV::Error>

impl<'tcx, V: Encodable> Encodable for ProjectionElem<'tcx, V>
[src]

fn encode<__SV: Encoder>(&self, __arg_0: &mut __SV) -> Result<(), __SV::Error>

impl<'tcx, V: Hash> Hash for ProjectionElem<'tcx, V>
[src]

fn hash<__HV: Hasher>(&self, __arg_0: &mut __HV)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl<'tcx, V: Eq> Eq for ProjectionElem<'tcx, V>
[src]

impl<'tcx, V: PartialEq> PartialEq for ProjectionElem<'tcx, V>
[src]

fn eq(&self, __arg_0: &ProjectionElem<'tcx, V>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &ProjectionElem<'tcx, V>) -> bool

This method tests for !=.

impl<'tcx, V: Debug> Debug for ProjectionElem<'tcx, V>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'tcx, V: Clone> Clone for ProjectionElem<'tcx, V>
[src]

fn clone(&self) -> ProjectionElem<'tcx, V>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more