pub fn new<H: Serialize>(
        header: Header<H>,
        payload: Vec<u8>,
    ) -> Result<Self, serde_json::Error> {
        let protected_header_serialized = serialize_header(&header)?;
        let protected_header_registered = header.registered;
        Ok(Self {
            protected_header_registered,
            protected_header_serialized,
            payload,
        })
    }
/// Build a Signable from a header and a payload
///
/// Header and payload will both be protected by the signature,
/// we do not make use of unprotected headers
///
/// # Errors
/// Errors are returned if headers can't be serialized;
/// this would only happen if the `H` type carrying extension headers
/// can not be serialized.
Build a Signable from a header and a payload
Header and payload will both be protected by the signature,
we do not make use of unprotected headers
Build a Signable from a header and a payload Header and payload will both be protected by the signature we do not make use of unprotected headers
pub fn new<H: Serialize>(
        header: Header<H>,
        payload: Vec<u8>,
    ) -> Result<Self, serde_json::Error> {
        let protected_header_serialized = serialize_header(&header)?;
        let protected_header_registered = header.registered;
        Ok(Self {
            protected_header_registered,
            protected_header_serialized,
            payload,
        })
    }
pub fn new < H : Serialize > ( header : Header < H > , payload : Vec < u8 > , ) -> Result < Self , serde_json :: Error > { let protected_header_serialized = serialize_header ( & header ) ? ; let protected_header_registered = header . registered ; Ok ( Self { protected_header_registered , protected_header_serialized , payload , } ) }
Build a Signable from a header and a payload
Header and payload will both be protected by the signature,
we do not make use of unprotected headers
Build a Signable from a header and a payload Header and payload will both be protected by the signature we do not make use of unprotected headers
header
Header<H>
payload
Vec<u8>
header
Header<H>
payload
Vec<u8>
errors
Errors are returned if headers can't be serialized;
this would only happen if the `H` type carrying extension headers
can not be serialized.
Errors are returned if headers can ' t be serialized ; this would only happen if the ` H ` type carrying extension headers can not be serialized .