introduce Mutability::ptr_str

This commit is contained in:
Kalle Wachsmuth 2024-03-24 14:53:58 +01:00
parent db3a5c5873
commit 277e61854e
No known key found for this signature in database
GPG key ID: 0B52AE391C674CE5
4 changed files with 12 additions and 24 deletions

View file

@ -51,6 +51,14 @@ impl Mutability {
}
}
/// Returns `"const"` or `"mut"` depending on the mutability.
pub fn ptr_str(self) -> &'static str {
match self {
Mutability::Not => "const",
Mutability::Mut => "mut",
}
}
/// Returns `""` (empty string) or `"mutably "` depending on the mutability.
pub fn mutably_str(self) -> &'static str {
match self {