Skip to main content

Module pat

Module pat 

Source
Expand description

As explained in crate::usefulness, values and patterns are made from constructors applied to fields. This file defines types that represent patterns in this way.

Re-exportsΒ§

use std::fmt; πŸ”’
use smallvec::SmallVec; πŸ”’
use smallvec::smallvec; πŸ”’
use crate::constructor::Constructor; πŸ”’
use crate::constructor::Slice; πŸ”’
use crate::constructor::SliceKind; πŸ”’
use crate::PatCx; πŸ”’
use crate::PrivateUninhabitedField; πŸ”’
use self::Constructor::*; πŸ”’

StructsΒ§

DeconstructedPat
Values and patterns can be represented as a constructor applied to some fields. This represents a pattern in this form. A DeconstructedPat will almost always come from user input; the only exception are some Wildcards introduced during pattern lowering.
IndexedPat
A pattern with an index denoting which field it corresponds to.
PatId πŸ”’
A globally unique id to distinguish patterns.
WitnessPat
Same idea as DeconstructedPat, except this is a fictitious pattern built up for diagnostics purposes. As such they don’t use interning and can be cloned.

EnumsΒ§

PatOrWild πŸ”’
Represents either a pattern obtained from user input or a wildcard constructed during the algorithm. Do not use Wild to represent a wildcard pattern comping from user input.