megacommerce_shared/models/
r_lock.rs

1use std::sync::Arc;
2
3use tokio::sync::{RwLock, RwLockReadGuard};
4
5#[derive(Debug, Clone)]
6pub struct RLock<T>(pub Arc<RwLock<T>>);
7
8impl<T> RLock<T> {
9  pub async fn get(&self) -> RwLockReadGuard<'_, T> {
10    self.0.read().await
11  }
12}