From b94372b149bc60d8e0f6a87705a11830fa1da3f5 Mon Sep 17 00:00:00 2001 From: MrElectrify Date: Sun, 10 Mar 2024 21:33:14 -0700 Subject: [PATCH] Fix `vector_map` layout, bump version to 0.13.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/vector_map.rs | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 016afcf..885868b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,7 +20,7 @@ dependencies = [ [[package]] name = "eastl-rs" -version = "0.12.0" +version = "0.13.0" dependencies = [ "duplicate", "memoffset", diff --git a/Cargo.toml b/Cargo.toml index a43c38b..8ba6459 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "eastl-rs" authors = ["Andrew Buck"] description = "EASTL binary-compatible Rust implementations" documentation = "https://docs.rs/crate/eastl-rs" -version = "0.12.0" +version = "0.13.0" edition = "2021" license-file = "LICENSE" readme = "README.md" diff --git a/src/vector_map.rs b/src/vector_map.rs index b5c811f..d63cc1e 100644 --- a/src/vector_map.rs +++ b/src/vector_map.rs @@ -3,7 +3,6 @@ use crate::compare::{Compare, Less}; use crate::vector::Vector; use std::cmp::Ordering; use std::fmt::{Debug, Formatter}; -use std::marker::PhantomData; use std::ops::Deref; use superslice::Ext; @@ -14,7 +13,7 @@ pub type DefaultVectorMap> = VectorMap = Less> { base: Vector<(K, V), A>, - _phantom: PhantomData, + _compare: C, } impl VectorMap> { @@ -22,7 +21,7 @@ impl VectorMap> pub fn new() -> Self { Self { base: Vector::new(), - _phantom: PhantomData, + _compare: Less::default(), } } @@ -34,12 +33,12 @@ impl VectorMap> pub fn with_capacity(capacity: usize) -> Self { Self { base: Vector::with_capacity(capacity), - _phantom: Default::default(), + _compare: Less::default(), } } } -impl> VectorMap { +impl + Default> VectorMap { /// Returns the capacity of the vector map pub fn capacity(&self) -> usize { self.base.capacity() @@ -149,7 +148,7 @@ impl> VectorMap { pub unsafe fn new_in(allocator: A) -> Self { Self { base: Vector::new_in(allocator), - _phantom: PhantomData, + _compare: C::default(), } } @@ -290,7 +289,7 @@ mod test { fn layout() { assert_eq!( std::mem::size_of::>(), - std::mem::size_of::() * 4 + std::mem::size_of::() * 5 ); }