pub struct SwmrReader<T: 'static> { /* private fields */ }Expand description
A handle for creating LocalReaders that can be shared across threads.
Unlike LocalReader, which is !Sync and bound to a single thread,
SwmrReader is Sync and Clone. It holds a reference to the shared state
but does not register a reader slot until local() is called.
可以跨线程共享的用于创建 LocalReader 的句柄。
与 !Sync 且绑定到单个线程的 LocalReader 不同,
SwmrReader 是 Sync 和 Clone 的。它持有对共享状态的引用,
但直到调用 local() 时才注册读者槽。
Implementations§
Source§impl<T: 'static> SwmrReader<T>
impl<T: 'static> SwmrReader<T>
Sourcepub fn local(&self) -> LocalReader<T>
pub fn local(&self) -> LocalReader<T>
Create a new LocalReader for the current thread.
为当前线程创建一个新的 LocalReader。
Trait Implementations§
Source§impl<T: 'static> Clone for SwmrReader<T>
impl<T: 'static> Clone for SwmrReader<T>
Auto Trait Implementations§
impl<T> Freeze for SwmrReader<T>
impl<T> RefUnwindSafe for SwmrReader<T>
impl<T> Send for SwmrReader<T>
impl<T> Sync for SwmrReader<T>
impl<T> Unpin for SwmrReader<T>
impl<T> UnwindSafe for SwmrReader<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more