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:
@@ -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