Skip to content

Commit a7ae579

Browse files
committed
New design based on UnsafeCell
1 parent 15bbfac commit a7ae579

File tree

2 files changed

+290
-284
lines changed

2 files changed

+290
-284
lines changed

src/access.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
pub trait Access {}
3+
14
/// Helper trait that is implemented by [`ReadWrite`] and [`ReadOnly`].
25
pub trait Readable {}
36

@@ -7,16 +10,20 @@ pub trait Writable {}
710
/// Zero-sized marker type for allowing both read and write access.
811
#[derive(Debug, Copy, Clone)]
912
pub struct ReadWrite;
13+
impl Access for ReadWrite {}
1014
impl Readable for ReadWrite {}
1115
impl Writable for ReadWrite {}
1216

1317
/// Zero-sized marker type for allowing only read access.
1418
#[derive(Debug, Copy, Clone)]
1519
pub struct ReadOnly;
1620

21+
impl Access for ReadOnly {}
1722
impl Readable for ReadOnly {}
1823

1924
/// Zero-sized marker type for allowing only write access.
2025
#[derive(Debug, Copy, Clone)]
2126
pub struct WriteOnly;
27+
28+
impl Access for WriteOnly {}
2229
impl Writable for WriteOnly {}

0 commit comments

Comments
 (0)