The memcpy_2d functions is working on elements in width/height instead of bytes. This does not correspond to what the other memcpy functions are currently doing but corresponds to what malloc (including malloc_pitched) is currently doing.
I see many good arguments for using bytes and many good arguments for using elements. The important thing is that the interface is consistent. My assumption is that it is more important with consistency between malloc and memcpy than between memcpys. Making the module completely consistent is outside the scope of this PR as discussed in #56
I also updated cust from 2018 edition to 2021 edition. This was mainly to get TryInto automatically into scope. I hope that was Ok.
Fixes #56
Add pitched malloc and 2d memcpy to
cust::memory
.The memcpy_2d functions is working on elements in width/height instead of bytes. This does not correspond to what the other
memcpy
functions are currently doing but corresponds to whatmalloc
(includingmalloc_pitched
) is currently doing.I see many good arguments for using bytes and many good arguments for using elements. The important thing is that the interface is consistent. My assumption is that it is more important with consistency between malloc and memcpy than between memcpys. Making the module completely consistent is outside the scope of this PR as discussed in #56
I also updated cust from 2018 edition to 2021 edition. This was mainly to get
TryInto
automatically into scope. I hope that was Ok.