Skip to content

Commit bfe5074

Browse files
committed
refactor: move guard type exports into separate module
1 parent 984f1c7 commit bfe5074

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
/// The spinlock implemenation is based on the abstractions provided by the `lock_api` crate.
3333
pub use lock_api;
3434

35-
pub use spinlock::{MappedSpinlockGuard, RawSpinlock, Spinlock, SpinlockGuard};
35+
pub use spinlock::{RawSpinlock, Spinlock};
36+
37+
/// Type aliases for guards.
38+
pub mod guard {
39+
pub use super::spinlock::{MappedSpinlockGuard, SpinlockGuard};
40+
}
3641

3742
mod spinlock;

src/spinlock.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub type Spinlock<T> = lock_api::Mutex<RawSpinlock, T>;
146146
/// ## Example
147147
///
148148
/// ```rust
149-
/// use spinning_top::{Spinlock, SpinlockGuard};
149+
/// use spinning_top::{guard::SpinlockGuard, Spinlock};
150150
///
151151
/// let spinlock = Spinlock::new(Vec::new());
152152
///
@@ -170,7 +170,10 @@ pub type SpinlockGuard<'a, T> = lock_api::MutexGuard<'a, RawSpinlock, T>;
170170
///
171171
/// ## Example
172172
/// ```rust
173-
/// use spinning_top::{MappedSpinlockGuard, Spinlock, SpinlockGuard};
173+
/// use spinning_top::{
174+
/// guard::{MappedSpinlockGuard, SpinlockGuard},
175+
/// Spinlock,
176+
/// };
174177
///
175178
/// let spinlock = Spinlock::new(Some(3));
176179
///

0 commit comments

Comments
 (0)