pub struct CtxHandle { /* private fields */ }
Expand description
A non-owning pointer to a Ctx
.
A CtxHandle
allows thread-safe configuration of the context aliased by
the handle. It is also used to created sockets associated with the context.
Once the Ctx
it is pointing to is shutdown
or dropped, all associated
CtxHandle
will be invalidated. All calls involving an invalidated
CtxHandle
will return a InvalidCtx
error.
use libzmq::{Ctx, Dish, ErrorKind};
// We create a `CtxHandle` from a new context. Since we drop
// the context pointed by the handle, it will no longer be valid
// once it reaches the outer scope.
let handle = {
let ctx = Ctx::new();
ctx.handle()
};
// Attempting to use the invalided handle will result in `InvalidCtx`
// errors.
let err = Dish::with_ctx(handle).unwrap_err();
match err.kind() {
ErrorKind::InvalidCtx => (),
_ => unreachable!(),
}
Implementations§
Trait Implementations§
impl Copy for CtxHandle
impl Eq for CtxHandle
impl StructuralPartialEq for CtxHandle
Auto Trait Implementations§
impl Freeze for CtxHandle
impl RefUnwindSafe for CtxHandle
impl Send for CtxHandle
impl Sync for CtxHandle
impl Unpin for CtxHandle
impl UnwindSafe for CtxHandle
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