Struct erg_compiler::ty::free::Free

source ·
pub struct Free<T>(_);

Implementations§

source§

impl<T: CanbeFree> Free<T>

source

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

source

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

source§

impl<T> 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

pub fn force_replace(&self, new: FreeKind<T>)

source

pub fn can_borrow(&self) -> bool

source

pub fn can_borrow_mut(&self) -> bool

source§

impl<T: Clone> Free<T>

source

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

source§

impl<T: Clone + HasLevel + LimitedDisplay> 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 replace(&self, to: FreeKind<T>)

NOTE: Do not use this except to rewrite circular references. No reference to any type variable may be left behind when rewriting. However, get_bound_types is safe because it does not return references.

NOTE: Do not use this except to rewrite circular references. No reference to any type variable may be left behind when rewriting. However, get_bound_types is safe because it does not return references.

source

pub fn undo(&self)

source

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

source

pub fn unwrap_linked(self) -> T

source

pub fn detach(&self) -> Self

source

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

returns linked type (panic if self is unbounded) NOTE: check by .is_linked before call

source

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

source

pub fn is_linked(&self) -> bool

source

pub fn is_undoable_linked(&self) -> bool

source§

impl<T: CanbeFree> 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)>

source

pub fn is_unbound(&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)

source§

impl Free<TyParam>

source

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

Trait Implementations§

source§

impl<T: 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> 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> Display for Free<T>

source§

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

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

impl<T: HasLevel> HasLevel for Free<T>

source§

fn set_level(&self, level: Level)

source§

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

source§

fn lower(&self, level: Level)

source§

fn lift(&self)

source§

fn generalize(&self)

source§

fn is_generalized(&self) -> bool

source§

impl<T: Hash> Hash for Free<T>

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> LimitedDisplay for Free<T>

source§

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

source§

impl<T: PartialEq> PartialEq<Free<T>> for Free<T>

source§

fn eq(&self, other: &Free<T>) -> 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: Eq> Eq for Free<T>

source§

impl<T> StructuralEq for Free<T>

source§

impl<T> StructuralPartialEq for Free<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Free<T>

§

impl<T> !Send for Free<T>

§

impl<T> !Sync for Free<T>

§

impl<T> Unpin for Free<T>

§

impl<T> !UnwindSafe for Free<T>

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
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 Twhere
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 Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.