Struct erg_compiler::ty::free::Free
source · pub struct Free<T: Send + Clone>(/* private fields */);
Implementations§
source§impl<T: CanbeFree + Send + Clone> Free<T>
impl<T: CanbeFree + Send + Clone> Free<T>
pub fn unbound_name(&self) -> Option<Str>
pub fn constraint(&self) -> Option<Constraint>
source§impl<T: Send + Clone> Free<T>
impl<T: Send + Clone> Free<T>
pub fn borrow(&self) -> Ref<'_, FreeKind<T>>
pub fn borrow_mut(&self) -> RefMut<'_, FreeKind<T>>
pub fn try_borrow(&self) -> Result<Ref<'_, FreeKind<T>>, BorrowError>
pub fn try_borrow_mut(&self) -> Result<RefMut<'_, FreeKind<T>>, BorrowMutError>
sourcepub fn as_ptr(&self) -> *mut FreeKind<T>
pub fn as_ptr(&self) -> *mut FreeKind<T>
very unsafe, use force_replace
instead whenever possible
pub fn forced_as_ref(&self) -> &FreeKind<T>
pub fn forced_as_mut(&mut self) -> &mut FreeKind<T>
source§impl Free<Type>
impl Free<Type>
pub fn deep_clone(&self) -> Self
sourcepub fn linked_free(&self) -> Option<Free<Type>>
pub fn linked_free(&self) -> Option<Free<Type>>
(T) => T ((T)) => T
pub fn is_recursive(&self) -> bool
sourcepub fn do_avoiding_recursion<O>(&self, f: impl FnOnce() -> O) -> O
pub fn do_avoiding_recursion<O>(&self, f: impl FnOnce() -> O) -> O
interior-mut
sourcepub fn do_avoiding_recursion_with<O>(
&self,
placeholder: &Type,
f: impl FnOnce() -> O,
) -> O
pub fn do_avoiding_recursion_with<O>( &self, placeholder: &Type, f: impl FnOnce() -> O, ) -> O
interior-mut
pub fn has_unbound_var(&self) -> bool
sourcepub fn update_constraint(
&self,
new_constraint: Constraint,
in_inst_or_gen: bool,
)
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
sourcepub fn update_sub(&self, f: impl FnOnce(Type) -> Type)
pub fn update_sub(&self, f: impl FnOnce(Type) -> Type)
interior-mut
sourcepub fn update_super(&self, f: impl FnOnce(Type) -> Type)
pub fn update_super(&self, f: impl FnOnce(Type) -> Type)
interior-mut
source§impl Free<TyParam>
impl Free<TyParam>
pub fn deep_clone(&self) -> Self
sourcepub fn linked_free(&self) -> Option<Free<TyParam>>
pub fn linked_free(&self) -> Option<Free<TyParam>>
(T) => T ((T)) => T
pub fn is_recursive(&self) -> bool
pub fn do_avoiding_recursion<O, F: FnOnce() -> O>(&self, f: F) -> O
pub fn do_avoiding_recursion_with<O, F: FnOnce() -> O>( &self, placeholder: &TyParam, f: F, ) -> O
pub fn has_unbound_var(&self) -> bool
source§impl<T: Send + Clone> Free<T>
impl<T: Send + Clone> Free<T>
pub fn clone_inner(&self) -> FreeKind<T>
pub fn update_init(&mut self)
source§impl<T: Send + Clone> Free<T>
impl<T: Send + Clone> Free<T>
pub fn new(f: FreeKind<T>) -> Self
pub fn new_unbound(level: Level, constraint: Constraint) -> Self
pub fn new_named_unbound( name: Str, level: Level, constraint: Constraint, ) -> Self
pub fn new_linked(t: T) -> Self
sourcepub fn crack(&self) -> Ref<'_, T>
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.
pub fn crack_constraint(&self) -> Ref<'_, Constraint>
pub fn unsafe_crack(&self) -> &T
pub fn addr_eq(&self, other: &Self) -> bool
source§impl<T: Send + Sync + 'static + Clone> Free<T>
impl<T: Send + Sync + 'static + Clone> Free<T>
pub fn is_linked(&self) -> bool
pub fn is_undoable_linked(&self) -> bool
pub fn is_named_unbound(&self) -> bool
pub fn is_unnamed_unbound(&self) -> bool
source§impl<T: Clone + Send + Sync + 'static> Free<T>
impl<T: Clone + Send + Sync + 'static> Free<T>
pub fn undo_stack_size(&self) -> usize
pub fn inc_undo_count(&self)
pub fn unwrap_unbound(self) -> (Option<Str>, usize, Constraint)
pub fn unwrap_linked(&self) -> T
pub fn get_linked(&self) -> Option<T>
pub fn get_linked_ref(&self) -> Option<Ref<'_, T>>
pub fn get_linked_refmut(&self) -> Option<RefMut<'_, T>>
pub fn get_previous(&self) -> Option<Ref<'_, Box<FreeKind<T>>>>
pub fn detach(&self) -> Self
source§impl<T: Default + Clone + Debug + Send + Sync + 'static> Free<T>
impl<T: Default + Clone + Debug + Send + Sync + 'static> Free<T>
sourcepub fn dummy_link(&self)
pub fn dummy_link(&self)
interior-mut
source§impl<T: CanbeFree + Send + Clone> Free<T>
impl<T: CanbeFree + Send + Clone> Free<T>
pub fn get_type(&self) -> Option<Type>
sourcepub fn get_subsup(&self) -> Option<(Type, Type)>
pub fn get_subsup(&self) -> Option<(Type, Type)>
:> Sub, <: Super
pub fn is_unbound(&self) -> bool
pub fn is_unbound_and_sandwiched(&self) -> bool
pub fn is_unbound_and_typed(&self) -> bool
pub fn constraint_is_typeof(&self) -> bool
pub fn constraint_is_sandwiched(&self) -> bool
pub fn constraint_is_uninited(&self) -> bool
source§impl Free<TyParam>
impl Free<TyParam>
pub fn map(&self, f: impl Fn(TyParam) -> TyParam)
sourcepub fn update_constraint(
&self,
new_constraint: Constraint,
in_inst_or_gen: bool,
)
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
sourcepub fn update_type(&self, new_type: Type)
pub fn update_type(&self, new_type: Type)
interior-mut
Trait Implementations§
source§impl<T: LimitedDisplay + Send + Clone> LimitedDisplay for Free<T>
impl<T: LimitedDisplay + Send + Clone> LimitedDisplay for Free<T>
source§impl<T: StructuralEq + CanbeFree + Clone + Default + Debug + Send + Sync + 'static> StructuralEq for Free<T>
impl<T: StructuralEq + CanbeFree + Clone + Default + Debug + Send + Sync + 'static> StructuralEq for Free<T>
fn structural_eq(&self, other: &Self) -> bool
impl Eq for Free<TyParam>
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> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)