hermes-encoding-components 0.1.0

Implementation of an IBC Relayer in Rust, as a library
Documentation
use cgp::core::error::HasErrorType;

use crate::traits::decode::Decoder;
use crate::traits::encode::Encoder;
use crate::traits::types::encoded::HasEncodedType;

pub struct ReturnEncoded;

impl<Encoding, Strategy, Value> Encoder<Encoding, Strategy, Value> for ReturnEncoded
where
    Encoding: HasEncodedType<Encoded = Value> + HasErrorType,
    Value: Clone,
{
    fn encode(_encoding: &Encoding, value: &Value) -> Result<Value, Encoding::Error> {
        Ok(value.clone())
    }
}

impl<Encoding, Strategy, Value> Decoder<Encoding, Strategy, Value> for ReturnEncoded
where
    Encoding: HasEncodedType<Encoded = Value> + HasErrorType,
    Value: Clone,
{
    fn decode(_encoding: &Encoding, value: &Value) -> Result<Value, Encoding::Error> {
        Ok(value.clone())
    }
}