You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have these functions for initializing a new Cstruct:
val Cstruct.of_bigarray ?off:int -> ?len:int -> buffer -> t
and
val Cstruct.of_string ?allocator:(int -> t) -> string -> t
val Cstruct.of_bytes ?allocator:(int -> t) -> bytes -> t
val Cstruct.of_hex string -> t
It would be nice, and would seem more consistent, if it would be possible to construct a Cstruct.t directly from a slice of a string/bytes (like you can with of_bigarray) instead of having to first do a String.sub/Bytes.sub (which means a redundant memcpy operation) before the copy into the new Cstruct.t.
Also, why is there no ?allocator for of_bigarray? Is that because it doesn't actually copy, but maps to the same memory? If so, that should probably be documented?
The text was updated successfully, but these errors were encountered:
We currently have these functions for initializing a new Cstruct:
and
It would be nice, and would seem more consistent, if it would be possible to construct a
Cstruct.t
directly from a slice of astring
/bytes
(like you can withof_bigarray
) instead of having to first do aString.sub
/Bytes.sub
(which means a redundant memcpy operation) before the copy into the newCstruct.t
.Also, why is there no
?allocator
forof_bigarray
? Is that because it doesn't actually copy, but maps to the same memory? If so, that should probably be documented?The text was updated successfully, but these errors were encountered: