Add Mutability::mutably_str
This commit is contained in:
parent
e51cd6e822
commit
4439f1f6a6
3 changed files with 17 additions and 22 deletions
|
@ -804,6 +804,14 @@ impl Mutability {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns `""` (empty string) or `"mutably "` depending on the mutability.
|
||||
pub fn mutably_str(self) -> &'static str {
|
||||
match self {
|
||||
Mutability::Not => "",
|
||||
Mutability::Mut => "mutably ",
|
||||
}
|
||||
}
|
||||
|
||||
/// Return `true` if self is mutable
|
||||
pub fn is_mut(self) -> bool {
|
||||
matches!(self, Self::Mut)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue