pub struct TypeUnion { /* private fields */ }Expand description
A set of types representing the possible result types of a match expression.
TypeUnion enforces the set invariant: inserting a type that is already
present is a no-op. Order is not significant; two TypeUnion values are
equal if they contain the same types regardless of insertion order.
Implementations§
Source§impl TypeUnion
impl TypeUnion
Sourcepub fn insert(&mut self, ty: Type) -> bool
pub fn insert(&mut self, ty: Type) -> bool
Insert ty if it is not already present. Returns whether it was inserted.
Type::Unknown is skipped — it carries no type information and should
not widen the union (e.g. an Expr::Error branch in a Match).
Trait Implementations§
Source§impl<'a> IntoIterator for &'a TypeUnion
impl<'a> IntoIterator for &'a TypeUnion
Source§impl IntoIterator for TypeUnion
impl IntoIterator for TypeUnion
Source§impl PartialEq for TypeUnion
Set equality: two unions are equal iff they contain the same types,
regardless of insertion order.
impl PartialEq for TypeUnion
Set equality: two unions are equal iff they contain the same types, regardless of insertion order.
impl Eq for TypeUnion
Auto Trait Implementations§
impl Freeze for TypeUnion
impl RefUnwindSafe for TypeUnion
impl Send for TypeUnion
impl Sync for TypeUnion
impl Unpin for TypeUnion
impl UnsafeUnpin for TypeUnion
impl UnwindSafe for TypeUnion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.