```
let v: Vec<u8> = ...;let repr = v.as_slice().repr();
ProtobufObj {
data: repr.data,
size: repr.len
}
```
should do the trick.
On Tue, Nov 25, 2014 at 2:06 PM, Connor Doyle <con...@mesosphere.io>
wrote:
> Hi all,
> First time on the mailing list!
> I'm having trouble setting a raw void pointer in a struct using a recent (72
> hrs) nightly.
> I'd like to address the underlying bytes for a Vec<u8> I have in-hand.
> The FFI guide is a little thin in this area, glad to add detail once I figure
> out how this is done.
> For reference, here is the target struct:
> extern crate libc;
> #[repr(C)]
> pub struct ProtobufObj {
> pub data: *mut libc::c_void,
> pub size: libc::size_t,
> }
> Thanks,
> --
> Connor
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev