Message.copyTo

Copies message content to another message.

copy() returns a new Message object, while copyTo(dest) copies the contents of this Message into dest. dest must be a valid (i.e. initialised) Message.

Warning: These functions may not do what you think they do. Please refer to $(ZMQAPI zmq_msg_copy(),the $(ZMQ) manual) for details.

struct Message
@safe
void
copyTo

Throws

ZmqException if $(ZMQ) reports an error.

Corresponds to

$(ZMQREF zmq_msg_copy())

Examples

import std.string: representation;
auto msg1 = Message(3);
msg1.data[] = "foo".representation;
auto msg2 = msg1.copy();
assert (msg2.data.asString() == "foo");

Meta