mirror of
https://github.com/servo/servo.git
synced 2025-07-01 04:23:39 +01:00
Move to components/hashglobe
This commit is contained in:
parent
ed0fa304fc
commit
5d3115fa8e
11 changed files with 0 additions and 0 deletions
36
components/hashglobe/src/lib.rs
Normal file
36
components/hashglobe/src/lib.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
pub use std::*;
|
||||
|
||||
mod table;
|
||||
mod shim;
|
||||
mod alloc;
|
||||
pub mod hash_map;
|
||||
pub mod hash_set;
|
||||
|
||||
pub mod fake;
|
||||
|
||||
use std::{error, fmt};
|
||||
|
||||
trait Recover<Q: ?Sized> {
|
||||
type Key;
|
||||
|
||||
fn get(&self, key: &Q) -> Option<&Self::Key>;
|
||||
fn take(&mut self, key: &Q) -> Option<Self::Key>;
|
||||
fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FailedAllocationError {
|
||||
reason: &'static str,
|
||||
}
|
||||
|
||||
impl error::Error for FailedAllocationError {
|
||||
fn description(&self) -> &str {
|
||||
self.reason
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for FailedAllocationError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.reason.fmt(f)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue