From aaa7a3eac4df0de9a93dc8fc4717d38212a3de5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Aug 2019 15:35:03 +0200 Subject: [PATCH] use BTreeMap for ResourceTable (#2721) --- cli/resources.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/resources.rs b/cli/resources.rs index 67061efe72..c796465ea2 100644 --- a/cli/resources.rs +++ b/cli/resources.rs @@ -24,7 +24,7 @@ use futures::Sink; use futures::Stream; use hyper; use std; -use std::collections::HashMap; +use std::collections::BTreeMap; use std::io::{Error, Read, Seek, SeekFrom, Write}; use std::net::{Shutdown, SocketAddr}; use std::process::ExitStatus; @@ -41,7 +41,7 @@ pub type ResourceId = u32; // Sometimes referred to RID. // These store Deno's file descriptors. These are not necessarily the operating // system ones. -type ResourceTable = HashMap; +type ResourceTable = BTreeMap; #[cfg(not(windows))] use std::os::unix::io::FromRawFd; @@ -56,7 +56,7 @@ lazy_static! { // Starts at 3 because stdio is [0-2]. static ref NEXT_RID: AtomicUsize = AtomicUsize::new(3); static ref RESOURCE_TABLE: Mutex = Mutex::new({ - let mut m = HashMap::new(); + let mut m = BTreeMap::new(); // TODO Load these lazily during lookup? m.insert(0, Repr::Stdin(tokio::io::stdin()));