[−][src]Struct dsf_core::wire::Container
Container object provides base field accessors over an arbitrary (mutable or immutable) buffers See https://lab.whitequark.org/notes/2016-12-13/abstracting-over-mutability-in-rust/ for details
Methods
impl<'a, T: AsRef<[u8]>> Container<T>
[src]
pub fn from(buff: T) -> (Self, usize)
[src]
Create a new container object from an existing buffer This parses the header and splits the data into fields to simplify access
pub fn protocol_version(&self) -> Kind
[src]
pub fn application_id(&self) -> u16
[src]
pub fn kind(&self) -> Kind
[src]
pub fn flags(&self) -> Flags
[src]
pub fn index(&self) -> u16
[src]
pub fn data_len(&self) -> usize
[src]
pub fn private_options_len(&self) -> usize
[src]
pub fn public_options_len(&self) -> usize
[src]
pub fn id(&self) -> &[u8]
[src]
pub fn body(&self) -> &[u8]
[src]
Return the body of data
pub fn private_options(&self) -> &[u8]
[src]
Return the private options section data
pub fn public_options(&self) -> impl Iterator<Item = Options> + '_
[src]
Return the public options section data
pub fn signed(&self) -> &[u8]
[src]
Return the signed portion of the message for signing or verification
pub fn signature(&self) -> &[u8]
[src]
Return the signature portion of the message for verification
pub fn len(&self) -> usize
[src]
pub fn verify<V, E>(&self, verifier: V) -> Result<bool, E> where
V: FnMut(&Id, &Signature, &[u8]) -> Result<bool, E>,
[src]
V: FnMut(&Id, &Signature, &[u8]) -> Result<bool, E>,
Verify the contents of a given container This calls the provided verifier with the id, body, and signature and forwards the result to the caller
pub fn raw(&self) -> &[u8]
[src]
impl<'a, T: AsRef<[u8]>> Container<T>
[src]
pub fn parse<P, S>(
data: T,
pub_key_s: P,
sec_key_s: S
) -> Result<(Base, usize), BaseError> where
P: FnMut(&Id) -> Option<PublicKey>,
S: FnMut(&Id) -> Option<SecretKey>,
[src]
data: T,
pub_key_s: P,
sec_key_s: S
) -> Result<(Base, usize), BaseError> where
P: FnMut(&Id) -> Option<PublicKey>,
S: FnMut(&Id) -> Option<SecretKey>,
Parses a data array into a base object using the pub_key and sec_key functions to locate keys for validation and decyption
impl<'a, T: AsRef<[u8]> + AsMut<[u8]>> Container<T>
[src]
pub fn encode(
buff: T,
base: &Base,
signing_key: &PrivateKey,
encryption_key: Option<&SecretKey>
) -> (Self, usize)
[src]
buff: T,
base: &Base,
signing_key: &PrivateKey,
encryption_key: Option<&SecretKey>
) -> (Self, usize)
Encode a a higher level base object into a container using the provided buffer This encodes the base object into the buff and constructs a container from this encoded object
Trait Implementations
impl<T: Clone + AsRef<[u8]>> Clone for Container<T>
[src]
impl<T: PartialEq + AsRef<[u8]>> PartialEq<Container<T>> for Container<T>
[src]
impl<T: Debug + AsRef<[u8]>> Debug for Container<T>
[src]
impl<T: AsRef<[u8]>> StructuralPartialEq for Container<T>
[src]
Auto Trait Implementations
impl<T> Send for Container<T> where
T: Send,
T: Send,
impl<T> Sync for Container<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Container<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Container<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Container<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,