pub struct FunctionT(pub Result<Arc<dyn Fn(&Type, &CheckInfo) -> Result<Type, CheckError> + Send + Sync>, Arc<Vec<(Type, Type)>>>, pub CheckInfo);
Tuple Fields§
§0: Result<Arc<dyn Fn(&Type, &CheckInfo) -> Result<Type, CheckError> + Send + Sync>, Arc<Vec<(Type, Type)>>>
§1: CheckInfo
Implementations§
Trait Implementations§
Source§impl MersType for FunctionT
impl MersType for FunctionT
fn display(&self, info: &DisplayInfo<'_>, f: &mut Formatter<'_>) -> Result
fn executable(&self) -> Option<FunctionT>
Source§fn iterable(&self) -> Option<Type>
fn iterable(&self) -> Option<Type>
If Some(T), calling
iterable
on the MersData this MersType belongs to
Should return Some(I), where I is an Iterator which only returns items of type T.Source§fn is_same_type_as(&self, other: &dyn MersType) -> bool
fn is_same_type_as(&self, other: &dyn MersType) -> bool
If self and other are different types (
other.as_any().downcast_ref::<Self>().is_none()
),
this must return false.Source§fn is_included_in(&self, target: &dyn MersType) -> bool
fn is_included_in(&self, target: &dyn MersType) -> bool
This doesn’t handle the case where target is Type (Type::is_included_in handles it)
Source§fn subtypes(&self, acc: &mut Type)
fn subtypes(&self, acc: &mut Type)
Returns all types that can result from the use of this type.
Usually, this is just
acc.add(Arc::new(self.clone()))
but if there exists one or more inner types, this becomes interesting:
Using (int/string)
will end up being either (int)
or (string)
,
so this function should add (int)
and (string)
.
Since (int/string)
can’t exist at runtime, we don’t need to list self
.
note also: subtypes
has to be called recursively, i.e. you would have to call .substring
on int
and string
.fn as_any(&self) -> &dyn Any
fn mut_any(&mut self) -> &mut dyn Any
fn to_any(self) -> Box<dyn Any>
Source§fn get(&self) -> Option<Type>
fn get(&self) -> Option<Type>
If Some(T), calling
get
on data of this type may return T, but it might also return None.
By default, this returns the same thing as iterable
, since this is also the default implementation for MersData::get
.Source§fn subtypes_type(&self) -> Type
fn subtypes_type(&self) -> Type
like
subtypes
, but returns the accumulatorfn is_reference_to(&self) -> Option<&Type>
Source§fn simplify_for_display(&self, info: &CheckInfo) -> Option<Type>
fn simplify_for_display(&self, info: &CheckInfo) -> Option<Type>
may mutate
self
to simplify itfn simplified_as_string(&self, info: &CheckInfo) -> String
Auto Trait Implementations§
impl Freeze for FunctionT
impl !RefUnwindSafe for FunctionT
impl Send for FunctionT
impl Sync for FunctionT
impl Unpin for FunctionT
impl !UnwindSafe for FunctionT
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