-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from DuskSystems/storage
Remove storage abstraction for now.
- Loading branch information
Showing
14 changed files
with
180 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::id::RouteId; | ||
use core::{ | ||
hash::{BuildHasherDefault, Hasher}, | ||
marker::PhantomData, | ||
}; | ||
use hashbrown::HashMap; | ||
|
||
pub type RouteMap<V> = HashMap<RouteId, V, BuildHasherDefault<NoHashHasher<RouteId>>>; | ||
|
||
pub struct NoHashHasher<T>(u64, PhantomData<T>); | ||
|
||
impl<T> Default for NoHashHasher<T> { | ||
fn default() -> Self { | ||
Self(0, PhantomData) | ||
} | ||
} | ||
|
||
impl<T> Hasher for NoHashHasher<T> { | ||
fn write(&mut self, _: &[u8]) { | ||
panic!("Invalid use of NoHashHasher") | ||
} | ||
|
||
fn write_usize(&mut self, n: usize) { | ||
self.0 = n as u64; | ||
} | ||
|
||
fn finish(&self) -> u64 { | ||
self.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.