pub struct CanonicalBytes<W = CanonicalJsonWitness> { /* private fields */ }Expand description
Canonical JSON bytes paired with a phantom validation witness.
The wrapped buffer is immutable once constructed, so downstream signing, storage, and export paths can share it without reserializing or risking accidental mutation.
Implementations§
Source§impl CanonicalBytes
impl CanonicalBytes
Sourcepub fn new<T>(value: &T) -> Result<CanonicalBytes, Error>where
T: Serialize,
pub fn new<T>(value: &T) -> Result<CanonicalBytes, Error>where
T: Serialize,
Serialize a value to canonical JSON bytes and wrap them with a witness.
Sourcepub fn from_serializable<T>(value: &T) -> Result<CanonicalBytes, Error>where
T: Serialize,
pub fn from_serializable<T>(value: &T) -> Result<CanonicalBytes, Error>where
T: Serialize,
Serialize a value to canonical JSON bytes and wrap them with a witness.
Sourcepub fn from_value(value: &Value) -> Result<CanonicalBytes, Error>
pub fn from_value(value: &Value) -> Result<CanonicalBytes, Error>
Canonicalize a JSON value and wrap the resulting bytes with a witness.
Trait Implementations§
Source§impl<W> AsRef<[u8]> for CanonicalBytes<W>
impl<W> AsRef<[u8]> for CanonicalBytes<W>
Source§impl<W> Debug for CanonicalBytes<W>where
W: Debug,
impl<W> Debug for CanonicalBytes<W>where
W: Debug,
impl<W> Eq for CanonicalBytes<W>where
W: Eq,
Source§impl<W> Hash for CanonicalBytes<W>where
W: Hash,
impl<W> Hash for CanonicalBytes<W>where
W: Hash,
Source§impl<W> PartialEq for CanonicalBytes<W>where
W: PartialEq,
impl<W> PartialEq for CanonicalBytes<W>where
W: PartialEq,
impl<W> StructuralPartialEq for CanonicalBytes<W>where
W: PartialEq,
Auto Trait Implementations§
impl<W> Freeze for CanonicalBytes<W>
impl<W> RefUnwindSafe for CanonicalBytes<W>where
W: RefUnwindSafe,
impl<W> Send for CanonicalBytes<W>where
W: Send,
impl<W> Sync for CanonicalBytes<W>where
W: Sync,
impl<W> Unpin for CanonicalBytes<W>where
W: Unpin,
impl<W> UnsafeUnpin for CanonicalBytes<W>
impl<W> UnwindSafe for CanonicalBytes<W>where
W: UnwindSafe,
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
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
👎Deprecated:
use ToHexExt instead
Encode the hex strict representing
self into the result.
Lower case letters are used (e.g. f9b4ca).Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
👎Deprecated:
use ToHexExt instead
Encode the hex strict representing
self into the result.
Upper case letters are used (e.g. F9B4CA).Source§impl<T> ToHexExt for T
impl<T> ToHexExt for T
Source§fn encode_hex(&self) -> String
fn encode_hex(&self) -> String
Encode the hex strict representing
self into the result.
Lower case letters are used (e.g. f9b4ca).Source§fn encode_hex_upper(&self) -> String
fn encode_hex_upper(&self) -> String
Encode the hex strict representing
self into the result.
Upper case letters are used (e.g. F9B4CA).Source§fn encode_hex_with_prefix(&self) -> String
fn encode_hex_with_prefix(&self) -> String
Encode the hex strict representing
self into the result with prefix 0x.
Lower case letters are used (e.g. 0xf9b4ca).Source§fn encode_hex_upper_with_prefix(&self) -> String
fn encode_hex_upper_with_prefix(&self) -> String
Encode the hex strict representing
self into the result with prefix 0X.
Upper case letters are used (e.g. 0xF9B4CA).