# Struct rustc_mir_build::build::matches::Candidate

source ·

    struct Candidate<'pat, 'tcx> {
        span: Span,
        has_guard: bool,
        match_pairs: SmallVec<[MatchPair<'pat, 'tcx>; 1]>,
        bindings: Vec<Binding<'tcx>>,
        ascriptions: Vec<Ascription<'tcx>>,
        subcandidates: Vec<Candidate<'pat, 'tcx>>,
        otherwise_block: Option<BasicBlock>,
        pre_binding_block: Option<BasicBlock>,
        next_candidate_pre_binding_block: Option<BasicBlock>,
    }

## Fields§

§`span: Span`

`Span` of the original pattern that gave rise to this candidate.

§`has_guard: bool`

Whether this `Candidate` has a guard.

§`match_pairs: SmallVec<[MatchPair<'pat, 'tcx>; 1]>`

All of these must be satisfied…

§`bindings: Vec<Binding<'tcx>>`

…these bindings established…

§`ascriptions: Vec<Ascription<'tcx>>`

…and these types asserted…

§`subcandidates: Vec<Candidate<'pat, 'tcx>>`

…and if this is non-empty, one of these subcandidates also has to match…

§`otherwise_block: Option<BasicBlock>`

…and the guard must be evaluated; if it’s `false` then branch to `otherwise_block`.

§`pre_binding_block: Option<BasicBlock>`

The block before the `bindings` have been established.

§`next_candidate_pre_binding_block: Option<BasicBlock>`

The pre-binding block of the next candidate.

## Implementations§

source§

### impl<'tcx, 'pat> Candidate<'pat, 'tcx>

source

#### fn new( place: PlaceBuilder<'tcx>, pattern: &'pat Pat<'tcx>, has_guard: bool, cx: &Builder<'_, 'tcx> ) -> Self

source

#### fn visit_leaves<'a>(&'a mut self, visit_leaf: impl FnMut(&'a mut Self))

Visit the leaf candidates (those with no subcandidates) contained in this candidate.

## Trait Implementations§

source§

### impl<'pat, 'tcx> Debug for Candidate<'pat, 'tcx>

source§

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

## Auto Trait Implementations§

§

### impl<'pat, 'tcx> !RefUnwindSafe for Candidate<'pat, 'tcx>

§

### impl<'pat, 'tcx> Send for Candidate<'pat, 'tcx>

§

### impl<'pat, 'tcx> Sync for Candidate<'pat, 'tcx>

§

### impl<'pat, 'tcx> Unpin for Candidate<'pat, 'tcx>

§

### impl<'pat, 'tcx> !UnwindSafe for Candidate<'pat, 'tcx>

## Blanket Implementations§

source§

### impl<T> Any for T
where T: 'static + ?Sized,

source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
source§

### impl<T> Borrow<T> for T
where T: ?Sized,

source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

### impl<T> From<T> for T

source§

#### fn from(t: T) -> T

Returns the argument unchanged.

source§

### impl<T, U> Into<U> for T
where U: From<T>,

source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

source§

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

#### type Error = Infallible

The type returned in the event of a conversion error.
source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

## Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain `repr(...)` attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 152 bytes