Skip to main content

Proxiable

Trait Proxiable 

Source
pub trait Proxiable<Tag = ()> {
    type Proxy;

    // Required methods
    fn encode_proxy(&self) -> Self::Proxy;
    fn decode_proxy(
        &mut self,
        proxy: Self::Proxy,
    ) -> Result<(), DecodeErrorKind>;
}
Expand description

Implement this trait to make a type supported for encoding by proxy; this can be thought of like a special pair of Into and TryFrom implementations that are dedicated to this proxy specification and are used every time this type is encoded or decoded, since that is essentially exactly what happens.

Required Associated Types§

Source

type Proxy

The type that the value should appear as when it is encoded on the wire.

Required Methods§

Source

fn encode_proxy(&self) -> Self::Proxy

Convert this value into a value of the proxy’s type.

Source

fn decode_proxy(&mut self, proxy: Self::Proxy) -> Result<(), DecodeErrorKind>

Try to store the value represented in the proxy’s type in this value, returning an error if the value is not valid (ideally the error should be OutOfDomainValue, InvalidValue, or Other).

Implementors§