pub struct Bytes<'a>(/* private fields */);Expand description
A reference to a byte array.
Implementations§
Source§impl<'a> Bytes<'a>
impl<'a> Bytes<'a>
Sourcepub const unsafe fn new(data: &'a [u8]) -> Self
pub const unsafe fn new(data: &'a [u8]) -> Self
Wraps a byte array in a byte-array external reference.
§Safety
It is not actually unsafe to construct a Bytes object. However, if the caller then
CBOR-encodes the resulting object, they must ensure that the Bytes object remains in
existence until the CBOR data has been submitted as part of a method call. Failure to do
this would allow the referent to be modified or dropped, resulting in OC-Wasm reading from
that reused memory.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Bytes<'a>
impl<'a> RefUnwindSafe for Bytes<'a>
impl<'a> Send for Bytes<'a>
impl<'a> Sync for Bytes<'a>
impl<'a> Unpin for Bytes<'a>
impl<'a> UnsafeUnpin for Bytes<'a>
impl<'a> UnwindSafe for Bytes<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more