Struct erg_compiler::ty::free::Free

source ·
pub struct Free<T: Send + Clone>(/* private fields */);

Implementations§

source§

impl<T: CanbeFree + Send + Clone> Free<T>

source

pub fn unbound_name(&self) -> Option<Str>

source

pub fn constraint(&self) -> Option<Constraint>

source§

impl<T: Send + Clone> Free<T>

source

pub fn borrow(&self) -> Ref<'_, FreeKind<T>>

source

pub fn borrow_mut(&self) -> RefMut<'_, FreeKind<T>>

source

pub fn as_ptr(&self) -> *mut FreeKind<T>

very unsafe, use force_replace instead whenever possible

source

pub fn forced_as_ref(&self) -> &FreeKind<T>

source§

impl Free<Type>

source

pub fn deep_clone(&self) -> Self

source

pub fn is_recursive(&self) -> bool

source

pub fn do_avoiding_recursion<O, F: FnOnce() -> O>(&self, f: F) -> O

source

pub fn do_avoiding_recursion_with<O, F: FnOnce() -> O>( &self, placeholder: &Type, f: F ) -> O

source§

impl Free<TyParam>

source

pub fn deep_clone(&self) -> Self

source

pub fn is_recursive(&self) -> bool

source

pub fn do_avoiding_recursion<O, F: FnOnce() -> O>(&self, f: F) -> O

source

pub fn do_avoiding_recursion_with<O, F: FnOnce() -> O>( &self, placeholder: &TyParam, f: F ) -> O

source§

impl<T: Send + Clone> Free<T>

source

pub fn clone_inner(&self) -> FreeKind<T>

source

pub fn update_init(&mut self)

source§

impl<T: Send + Clone> Free<T>

source

pub fn new(f: FreeKind<T>) -> Self

source

pub fn new_unbound(level: Level, constraint: Constraint) -> Self

source

pub fn new_named_unbound( name: Str, level: Level, constraint: Constraint ) -> Self

source

pub fn new_linked(t: T) -> Self

source

pub fn crack(&self) -> Ref<'_, T>

returns linked type (panic if self is unbounded) NOTE: check by .is_linked before call NOTE: Sometimes a BorrowMut error occurs when trying to pass the result of crack().clone() as an argument. Bind it to a variable beforehand.

source

pub fn crack_constraint(&self) -> Ref<'_, Constraint>

source

pub fn unsafe_crack(&self) -> &T

source

pub fn addr_eq(&self, other: &Self) -> bool

source§

impl<T: Send + Sync + 'static + Clone> Free<T>

source

pub fn is_linked(&self) -> bool

source

pub fn is_undoable_linked(&self) -> bool

source

pub fn is_named_unbound(&self) -> bool

source

pub fn is_unnamed_unbound(&self) -> bool

source

pub fn replace(&self, to: FreeKind<T>)

interior-mut

source§

impl<T: Clone + Send + Sync + 'static> Free<T>

source

pub fn undo(&self)

interior-mut

source

pub fn undo_stack_size(&self) -> usize

source

pub fn inc_undo_count(&self)

source

pub fn unwrap_unbound(self) -> (Option<Str>, usize, Constraint)

source

pub fn unwrap_linked(self) -> T

source

pub fn get_linked(&self) -> Option<T>

source

pub fn get_linked_ref(&self) -> Option<Ref<'_, T>>

source

pub fn get_linked_refmut(&self) -> Option<RefMut<'_, T>>

source

pub fn get_previous(&self) -> Option<Ref<'_, Box<FreeKind<T>>>>

source

pub fn detach(&self) -> Self

source§

impl<T: Default + Clone + Debug + Send + Sync + 'static> Free<T>

interior-mut

source§

impl<T: CanbeFree + Send + Clone> Free<T>

source

pub fn get_type(&self) -> Option<Type>

source

pub fn get_super(&self) -> Option<Type>

<: Super

source

pub fn get_sub(&self) -> Option<Type>

:> Sub

source

pub fn get_subsup(&self) -> Option<(Type, Type)>

:> Sub, <: Super

source

pub fn is_unbound(&self) -> bool

source

pub fn is_unbound_and_sandwiched(&self) -> bool

source

pub fn is_unbound_and_typed(&self) -> bool

source

pub fn constraint_is_typeof(&self) -> bool

source

pub fn constraint_is_sandwiched(&self) -> bool

source

pub fn constraint_is_uninited(&self) -> bool

source

pub fn update_constraint( &self, new_constraint: Constraint, in_inst_or_gen: bool )

interior-mut if in_inst_or_gen is true, constraint will be updated forcibly

source

pub fn update_sub<F>(&self, f: F)
where F: FnOnce(Type) -> Type,

interior-mut

source

pub fn update_super<F>(&self, f: F)
where F: FnOnce(Type) -> Type,

interior-mut

source

pub fn update_type(&self, new_type: Type)

interior-mut

source§

impl Free<TyParam>

source

pub fn map<F>(&self, f: F)
where F: Fn(TyParam) -> TyParam,

Trait Implementations§

source§

impl<T: Clone + Send + Clone> Clone for Free<T>

source§

fn clone(&self) -> Free<T>

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<T: Debug + Send + Clone> Debug for Free<T>

source§

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

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

impl<T: LimitedDisplay + Send + Clone> Display for Free<T>

source§

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

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

impl HasLevel for Free<TyParam>

source§

fn set_level(&self, level: Level)

source§

fn level(&self) -> Option<Level>

source§

fn set_lower(&self, level: Level)

source§

fn lift(&self)

source§

fn lower(&self)

source§

fn generalize(&self)

source§

fn is_generalized(&self) -> bool

source§

impl HasLevel for Free<Type>

source§

fn set_level(&self, level: Level)

source§

fn level(&self) -> Option<Level>

source§

fn set_lower(&self, level: Level)

source§

fn lift(&self)

source§

fn lower(&self)

source§

fn generalize(&self)

source§

fn is_generalized(&self) -> bool

source§

impl Hash for Free<TyParam>

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 Hash for Free<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<T: LimitedDisplay + Send + Clone> LimitedDisplay for Free<T>

source§

fn limited_fmt<W: Write>(&self, f: &mut W, limit: isize) -> Result

If limit was set to a negative value, it will be displayed without abbreviation. FIXME:
source§

fn to_string_unabbreviated(&self) -> String

source§

impl PartialEq for Free<TyParam>

source§

fn eq(&self, other: &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 PartialEq for Free<Type>

source§

fn eq(&self, other: &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<T: StructuralEq + CanbeFree + Clone + Default + Debug + Send + Sync + 'static> StructuralEq for Free<T>

source§

fn structural_eq(&self, other: &Self) -> bool

source§

impl Eq for Free<TyParam>

source§

impl Eq for Free<Type>

Auto Trait Implementations§

§

impl<T> Freeze for Free<T>

§

impl<T> RefUnwindSafe for Free<T>
where T: RefUnwindSafe,

§

impl<T> Send for Free<T>
where T: Sync,

§

impl<T> Sync for Free<T>
where T: Sync,

§

impl<T> Unpin for Free<T>

§

impl<T> UnwindSafe for Free<T>
where T: RefUnwindSafe,

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<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.

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.