pub struct TypeContext<'a> {
pub expected_type: Option<&'a TypeRef>,
pub has_lvalue_target: bool,
pub ephemeral_is_allowed: bool,
}Expand description
TypeRef checking context
Fields§
§expected_type: Option<&'a TypeRef>Expected type for the current expression
has_lvalue_target: bool§ephemeral_is_allowed: boolImplementations§
Source§impl<'a> TypeContext<'a>
impl<'a> TypeContext<'a>
pub const fn new( expected_type: Option<&'a TypeRef>, has_lvalue_target: bool, ) -> Self
pub const fn new_argument( required_type: &'a TypeRef, has_lvalue_target: bool, ) -> Self
pub const fn new_unsure_argument( expected_type: Option<&'a TypeRef>, has_lvalue_target: bool, ) -> Self
pub const fn new_anything_argument(has_lvalue_target: bool) -> Self
pub fn new_function(required_type: &'a TypeRef) -> Self
pub const fn with_expected_type( &self, expected_type: Option<&'a TypeRef>, has_lvalue_target: bool, ) -> Self
Sourcepub fn expected_type_or_optional_inner(&self) -> Self
pub fn expected_type_or_optional_inner(&self) -> Self
If the expected type is Optional<T>, returns T; otherwise returns the
original expected type.
Trait Implementations§
Source§impl<'a> Clone for TypeContext<'a>
impl<'a> Clone for TypeContext<'a>
Source§fn clone(&self) -> TypeContext<'a>
fn clone(&self) -> TypeContext<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for TypeContext<'a>
impl<'a> RefUnwindSafe for TypeContext<'a>
impl<'a> !Send for TypeContext<'a>
impl<'a> !Sync for TypeContext<'a>
impl<'a> Unpin for TypeContext<'a>
impl<'a> UnwindSafe for TypeContext<'a>
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