pub struct MagicFunction { /* private fields */ }Expand description
MagicFunction is an abstract base class in C++. In Rust, we model this as a struct containing function pointers (vtable) to allow custom typechecking logic for builtins.
Implementations§
Source§impl MagicFunction
impl MagicFunction
pub fn type_check(&self, _context: &MagicFunctionTypeCheckContext) -> bool
Source§impl MagicFunction
impl MagicFunction
Sourcepub fn from_handlers(
handle_old_solver: fn(&mut TypeChecker, &Arc<Scope>, &AstExprCall, WithPredicate<TypePackId>) -> Option<WithPredicate<TypePackId>>,
infer: fn(&MagicFunctionCallContext) -> bool,
refine: fn(&MagicRefinementContext),
type_check: fn(&MagicFunctionTypeCheckContext) -> bool,
) -> Self
pub fn from_handlers( handle_old_solver: fn(&mut TypeChecker, &Arc<Scope>, &AstExprCall, WithPredicate<TypePackId>) -> Option<WithPredicate<TypePackId>>, infer: fn(&MagicFunctionCallContext) -> bool, refine: fn(&MagicRefinementContext), type_check: fn(&MagicFunctionTypeCheckContext) -> bool, ) -> Self
Build a MagicFunction vtable from its four handler function pointers.
This is the public analog of constructing a MagicFunction subclass
(e.g. the test-only MagicInstanceIsA) outside this crate, where the
fields are not directly accessible.
Trait Implementations§
Source§impl Clone for MagicFunction
impl Clone for MagicFunction
Source§fn clone(&self) -> MagicFunction
fn clone(&self) -> MagicFunction
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MagicFunction
impl Debug for MagicFunction
Source§impl Drop for MagicFunction
impl Drop for MagicFunction
impl Send for MagicFunction
impl Sync for MagicFunction
Auto Trait Implementations§
impl Freeze for MagicFunction
impl RefUnwindSafe for MagicFunction
impl Unpin for MagicFunction
impl UnsafeUnpin for MagicFunction
impl UnwindSafe for MagicFunction
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