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