pub struct PermTransition {
from: PermissionPriv,
to: PermissionPriv,
}
Expand description
Transition from one permission to the next.
Fields§
§from: PermissionPriv
§to: PermissionPriv
Implementations§
Source§impl PermTransition
impl PermTransition
Sourcepub fn summary(&self) -> &'static str
pub fn summary(&self) -> &'static str
Readable explanation of the consequences of an event. Fits in the sentence “This transition corresponds to {trans.summary()}”.
Sourcepub(in borrow_tracker::tree_borrows) fn is_relevant(
&self,
err: TransitionError,
) -> bool
pub(in borrow_tracker::tree_borrows) fn is_relevant( &self, err: TransitionError, ) -> bool
Determines whether self
is a relevant transition for the error err
.
self
will be a transition that happened to a tag some time before
that tag caused the error.
Irrelevant events:
- modifications of write permissions when the error is related to read permissions
(on failed reads and protected
Frozen -> Disabled
, ignoreReserved -> Active
,Reserved(conflicted=false) -> Reserved(conflicted=true)
, andActive -> Frozen
) - all transitions for attempts to deallocate strongly protected tags
§Panics
This function assumes that its arguments apply to the same location and that they were obtained during a normal execution. It will panic otherwise.
- all transitions involved in
self
anderr
should be increasing (Reserved < Active < Frozen < Disabled); - between
self
anderr
the permission should also be increasing, so all permissions insideerr
should be greater thanself.1
; Active
andReserved(conflicted=false)
cannot cause an error due to insufficient permissions, soerr
cannot be aChildAccessForbidden(_)
of either of them;err
should not beProtectedDisabled(Disabled)
, because the protected tag should not have beenDisabled
in the first place (if this occurs it means we have unprotected tags that become protected)
Sourcepub fn endpoint(&self) -> Permission
pub fn endpoint(&self) -> Permission
Endpoint of a transition.
Meant only for diagnostics, use applied
in non-diagnostics
code, which also checks that the starting point matches the current state.
Source§impl PermTransition
impl PermTransition
Sourcefn is_possible(self) -> bool
fn is_possible(self) -> bool
All transitions created through normal means (using perform_access
)
should be possible, but the same is not guaranteed by construction of
transitions inferred by diagnostics. This checks that a transition
reconstructed by diagnostics is indeed one that could happen.
pub fn from(from: Permission, to: Permission) -> Option<Self>
pub fn is_noop(self) -> bool
Sourcepub fn applied(self, starting_point: Permission) -> Option<Permission>
pub fn applied(self, starting_point: Permission) -> Option<Permission>
Extract result of a transition (checks that the starting point matches).
Sourcepub fn started(self) -> Permission
pub fn started(self) -> Permission
Extract starting point of a transition
Sourcepub fn produces_disabled(self) -> bool
pub fn produces_disabled(self) -> bool
Determines if this transition would disable the permission.
Trait Implementations§
Source§impl Clone for PermTransition
impl Clone for PermTransition
Source§fn clone(&self) -> PermTransition
fn clone(&self) -> PermTransition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PermTransition
impl Debug for PermTransition
Source§impl Display for PermTransition
impl Display for PermTransition
Source§impl PartialEq for PermTransition
impl PartialEq for PermTransition
impl Copy for PermTransition
impl Eq for PermTransition
impl StructuralPartialEq for PermTransition
Auto Trait Implementations§
impl Freeze for PermTransition
impl RefUnwindSafe for PermTransition
impl Send for PermTransition
impl Sync for PermTransition
impl Unpin for PermTransition
impl UnwindSafe for PermTransition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 2 bytes