Allow dynamically borrowed RwLock guards

This commit is contained in:
Zhang Junyang
2024-04-23 09:15:29 +08:00
committed by Tate, Hongliang Tian
parent 3dd6f71936
commit 11e4984df2
4 changed files with 158 additions and 32 deletions

View File

@ -364,11 +364,11 @@ impl Credentials_ {
}
// ******* Supplementary groups methods *******
pub(super) fn groups(&self) -> RwLockReadGuard<'_, BTreeSet<Gid>> {
pub(super) fn groups(&self) -> RwLockReadGuard<BTreeSet<Gid>> {
self.supplementary_gids.read()
}
pub(super) fn groups_mut(&self) -> RwLockWriteGuard<'_, BTreeSet<Gid>> {
pub(super) fn groups_mut(&self) -> RwLockWriteGuard<BTreeSet<Gid>> {
self.supplementary_gids.write()
}
}

View File

@ -236,7 +236,7 @@ impl<R: TRights> Credentials<R> {
///
/// This method requies the `Read` right.
#[require(R > Read)]
pub fn groups(&self) -> RwLockReadGuard<'_, BTreeSet<Gid>> {
pub fn groups(&self) -> RwLockReadGuard<BTreeSet<Gid>> {
self.0.groups()
}
@ -244,7 +244,7 @@ impl<R: TRights> Credentials<R> {
///
/// This method requires the `Write` right.
#[require(R > Write)]
pub fn groups_mut(&self) -> RwLockWriteGuard<'_, BTreeSet<Gid>> {
pub fn groups_mut(&self) -> RwLockWriteGuard<BTreeSet<Gid>> {
self.0.groups_mut()
}
}