diff --git a/src/lib.rs b/src/lib.rs index 17dc0ccd..15e217f2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -374,6 +374,7 @@ pub fn version() -> (i32, i32, i32) { (major as i32, minor as i32, patch as i32) } +#[derive(Debug)] struct RawContext { ctx: *mut c_void, } @@ -417,7 +418,7 @@ impl Drop for RawContext { /// other threads, see `zmq_ctx_destroy`(3)) by explicitly calling /// `Context::destroy`. /// -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Context { raw: Arc, } @@ -480,6 +481,7 @@ impl Default for Context { } /// A socket, the central object in 0MQ. +#[derive(Debug)] pub struct Socket { sock: *mut c_void, // The `context` field is never accessed, but implicitly does @@ -1348,3 +1350,16 @@ pub fn z85_decode(data: &str) -> result::Result, DecodeError> { Ok(dest) } + + +#[cfg(test)] +mod tests { + use crate::Context; + use crate::SocketType; + + #[test] + fn debug_works() { + println!("{:?}", Context::new()); + println!("{:?}", Context::new().socket(SocketType::REQ)); + } +}