Encode

Trait Encode 

Source
pub trait Encode {
    // Required method
    fn encode(&self) -> Result<String, AcmeError>;
}
Expand description

Trait which marks request/response bodies which can be encoded to string in some fashion.

This is only useful when formatting the response in the ACME-style HTTP format, as used by crate::fmt::AcmeFormat.

There is a blanket implementation provided for any type which implements serde::Serialize, as we assume that serializable values would be sent over the wire as JSON (or at least, it is acceptable to display the value as JSON when printing the ACME server response). Other types can implement this to provide a custom representation when showing an ACME response.

Required Methods§

Source

fn encode(&self) -> Result<String, AcmeError>

Encode the value to a string suitable for an ACME request payload.

Implementors§

Source§

impl<T> Encode for T
where T: Serialize,