Struct endbasic_core::ast::VarRef
source · pub struct VarRef { /* private fields */ }
Expand description
Represents a reference to a variable (which doesn’t have to exist).
Variable references are different from SymbolKey
s because they maintain the case of the
reference (for error display purposes) and because they carry an optional type annotation.
Implementations§
source§impl VarRef
impl VarRef
sourcepub fn new<T: Into<String>>(name: T, ref_type: Option<ExprType>) -> Self
pub fn new<T: Into<String>>(name: T, ref_type: Option<ExprType>) -> Self
Creates a new reference to the variable with name
and the optional ref_type
type.
sourcepub fn accepts(&self, other: ExprType) -> bool
pub fn accepts(&self, other: ExprType) -> bool
Returns true if this reference is compatible with the given type.
sourcepub fn accepts_callable(&self, other: Option<ExprType>) -> bool
pub fn accepts_callable(&self, other: Option<ExprType>) -> bool
Returns true if this reference is compatible with the return type of a callable.
Trait Implementations§
source§impl PartialEq for VarRef
impl PartialEq for VarRef
impl Eq for VarRef
impl StructuralPartialEq for VarRef
Auto Trait Implementations§
impl Freeze for VarRef
impl RefUnwindSafe for VarRef
impl Send for VarRef
impl Sync for VarRef
impl Unpin for VarRef
impl UnwindSafe for VarRef
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)