nanomsg.rs icon indicating copy to clipboard operation
nanomsg.rs copied to clipboard

Expose a read/receive method without NN_MSG option

Open blabaere opened this issue 10 years ago • 4 comments

Is there a way to provide nn_recv the native buffer used by a Vec[u8], to avoid the copy ?

blabaere avatar Nov 14 '14 07:11 blabaere

Yeah, that would be ideal. Nanomsg also supports true zero-copy.

thehydroimpulse avatar Nov 14 '14 18:11 thehydroimpulse

In fact, this should be the default behavior of the Reader trait read function. Since it is passed a mutable slice, there must be a way to tell nanomsg to use the native underlying pointer and to remove the NN_MSG option. I think now that the read_to_end function is the only right place to use NN_MSG.

blabaere avatar Nov 14 '14 20:11 blabaere

Agreed!

thehydroimpulse avatar Nov 18 '14 21:11 thehydroimpulse

This is now done as read function of Reader trait is passing the raw pointer of the slice parameter to nanomsg.

blabaere avatar Nov 19 '14 05:11 blabaere