pub(crate) where we can

This commit is contained in:
Martin Algesten
2018-12-20 11:08:20 +01:00
parent 1519dcb0b1
commit 07fd4d2cd5
7 changed files with 23 additions and 21 deletions

View File

@@ -18,11 +18,11 @@ mod simple;
type RequestHandler = Fn(&Unit) -> Result<Stream, Error> + Send + 'static;
lazy_static! {
pub static ref TEST_HANDLERS: Arc<Mutex<HashMap<String, Box<RequestHandler>>>> =
pub(crate) static ref TEST_HANDLERS: Arc<Mutex<HashMap<String, Box<RequestHandler>>>> =
{ Arc::new(Mutex::new(HashMap::new())) };
}
pub fn set_handler<H>(path: &str, handler: H)
pub(crate) fn set_handler<H>(path: &str, handler: H)
where
H: Fn(&Unit) -> Result<Stream, Error> + Send + 'static,
{
@@ -48,7 +48,7 @@ pub fn make_response(
Ok(Stream::Test(Box::new(cursor), write))
}
pub fn resolve_handler(unit: &Unit) -> Result<Stream, Error> {
pub(crate) fn resolve_handler(unit: &Unit) -> Result<Stream, Error> {
let mut handlers = TEST_HANDLERS.lock().unwrap();
let path = unit.url.path();
let handler = handlers.remove(path).unwrap();