pub struct TextRef<'a, const N: usize>(/* private fields */);Expand description
UTF-8 text bounded in bytes, borrowing its backing storage. Decoding accepts borrowed input only, without an owned fallback.
ⓘ
use ic_wire::{TextRef, Encoding, Limits, decode};
let mut input = [1, b'a'];
let text = decode::<TextRef<'_, 1>>(&input, Encoding::Payload,
Limits { bytes: 2, allocation: 1024, nodes: 8, depth: 8 }).unwrap();
input[1] = b'b';
assert_eq!(text.as_str(), "a");Implementations§
Trait Implementations§
impl<'a, const N: usize> Copy for TextRef<'a, N>
Source§impl<'de: 'a, 'a, const N: usize> Deserialize<'de> for TextRef<'a, N>
impl<'de: 'a, 'a, const N: usize> Deserialize<'de> for TextRef<'a, N>
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl<'a, const N: usize> Eq for TextRef<'a, N>
impl<'a, const N: usize> StructuralPartialEq for TextRef<'a, N>
Auto Trait Implementations§
impl<'a, const N: usize> Forget for TextRef<'a, N>
impl<'a, const N: usize> Freeze for TextRef<'a, N>
impl<'a, const N: usize> Move for TextRef<'a, N>
impl<'a, const N: usize> RefUnwindSafe for TextRef<'a, N>
impl<'a, const N: usize> Send for TextRef<'a, N>
impl<'a, const N: usize> Sync for TextRef<'a, N>
impl<'a, const N: usize> Unpin for TextRef<'a, N>
impl<'a, const N: usize> UnsafeUnpin for TextRef<'a, N>
impl<'a, const N: usize> UnwindSafe for TextRef<'a, N>
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