Struct warg_protocol::ProtoEnvelope
source · 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 copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
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
This method 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<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.