Use a BTreeMap for endpoint lookup
This commit is contained in:
parent
f56a4efd1e
commit
ec8afb8c5f
|
@ -8,7 +8,7 @@ use miette::{miette, IntoDiagnostic};
|
|||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::any::Any;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::fmt::Debug;
|
||||
use std::future;
|
||||
use std::future::Future;
|
||||
|
@ -135,15 +135,15 @@ type MagRpcDecoderMapped =
|
|||
dyn (Fn(&'_ [u8]) -> Result<MessageRaw, rmp_serde::decode::Error>) + Send + Sync + 'static;
|
||||
|
||||
pub struct MagRpc {
|
||||
listeners: HashMap<String, Arc<MagRpcHandlerMapped>>,
|
||||
payload_decoders: HashMap<String, Box<MagRpcDecoderMapped>>,
|
||||
listeners: BTreeMap<String, Arc<MagRpcHandlerMapped>>,
|
||||
payload_decoders: BTreeMap<String, Box<MagRpcDecoderMapped>>,
|
||||
}
|
||||
|
||||
impl MagRpc {
|
||||
pub fn new() -> Self {
|
||||
MagRpc {
|
||||
listeners: HashMap::new(),
|
||||
payload_decoders: HashMap::new(),
|
||||
listeners: BTreeMap::new(),
|
||||
payload_decoders: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,8 +410,8 @@ fn process(
|
|||
|
||||
#[derive(Clone)]
|
||||
struct RpcCallDecoder {
|
||||
listeners: Arc<HashMap<String, Arc<MagRpcHandlerMapped>>>,
|
||||
payload_decoders: Arc<HashMap<String, Box<MagRpcDecoderMapped>>>,
|
||||
listeners: Arc<BTreeMap<String, Arc<MagRpcHandlerMapped>>>,
|
||||
payload_decoders: Arc<BTreeMap<String, Box<MagRpcDecoderMapped>>>,
|
||||
}
|
||||
|
||||
impl RpcCallDecoder {
|
||||
|
|
Loading…
Reference in New Issue