pub(super) struct List {
members: u64,
rules: Rc<Vec<Rule>>,
}
Expand description
A simple list of overloads.
Note that this type is not quite as general as it looks, in that
the implementation of most_preferred
doesn’t work for arbitrary
lists of overloads. See the documentation for List::rules
for
details.
Fields§
§members: u64
A bitmask of which elements of rules
are included in the set.
rules: Rc<Vec<Rule>>
A list of type rules that are members of the set.
These must be listed in order such that every rule in the list
is always more preferred than all subsequent rules in the
list. If there is no such arrangement of rules, then you
cannot use List
to represent the overload set.
Implementations§
Trait Implementations§
Source§impl ForDebugWithTypes for &List
impl ForDebugWithTypes for &List
Source§fn for_debug(
self,
types: &UniqueArena<Type>,
) -> DiagnosticDebug<(Self, &UniqueArena<Type>)>
fn for_debug( self, types: &UniqueArena<Type>, ) -> DiagnosticDebug<(Self, &UniqueArena<Type>)>
Format this type using
core::fmt::Debug
. Read moreSource§impl From<List> for AnyOverloadSet
impl From<List> for AnyOverloadSet
Source§impl OverloadSet for List
impl OverloadSet for List
Source§fn min_arguments(&self) -> usize
fn min_arguments(&self) -> usize
Return the smallest number of arguments in any type rule in the set. Read more
Source§fn max_arguments(&self) -> usize
fn max_arguments(&self) -> usize
Return the largest number of arguments in any type rule in the set. Read more
Source§fn arg(&self, i: usize, arg_ty: &TypeInner, types: &UniqueArena<Type>) -> Self
fn arg(&self, i: usize, arg_ty: &TypeInner, types: &UniqueArena<Type>) -> Self
Find the overloads that could accept a given argument. Read more
Source§fn concrete_only(self, types: &UniqueArena<Type>) -> Self
fn concrete_only(self, types: &UniqueArena<Type>) -> Self
Limit
self
to overloads whose arguments are all concrete types. Read moreSource§fn most_preferred(&self) -> Rule
fn most_preferred(&self) -> Rule
Return the most preferred candidate. Read more
Source§fn overload_list(&self, _gctx: &GlobalCtx<'_>) -> Vec<Rule>
fn overload_list(&self, _gctx: &GlobalCtx<'_>) -> Vec<Rule>
Return a type rule for each of the overloads in
self
.Source§fn allowed_args(&self, i: usize, _gctx: &GlobalCtx<'_>) -> Vec<TypeResolution>
fn allowed_args(&self, i: usize, _gctx: &GlobalCtx<'_>) -> Vec<TypeResolution>
Return a list of the types allowed for argument
i
.Source§fn for_debug(&self, types: &UniqueArena<Type>) -> impl Debug
fn for_debug(&self, types: &UniqueArena<Type>) -> impl Debug
Return an object that can be formatted with
core::fmt::Debug
.Auto Trait Implementations§
impl Freeze for List
impl RefUnwindSafe for List
impl !Send for List
impl !Sync for List
impl Unpin for List
impl UnwindSafe for List
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