Struct rustc_mir_build::thir::pattern::usefulness::Matrix[−][src]

pub(super) struct Matrix<'p, 'tcx> {
    patterns: Vec<PatStack<'p, 'tcx>>,
}
Expand description

A 2D matrix.

Fields

patterns: Vec<PatStack<'p, 'tcx>>

Implementations

impl<'p, 'tcx> Matrix<'p, 'tcx>[src]

fn empty() -> Self[src]

pub(super) fn column_count(&self) -> Option<usize>[src]

Number of columns of this matrix. None is the matrix is empty.

fn push(&mut self, row: PatStack<'p, 'tcx>)[src]

Pushes a new row to the matrix. If the row starts with an or-pattern, this recursively expands it.

fn heads<'a>(&'a self) -> impl Iterator<Item = &'a Pat<'tcx>> + Captures<'p>[src]

Iterate over the first component of each row

pub(super) fn head_ctors<'a>(
    &'a self,
    cx: &'a MatchCheckCtxt<'p, 'tcx>
) -> impl Iterator<Item = &'a Constructor<'tcx>> + Captures<'p> + Clone
[src]

Iterate over the first constructor of each row.

pub(super) fn head_ctors_and_spans<'a>(
    &'a self,
    cx: &'a MatchCheckCtxt<'p, 'tcx>
) -> impl Iterator<Item = (&'a Constructor<'tcx>, Span)> + Captures<'p>
[src]

Iterate over the first constructor and the corresponding span of each row.

fn specialize_constructor(
    &self,
    pcx: PatCtxt<'_, 'p, 'tcx>,
    ctor: &Constructor<'tcx>,
    ctor_wild_subpatterns: &Fields<'p, 'tcx>
) -> Matrix<'p, 'tcx>
[src]

This computes S(constructor, self). See top of the file for explanations.

Trait Implementations

impl<'p, 'tcx> Clone for Matrix<'p, 'tcx>[src]

fn clone(&self) -> Matrix<'p, 'tcx>[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<'p, 'tcx> Debug for Matrix<'p, 'tcx>[src]

Pretty-printer for matrices of patterns, example:

+ _     + []                +
+ true  + [First]           +
+ true  + [Second(true)]    +
+ false + [_]               +
+ _     + [_, _, tail @ ..] +

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

Formats the value using the given formatter. Read more

impl<'p, 'tcx> FromIterator<PatStack<'p, 'tcx>> for Matrix<'p, 'tcx>[src]

fn from_iter<T>(iter: T) -> Self where
    T: IntoIterator<Item = PatStack<'p, 'tcx>>, 
[src]

Creates a value from an iterator. Read more

impl<'p, 'tcx> PartialEq<Matrix<'p, 'tcx>> for Matrix<'p, 'tcx>[src]

fn eq(&self, other: &Matrix<'p, 'tcx>) -> bool[src]

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

fn ne(&self, other: &Matrix<'p, 'tcx>) -> bool[src]

This method tests for !=.

impl<'p, 'tcx> StructuralPartialEq for Matrix<'p, 'tcx>[src]

Auto Trait Implementations

impl<'p, 'tcx> !RefUnwindSafe for Matrix<'p, 'tcx>

impl<'p, 'tcx> !Send for Matrix<'p, 'tcx>

impl<'p, 'tcx> !Sync for Matrix<'p, 'tcx>

impl<'p, 'tcx> Unpin for Matrix<'p, 'tcx> where
    'tcx: 'p, 

impl<'p, 'tcx> !UnwindSafe for Matrix<'p, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]