pub struct FrameCodecFactory(/* private fields */);Expand description
Makes the FrameCodec instances for one sink: one per chain. Cloning
shares the factory.
The closure is RefUnwindSafe, so the factory, and a sink type that holds
one, stays UnwindSafe and RefUnwindSafe.
A closure that captures state which is not RefUnwindSafe wraps it in
AssertUnwindSafe and reaches it through
deref, as in let state: &T = &wrapper;. From edition 2021 a closure
that names wrapper.0 captures only the inner field, which loses the
wrapper and fails the bound.
Implementations§
Source§impl FrameCodecFactory
impl FrameCodecFactory
Sourcepub fn new(
make: impl Fn() -> Box<dyn FrameCodec> + Send + Sync + RefUnwindSafe + 'static,
) -> Self
pub fn new( make: impl Fn() -> Box<dyn FrameCodec> + Send + Sync + RefUnwindSafe + 'static, ) -> Self
Wrap make, which builds one codec instance per call.
Sourcepub fn make(&self) -> Box<dyn FrameCodec>
pub fn make(&self) -> Box<dyn FrameCodec>
Build a fresh codec instance.
Trait Implementations§
Source§impl Clone for FrameCodecFactory
impl Clone for FrameCodecFactory
Auto Trait Implementations§
impl Freeze for FrameCodecFactory
impl RefUnwindSafe for FrameCodecFactory
impl Send for FrameCodecFactory
impl Sync for FrameCodecFactory
impl Unpin for FrameCodecFactory
impl UnsafeUnpin for FrameCodecFactory
impl UnwindSafe for FrameCodecFactory
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