docs: More docs and improvements of existing docs
- Tried not to leave a single public function undocumented, though did not double-document public function with obvious names - Remove all mentions of the strategy selector in favour of the strategy registry (to avoid confusion)
This commit is contained in:
@@ -4,6 +4,7 @@ use crate::encoding::{
|
||||
swap_encoder::SwapEncoder,
|
||||
};
|
||||
|
||||
/// Builds a `SwapEncoder` for the given protocol system and executor address.
|
||||
pub struct SwapEncoderBuilder {
|
||||
protocol_system: String,
|
||||
executor_address: String,
|
||||
|
||||
@@ -7,12 +7,16 @@ use crate::encoding::{
|
||||
swap_encoder::SwapEncoder,
|
||||
};
|
||||
|
||||
/// Registry containing all supported `SwapEncoders`.
|
||||
#[derive(Clone)]
|
||||
pub struct SwapEncoderRegistry {
|
||||
/// A hashmap containing the protocol system as a key and the `SwapEncoder` as a value.
|
||||
encoders: HashMap<String, Box<dyn SwapEncoder>>,
|
||||
}
|
||||
|
||||
impl SwapEncoderRegistry {
|
||||
/// Populates the registry with the `SwapEncoders` for the given blockchain by parsing the
|
||||
/// executors in the file at the given path.
|
||||
pub fn new(executors_file_path: &str, blockchain: Chain) -> Result<Self, EncodingError> {
|
||||
let config_str = fs::read_to_string(executors_file_path)?;
|
||||
let config: HashMap<Chain, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
||||
|
||||
Reference in New Issue
Block a user