-
Newbie question: how do I create a Given
I reviewed the docs and it wasn't obvious to this rust newbie. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I think this is how you're meant to do it: use bstr::ByteSlice;
let a = [0_u8; 3];
let b = a.as_bstr(); Most of the APIs in this crate come from either |
Beta Was this translation helpful? Give feedback.
-
It's also worth pointing out that you don't actually have a byte slice here. You have an array of bytes. It's likely we could improve the from impls with const generics. |
Beta Was this translation helpful? Give feedback.
-
For const generics, see #86. Otherwise moving this to a Discussion Q&A. |
Beta Was this translation helpful? Give feedback.
I think this is how you're meant to do it:
Most of the APIs in this crate come from either
ByteSlice
orByteVec
. These are extension traits, which means when they are imported, they make methods available on vecs and slices thatbstr
implements these traits on.