pub struct ProtoEnvelope<Contents> { /* private fields */ }
Expand description
The envelope struct is used to keep around the original bytes that the content was serialized into in case the serialization is not canonical.
Implementations§
Source§impl<Contents> ProtoEnvelope<Contents>
impl<Contents> ProtoEnvelope<Contents>
Sourcepub fn signed_contents(
private_key: &PrivateKey,
contents: Contents,
) -> Result<Self, SignatureError>where
Contents: Signable,
pub fn signed_contents(
private_key: &PrivateKey,
contents: Contents,
) -> Result<Self, SignatureError>where
Contents: Signable,
Create an envelope for some contents using a signature.
Sourcepub fn content_bytes(&self) -> &[u8] ⓘ
pub fn content_bytes(&self) -> &[u8] ⓘ
Get the byte representation of the envelope contents.
pub fn key_id(&self) -> &KeyID
pub fn signature(&self) -> &Signature
Sourcepub fn to_protobuf(&self) -> Vec<u8> ⓘ
pub fn to_protobuf(&self) -> Vec<u8> ⓘ
Get the representation of the entire envelope as a byte vector.
This is the logical inverse of Envelope::from_bytes
.
Sourcepub fn from_protobuf(bytes: &[u8]) -> Result<Self, ParseEnvelopeError>where
Contents: Decode,
pub fn from_protobuf(bytes: &[u8]) -> Result<Self, ParseEnvelopeError>where
Contents: Decode,
Create an entire envelope from a byte vector.
This is the logical inverse of Envelope::as_bytes
.
Trait Implementations§
Source§impl<Content> AsRef<Content> for ProtoEnvelope<Content>
impl<Content> AsRef<Content> for ProtoEnvelope<Content>
Source§impl<Contents: Clone> Clone for ProtoEnvelope<Contents>
impl<Contents: Clone> Clone for ProtoEnvelope<Contents>
Source§fn clone(&self) -> ProtoEnvelope<Contents>
fn clone(&self) -> ProtoEnvelope<Contents>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<Contents: Debug> Debug for ProtoEnvelope<Contents>
impl<Contents: Debug> Debug for ProtoEnvelope<Contents>
Source§impl<Content> From<ProtoEnvelope<Content>> for ProtoEnvelopeBody
impl<Content> From<ProtoEnvelope<Content>> for ProtoEnvelopeBody
Source§fn from(value: ProtoEnvelope<Content>) -> Self
fn from(value: ProtoEnvelope<Content>) -> Self
Converts to this type from the input type.
Source§impl<Contents: PartialEq> PartialEq for ProtoEnvelope<Contents>
impl<Contents: PartialEq> PartialEq for ProtoEnvelope<Contents>
Source§fn eq(&self, other: &ProtoEnvelope<Contents>) -> bool
fn eq(&self, other: &ProtoEnvelope<Contents>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.Source§impl<Content> TryFrom<ProtoEnvelopeBody> for ProtoEnvelope<Content>where
Content: Decode,
impl<Content> TryFrom<ProtoEnvelopeBody> for ProtoEnvelope<Content>where
Content: Decode,
impl<Contents: Eq> Eq for ProtoEnvelope<Contents>
impl<Contents> StructuralPartialEq for ProtoEnvelope<Contents>
Auto Trait Implementations§
impl<Contents> Freeze for ProtoEnvelope<Contents>where
Contents: Freeze,
impl<Contents> RefUnwindSafe for ProtoEnvelope<Contents>where
Contents: RefUnwindSafe,
impl<Contents> Send for ProtoEnvelope<Contents>where
Contents: Send,
impl<Contents> Sync for ProtoEnvelope<Contents>where
Contents: Sync,
impl<Contents> Unpin for ProtoEnvelope<Contents>where
Contents: Unpin,
impl<Contents> UnwindSafe for ProtoEnvelope<Contents>where
Contents: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.