diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 9a15440239..bcd41aa760 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -563,9 +563,12 @@ impl FromStr for RpcModuleSelection { type Err = ParseError; fn from_str(s: &str) -> Result { - 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::().unwrap(); + assert_eq!(selection, RpcModuleSelection::All); + } + #[test] fn identical_selection() { assert!(RpcModuleSelection::are_identical(