Skip to content

chore: remove const_spinlock function #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
/// The spinlock implemenation is based on the abstractions provided by the `lock_api` crate.
pub use lock_api;

pub use spinlock::{const_spinlock, MappedSpinlockGuard, RawSpinlock, Spinlock, SpinlockGuard};
pub use spinlock::{MappedSpinlockGuard, RawSpinlock, Spinlock, SpinlockGuard};

mod spinlock;
14 changes: 0 additions & 14 deletions src/spinlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,6 @@ pub type SpinlockGuard<'a, T> = lock_api::MutexGuard<'a, RawSpinlock, T>;
/// ```
pub type MappedSpinlockGuard<'a, T> = lock_api::MappedMutexGuard<'a, RawSpinlock, T>;

/// Create an unlocked `Spinlock` in a `const` context.
///
/// ## Example
///
/// ```rust
/// use spinning_top::{const_spinlock, Spinlock};
///
/// static SPINLOCK: Spinlock<i32> = const_spinlock(42);
/// ```
#[inline]
pub const fn const_spinlock<T>(val: T) -> Spinlock<T> {
Spinlock::const_new(<RawSpinlock as lock_api::RawMutex>::INIT, val)
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down