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