use crate::encoding::{ errors::EncodingError, models::{EncodingContext, Swap}, }; pub trait SwapEncoder: Sync + Send { fn new(executor_address: String) -> Self where Self: Sized; fn encode_swap( &self, swap: Swap, encoding_context: EncodingContext, ) -> Result, EncodingError>; fn executor_address(&self) -> &str; fn executor_selector(&self) -> &str; /// Clones the swap encoder as a trait object. /// This allows the encoder to be cloned when it is being used as a `Box`. fn clone_box(&self) -> Box; } impl Clone for Box { fn clone(&self) -> Box { self.clone_box() } }