Skip to content

Commit

Permalink
Merge pull request #299 from kalcutter/message-from-raw
Browse files Browse the repository at this point in the history
Message: Add pub unsafe fn `from_raw`
  • Loading branch information
Jasper-Bekkers authored Dec 29, 2022
2 parents 92c638a + 4e9f4e2 commit ea716ce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ impl Message {
unsafe { Self::alloc(|msg| zmq_sys::zmq_msg_init(msg)) }
}

/// Create a `Message` from an initialized `zmq_sys::zmq_msg_t`.
///
/// # Safety
///
/// `msg` must be initialized.
pub unsafe fn from_msg(msg: zmq_sys::zmq_msg_t) -> Self {
Message { msg }
}

/// Create a `Message` preallocated with `len` uninitialized bytes.
///
/// Since it is very easy to introduce undefined behavior using this
Expand Down

0 comments on commit ea716ce

Please sign in to comment.