pub enum LockSuggestion {
UseAtomic {
field: String,
current_type: Option<String>,
suggested_type: String,
line: u32,
},
SplitLock {
lock_name: String,
suggested_splits: Vec<(String, String)>,
line: u32,
},
ReduceScope {
guard_name: String,
current_span: (u32, u32),
suggested_span: (u32, u32),
reason: String,
},
UseRwLock {
lock_name: String,
read_count: usize,
write_count: usize,
line: u32,
},
LockAcrossAwait {
guard_name: String,
lock_line: u32,
await_line: u32,
},
RemoveLock {
lock_name: String,
reason: String,
line: u32,
},
}Expand description
Suggestion for lock optimization.
Variants§
UseAtomic
Field can be extracted to atomic type.
Fields
SplitLock
Lock can be split into multiple finer locks.
Fields
ReduceScope
Critical section scope can be reduced.
Fields
UseRwLock
Mutex can be replaced with RwLock.
Fields
LockAcrossAwait
Lock is held across await point.
Fields
RemoveLock
Lock can be removed (data is thread-local).
Implementations§
Source§impl LockSuggestion
impl LockSuggestion
Sourcepub fn severity(&self) -> u8
pub fn severity(&self) -> u8
Get the severity/priority of this suggestion (higher = more important).
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get a human-readable description.
Sourcepub fn short_description(&self) -> String
pub fn short_description(&self) -> String
Get a short description for the suggestion.
Trait Implementations§
Source§impl Clone for LockSuggestion
impl Clone for LockSuggestion
Source§fn clone(&self) -> LockSuggestion
fn clone(&self) -> LockSuggestion
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 LockSuggestion
impl Debug for LockSuggestion
Source§impl PartialEq for LockSuggestion
impl PartialEq for LockSuggestion
Source§fn eq(&self, other: &LockSuggestion) -> bool
fn eq(&self, other: &LockSuggestion) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for LockSuggestion
impl StructuralPartialEq for LockSuggestion
Auto Trait Implementations§
impl Freeze for LockSuggestion
impl RefUnwindSafe for LockSuggestion
impl Send for LockSuggestion
impl Sync for LockSuggestion
impl Unpin for LockSuggestion
impl UnsafeUnpin for LockSuggestion
impl UnwindSafe for LockSuggestion
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