forked from Orchid/orchid
Cut down on macro nonsense
- InertAtomic replaced atomic_inert! for improved tooling support - atomic_defaults! is easier to type out than to explain in a docstring - Changed rustfmt config to better support tiny functions such as as_any
This commit is contained in:
@@ -18,9 +18,7 @@ pub struct Interner {
|
||||
}
|
||||
impl Interner {
|
||||
/// Create a new interner
|
||||
pub fn new() -> Self {
|
||||
Self { interners: RefCell::new(HashMap::new()) }
|
||||
}
|
||||
pub fn new() -> Self { Self { interners: RefCell::new(HashMap::new()) } }
|
||||
|
||||
/// Intern something
|
||||
pub fn i<Q: ?Sized + Eq + Hash + ToOwned>(&self, q: &Q) -> Tok<Q::Owned>
|
||||
@@ -62,9 +60,7 @@ impl Interner {
|
||||
}
|
||||
|
||||
impl Default for Interner {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
fn default() -> Self { Self::new() }
|
||||
}
|
||||
|
||||
/// Get or create an interner for a given type.
|
||||
|
||||
@@ -27,9 +27,7 @@ impl<T: Eq + Hash + Clone + 'static> Tok<T> {
|
||||
.expect("Pointer can always be cast to nonzero")
|
||||
}
|
||||
/// Cast into usize
|
||||
pub fn usize(&self) -> usize {
|
||||
self.id().into()
|
||||
}
|
||||
pub fn usize(&self) -> usize { self.id().into() }
|
||||
///
|
||||
pub fn assert_comparable(&self, other: &Self) {
|
||||
let iref = self.interner.as_ptr() as usize;
|
||||
@@ -50,9 +48,7 @@ impl<T: Eq + Hash + Clone + 'static> Tok<Vec<Tok<T>>> {
|
||||
impl<T: Eq + Hash + Clone + 'static> Deref for Tok<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.data.as_ref()
|
||||
}
|
||||
fn deref(&self) -> &Self::Target { self.data.as_ref() }
|
||||
}
|
||||
|
||||
impl<T: Eq + Hash + Clone + 'static + Debug> Debug for Tok<T> {
|
||||
|
||||
Reference in New Issue
Block a user