pub enum OpaqueRef<'a> {
Scalar(u64),
Str(&'a [u8]),
ListWords(&'a [u64]),
ListSlots(&'a [Slot]),
}Expand description
A borrowed canonical opaque value.
Lists may arrive either as raw u64 words or as Slots. The two forms
have identical canonical hashing and equality; keeping both avoids an
allocation when an encoder is handed a borrowed list of Slots.
Variants§
Implementations§
Source§impl<'a> OpaqueRef<'a>
impl<'a> OpaqueRef<'a>
pub fn scalar(word: u64) -> Self
pub fn str(bytes: &'a [u8]) -> Self
pub fn list(words: &'a [u64]) -> Self
pub fn list_slots(slots: &'a [Slot]) -> Self
pub fn kind(self) -> OpaqueKind
pub fn words(self) -> Option<&'a [u64]>
pub fn bytes(self) -> Option<&'a [u8]>
Sourcepub fn copy_words_to(self, target: &mut [u64]) -> Option<usize>
pub fn copy_words_to(self, target: &mut [u64]) -> Option<usize>
Copy list words into target, returning the number copied.
pub fn word_iter(self) -> WordIter<'a> ⓘ
Trait Implementations§
impl<'a> Copy for OpaqueRef<'a>
impl<'a> Eq for OpaqueRef<'a>
impl<'a> StructuralPartialEq for OpaqueRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for OpaqueRef<'a>
impl<'a> RefUnwindSafe for OpaqueRef<'a>
impl<'a> Send for OpaqueRef<'a>
impl<'a> Sync for OpaqueRef<'a>
impl<'a> Unpin for OpaqueRef<'a>
impl<'a> UnsafeUnpin for OpaqueRef<'a>
impl<'a> UnwindSafe for OpaqueRef<'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