harmonize partial strings with complete strings (#276), make Addr a copyable type
This commit is contained in:
@@ -5,7 +5,7 @@ use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
pub(crate) trait RawBlockTraits {
|
||||
fn init_size() -> usize;
|
||||
fn init_size() -> usize;
|
||||
fn align() -> usize;
|
||||
|
||||
#[inline]
|
||||
@@ -36,20 +36,6 @@ impl<T: RawBlockTraits> RawBlock<T> {
|
||||
block
|
||||
}
|
||||
|
||||
pub(crate)
|
||||
fn with_capacity(cap: usize) -> Self {
|
||||
let mut block = RawBlock { size: 0,
|
||||
base: ptr::null(),
|
||||
top: ptr::null(),
|
||||
_marker: PhantomData };
|
||||
|
||||
unsafe {
|
||||
block.init_at_size(cap);
|
||||
}
|
||||
|
||||
block
|
||||
}
|
||||
|
||||
unsafe fn init_at_size(&mut self, cap: usize) {
|
||||
let layout = alloc::Layout::from_size_align_unchecked(cap, T::align());
|
||||
|
||||
@@ -86,7 +72,6 @@ impl<T: RawBlockTraits> RawBlock<T> {
|
||||
mem::replace(self, Self::empty_block())
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
fn free_space(&self) -> usize {
|
||||
debug_assert!(self.top >= self.base,
|
||||
|
||||
Reference in New Issue
Block a user