pub enum BorrowStateV2 {
Owned,
SharedRef {
source: VarId,
start_line: u32,
},
MutRef {
source: VarId,
start_line: u32,
},
Moved {
to: VarId,
at_line: u32,
},
Dropped {
at_line: u32,
},
Copied {
to: VarId,
at_line: u32,
},
}Expand description
The ownership/borrow state of a variable (V2 - uses VarId).
Variants§
Owned
Variable owns its value (T).
Variable is a shared reference (&T).
MutRef
Variable is a mutable reference (&mut T).
Fields
Moved
Ownership has been moved to another variable.
Dropped
Variable has been dropped (out of scope).
Copied
Copy semantics - value was copied, original still valid.
Implementations§
Source§impl BorrowStateV2
impl BorrowStateV2
Sourcepub fn can_mutate(&self) -> bool
pub fn can_mutate(&self) -> bool
Check if the variable can be mutated.
Sourcepub fn is_invalidated(&self) -> bool
pub fn is_invalidated(&self) -> bool
Check if the variable has been invalidated (moved or dropped).
Sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Check if this is a reference (shared or mutable).
Sourcepub fn borrow_source(&self) -> Option<VarId>
pub fn borrow_source(&self) -> Option<VarId>
Get the source variable if this is a reference.
Trait Implementations§
Source§impl Clone for BorrowStateV2
impl Clone for BorrowStateV2
Source§fn clone(&self) -> BorrowStateV2
fn clone(&self) -> BorrowStateV2
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 BorrowStateV2
impl Debug for BorrowStateV2
Source§impl Default for BorrowStateV2
impl Default for BorrowStateV2
Source§fn default() -> BorrowStateV2
fn default() -> BorrowStateV2
Returns the “default value” for a type. Read more
Source§impl PartialEq for BorrowStateV2
impl PartialEq for BorrowStateV2
Source§fn eq(&self, other: &BorrowStateV2) -> bool
fn eq(&self, other: &BorrowStateV2) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for BorrowStateV2
impl StructuralPartialEq for BorrowStateV2
Auto Trait Implementations§
impl Freeze for BorrowStateV2
impl RefUnwindSafe for BorrowStateV2
impl Send for BorrowStateV2
impl Sync for BorrowStateV2
impl Unpin for BorrowStateV2
impl UnsafeUnpin for BorrowStateV2
impl UnwindSafe for BorrowStateV2
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more