mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 09:38:24 -05:00
feat: support all alias (#3660)
This commit is contained in:
@@ -563,9 +563,12 @@ impl FromStr for RpcModuleSelection {
|
||||
type Err = ParseError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let modules = s.split(',');
|
||||
|
||||
RpcModuleSelection::try_from_selection(modules)
|
||||
let mut modules = s.split(',').peekable();
|
||||
let first = modules.peek().copied().ok_or(ParseError::VariantNotFound)?;
|
||||
match first {
|
||||
"all" | "All" => Ok(RpcModuleSelection::All),
|
||||
_ => RpcModuleSelection::try_from_selection(modules),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1667,6 +1670,12 @@ impl fmt::Debug for RpcServerHandle {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parse_rpc_module_selection() {
|
||||
let selection = "all".parse::<RpcModuleSelection>().unwrap();
|
||||
assert_eq!(selection, RpcModuleSelection::All);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn identical_selection() {
|
||||
assert!(RpcModuleSelection::are_identical(
|
||||
|
||||
Reference in New Issue
Block a user