Enum nessa::types::Type

source ·
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

source

pub fn is_ref(&self) -> bool

source

pub fn to_ref(self) -> Type

source

pub fn to_mut(self) -> Type

source

pub fn or(self, other: Type) -> Type

source

pub fn deref_type(&self) -> &Type

source

pub fn get_name(&self, ctx: &NessaContext) -> String

source

pub fn get_name_plain(&self, ctx: &NessaContext) -> String

source

pub fn has_templates(&self) -> bool

source

pub fn has_self(&self) -> bool

source

pub fn template_dependencies(&self, templates: &mut HashSet<usize>)

source

pub fn type_dependencies(&self) -> Vec<usize>

source

pub fn interface_dependencies(&self) -> Vec<usize>

source

pub fn bindable_to(&self, other: &Type, ctx: &NessaContext) -> bool

source

pub fn bindable_to_subtitutions( &self, other: &Type, ctx: &NessaContext ) -> (bool, HashMap<usize, Type>)

source

pub fn bindable_to_template( &self, other: &Type, templates: &[Type], ctx: &NessaContext ) -> bool

source

pub fn template_bindable_to( &self, other: &Type, t_assignments: &mut HashMap<usize, Type>, t_deps: &mut HashMap<usize, HashSet<usize>>, ctx: &NessaContext ) -> bool

source

pub fn compile_templates(&mut self, templates: &Vec<String>)

source

pub fn offset_templates(&mut self, offset: usize)

source

pub fn max_template(&self) -> i32

source

pub fn sub_templates(&self, args: &HashMap<usize, Type>) -> Type

source

pub fn sub_templates_rec(&self, args: &HashMap<usize, Type>, rec: i32) -> Type

source

pub fn sub_self(&self, sub: &Type) -> Type

source

pub fn map_type( &self, ctx: &mut NessaContext, other_ctx: &NessaContext, id_mapper: &mut IdMapper, l: &Location ) -> Type

source

pub fn map_basic_types( &self, mapping: &mut impl FnMut(usize) -> Result<usize, String> ) -> Type

source

pub fn map_interfaces( &self, mapping: &mut impl FnMut(usize) -> Result<usize, String> ) -> Type

Trait Implementations§

source§

impl Clone for Type

source§

fn clone(&self) -> Type

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Type

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Hash for Type

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Type

source§

fn eq(&self, b: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Type

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Type

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,