Skip to content

Commit

Permalink
fix: location of warning docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Jan 10, 2025
1 parent a99a96d commit a51c60c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/services/src/seqlock.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
//! A simple implementation of a sequential lock.
//! More details: <https://docs.kernel.org/locking/seqlock.html>
//! Optimized for occasional writes and frequent reads
//! !!WARNING!!
//! ONLY USE IF ALL THE BELOW ARE MET
//! 1. Internal data < 64 bytes
//! 2. Data is Copy
//! 3. ONLY 1 writer
//! 4. VERY frequent reads
use std::{
cell::UnsafeCell,
Expand Down Expand Up @@ -93,6 +86,13 @@ impl<T> SeqLockReader<T> {

impl<T> SeqLock<T> {
/// Creates a new `SeqLock` and returns a writer and a reader handle.
/// Optimized for occasional writes and frequent reads
/// !!WARNING!!
/// ONLY USE IF ALL THE BELOW CRITERIA ARE MET
/// 1. Internal data < 64 bytes
/// 2. Data is Copy
/// 3. ONLY 1 writer
/// 4. VERY frequent reads
#[allow(clippy::new_ret_no_self)]
pub fn new(data: T) -> (SeqLockWriter<T>, SeqLockReader<T>) {
let lock = Self {
Expand Down

0 comments on commit a51c60c

Please sign in to comment.