pub enum Type {
Show 13 variants
Empty,
InferenceMarker,
SelfType,
Basic(usize),
Ref(Box<Type>),
MutRef(Box<Type>),
Or(Vec<Type>),
And(Vec<Type>),
Wildcard,
TemplateParam(usize, Vec<InterfaceConstraint>),
TemplateParamStr(String, Vec<InterfaceConstraint>),
Template(usize, Vec<Type>),
Function(Box<Type>, Box<Type>),
}
Variants§
Empty
InferenceMarker
SelfType
Basic(usize)
Ref(Box<Type>)
MutRef(Box<Type>)
Or(Vec<Type>)
And(Vec<Type>)
Wildcard
TemplateParam(usize, Vec<InterfaceConstraint>)
TemplateParamStr(String, Vec<InterfaceConstraint>)
Template(usize, Vec<Type>)
Function(Box<Type>, Box<Type>)
Implementations§
Source§impl Type
impl Type
pub fn is_ref(&self) -> bool
pub fn to_ref(self) -> Type
pub fn to_mut(self) -> Type
pub fn or(self, other: Type) -> Type
pub fn deref_type(&self) -> &Type
pub fn get_name(&self, ctx: &NessaContext) -> String
pub fn get_name_html(&self, ctx: &NessaContext) -> String
pub fn get_name_plain(&self, ctx: &NessaContext) -> String
pub fn has_templates(&self) -> bool
pub fn has_self(&self) -> bool
pub fn template_dependencies(&self, templates: &mut HashSet<usize>)
pub fn type_dependencies(&self) -> Vec<usize>
pub fn interface_dependencies(&self) -> Vec<usize>
pub fn bindable_to(&self, other: &Type, ctx: &NessaContext) -> bool
pub fn bindable_to_subtitutions( &self, other: &Type, ctx: &NessaContext, ) -> (bool, HashMap<usize, Type>)
pub fn bindable_to_template( &self, other: &Type, templates: &[Type], ctx: &NessaContext, ) -> bool
pub fn template_bindable_to( &self, other: &Type, t_assignments: &mut HashMap<usize, Type>, t_deps: &mut HashMap<usize, HashSet<usize>>, ctx: &NessaContext, ) -> bool
pub fn compile_templates(&mut self, templates: &Vec<String>)
pub fn offset_templates(&mut self, offset: usize)
pub fn max_template(&self) -> i32
pub fn sub_templates(&self, args: &HashMap<usize, Type>) -> Type
pub fn sub_templates_rec(&self, args: &HashMap<usize, Type>, rec: i32) -> Type
pub fn sub_self(&self, sub: &Type) -> Type
pub fn map_type( &self, ctx: &mut NessaContext, other_ctx: &NessaContext, id_mapper: &mut IdMapper, l: &Location, ) -> Type
pub fn map_basic_types( &self, mapping: &mut impl FnMut(usize) -> Result<usize, String>, ) -> Type
pub fn map_interfaces( &self, mapping: &mut impl FnMut(usize) -> Result<usize, String>, ) -> Type
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more