Skip to content

Commit 70b74cc

Browse files
committed
refactor(access): implement Readable via RestrictAccess
Signed-off-by: Martin Kröning <[email protected]>
1 parent 16cb5aa commit 70b74cc

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/access.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ pub trait Readable: Copy + Default + private::Sealed {
5858
#[deprecated = "replaced by `RestrictAccess<ReadOnly>::Restricted`"]
5959
type RestrictShared: Readable + Access;
6060
}
61+
impl<A: RestrictAccess<ReadOnly, Restricted = ReadOnly>> Readable for A {
62+
type RestrictShared = ReadOnly;
63+
}
6164

6265
/// Helper trait that is implemented by [`ReadWrite`] and [`WriteOnly`].
6366
pub trait Writable: Access + private::Sealed {}
@@ -78,16 +81,10 @@ where
7881
/// Zero-sized marker type for allowing both read and write access.
7982
#[derive(Debug, Default, Copy, Clone)]
8083
pub struct ReadWrite;
81-
impl Readable for ReadWrite {
82-
type RestrictShared = ReadOnly;
83-
}
8484

8585
/// Zero-sized marker type for allowing only read access.
8686
#[derive(Debug, Default, Copy, Clone)]
8787
pub struct ReadOnly;
88-
impl Readable for ReadOnly {
89-
type RestrictShared = ReadOnly;
90-
}
9188

9289
/// Zero-sized marker type for allowing only write access.
9390
#[derive(Debug, Default, Copy, Clone)]

0 commit comments

Comments
 (0)