Struct TESBox

Source
pub struct TESBox<T: ?Sized, A: Allocator = TESGlobalAlloc>(/* private fields */);
Expand description

Heap memory allocation smart pointer that MemoryManager malloc and free trigger by default.

The allocator side is always of type zero size and represents owned *mut ptr. (i.e. size is type ptr)

§Examples

let five = TESBox::new(5);

Implementations§

Source§

impl<T> TESBox<T>

Source

pub fn new(x: T) -> Self

Allocates memory on the heap and then places x into it.

This doesn’t actually allocate if T is zero-sized.

§Examples
let five = TESBox::new(5);
Source

pub fn new_uninit() -> TESBox<MaybeUninit<T>>

Constructs a new box with uninitialized contents.

§Examples
let mut five = TESBox::<u32>::new_uninit();
// Deferred initialization:
five.write(5);
let five = unsafe { five.assume_init() };

assert_eq!(*five, 5)
Source

pub fn try_new(x: T) -> Result<Self, AllocError>

Allocates memory on the heap then places x into it, returning an error if the allocation fails

This doesn’t actually allocate if T is zero-sized.

§Examples

let five = TESBox::try_new(5)?;
Source§

impl<T, A: Allocator> TESBox<T, A>

Source

pub fn new_in(x: T, alloc: A) -> Self
where A: Allocator,

Allocates memory in the given allocator then places x into it.

This doesn’t actually allocate if T is zero-sized.

§Examples

use stdx::alloc::Global;

let five = TESBox::new_in(5, Global);
Source

pub fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError>
where A: Allocator,

Allocates memory in the given allocator then places x into it, returning an error if the allocation fails

This doesn’t actually allocate if T is zero-sized.

§Examples

use stdx::alloc::Global;

let five = TESBox::try_new_in(5, Global)?;
Source

pub fn new_uninit_in(alloc: A) -> TESBox<MaybeUninit<T>, A>
where A: Allocator,

Constructs a new box with uninitialized contents in the provided allocator.

§Examples

use stdx::alloc::Global;

let mut five = TESBox::<u32, _>::new_uninit_in(Global);
// Deferred initialization:
five.write(5);
let five = unsafe { five.assume_init() };

assert_eq!(*five, 5)
Source

pub fn try_new_uninit_in( alloc: A, ) -> Result<TESBox<MaybeUninit<T>, A>, AllocError>
where A: Allocator,

Constructs a new box with uninitialized contents in the provided allocator, returning an error if the allocation fails

§Examples

use stdx::alloc::Global;

let mut five = TESBox::<u32, _>::try_new_uninit_in(Global)?;
// Deferred initialization:
five.write(5);
let five = unsafe { five.assume_init() };

assert_eq!(*five, 5);
Source§

impl<T> TESBox<[T]>

Source

pub fn into_array<const N: usize>(self) -> Option<TESBox<[T; N]>>

Converts the boxed slice into a boxed array.

This operation does not reallocate; the underlying array of the slice is simply reinterpreted as an array type.

If N is not exactly equal to the length of self, then this method returns None.

Source§

impl<T, A: Allocator> TESBox<MaybeUninit<T>, A>

Source

pub unsafe fn assume_init(self) -> TESBox<T, A>

Converts to Box<T, A>.

§Safety

As with MaybeUninit::assume_init, it is up to the caller to guarantee that the value really is in an initialized state. Calling this when the content is not yet fully initialized causes immediate undefined behavior.

§Examples
let mut five = TESBox::<u32>::new_uninit();
// Deferred initialization:
five.write(5);
let five: TESBox<u32> = unsafe { five.assume_init() };

assert_eq!(*five, 5)
Source

pub fn write(boxed: Self, value: T) -> TESBox<T, A>

Writes the value and converts to Box<T, A>.

This method converts the box similarly to Box::assume_init but writes value into it before conversion thus guaranteeing safety. In some scenarios use of this method may improve performance because the compiler may be able to optimize copying from stack.

§Examples

let big_box = TESBox::<[usize; 1024]>::new_uninit();

let mut array = [0; 1024];
for (i, place) in array.iter_mut().enumerate() {
    *place = i;
}

// The optimizer may be able to elide this copy, so previous code writes
// to heap directly.
let big_box = TESBox::write(big_box, array);

for (i, x) in big_box.iter().enumerate() {
    assert_eq!(*x, i);
}
Source§

impl<T: ?Sized> TESBox<T>

Source

pub const unsafe fn from_raw(raw: *mut T) -> Self

Constructs a box from a raw pointer.

After calling this function, the raw pointer is owned by the resulting Box. Specifically, the Box destructor will call the destructor of T and free the allocated memory. For this to be safe, the memory must have been allocated in accordance with the memory layout used by Box .

§Safety

This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.

The raw pointer must point to a block of memory allocated by the global allocator.

The safety conditions are described in the memory layout section.

§Examples

Recreate a Box which was previously converted to a raw pointer using Box::into_raw:

let x = TESBox::new(5);
let ptr = TESBox::into_raw(x);
let x = unsafe { TESBox::from_raw(ptr) };

Manually create a Box from scratch by using the global allocator:

use std::alloc::{alloc, Layout};
use stdx::alloc::{Allocator, Global};
use commonlibsse_ng::re::TESBox::TESBox;

unsafe {
    let ptr = alloc(Layout::new::<i32>()) as *mut i32;
    // In general .write is required to avoid attempting to destruct
    // the (uninitialized) previous contents of `ptr`, though for this
    // simple example `*ptr = 5` would have worked as well.
    ptr.write(5);
    let x = TESBox::from_raw(ptr);
}
Source

pub unsafe fn from_non_null(ptr: NonNull<T>) -> Self

Constructs a box from a NonNull pointer.

After calling this function, the NonNull pointer is owned by the resulting Box. Specifically, the Box destructor will call the destructor of T and free the allocated memory. For this to be safe, the memory must have been allocated in accordance with the memory layout used by Box .

§Safety

This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same NonNull pointer.

The non-null pointer must point to a block of memory allocated by the global allocator.

The safety conditions are described in the memory layout section.

§Examples

Recreate a Box which was previously converted to a NonNull pointer using Box::into_non_null:


let x = TESBox::new(5);
let non_null = TESBox::into_non_null(x);
let x = unsafe { TESBox::from_non_null(non_null) };

Manually create a Box from scratch by using the global allocator:

use stdx::alloc::{Allocator, Global};
use std::alloc::{alloc, Layout};
use std::ptr::NonNull;
use commonlibsse_ng::re::TESBox::TESBox;

unsafe {
    let non_null = NonNull::new(alloc(Layout::new::<i32>()).cast::<i32>())
        .expect("allocation failed");
    // In general .write is required to avoid attempting to destruct
    // the (uninitialized) previous contents of `non_null`.
    non_null.write(5);
    let x = TESBox::from_non_null(non_null);
}
Source§

impl<T: ?Sized, A: Allocator> TESBox<T, A>

Source

pub const unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self

Constructs a box from a raw pointer in the given allocator.

After calling this function, the raw pointer is owned by the resulting Box. Specifically, the Box destructor will call the destructor of T and free the allocated memory. For this to be safe, the memory must have been allocated in accordance with the memory layout used by Box .

§Safety

This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.

The raw pointer must point to a block of memory allocated by alloc.

§Examples

Recreate a Box which was previously converted to a raw pointer using Box::into_raw_with_allocator:


use stdx::alloc::Global;

let x = TESBox::new_in(5, Global);
let (ptr, alloc) = TESBox::into_raw_with_allocator(x);
let x = unsafe { TESBox::from_raw_in(ptr, alloc) };

Manually create a Box from scratch by using the system allocator:


// use std::alloc::Layout;
// use stdx::alloc::{Allocator, Global};
// use commonlibsse_ng::re::TESBox::TESBox;

// unsafe {
//     let ptr = Global.allocate(Layout::new::<i32>())?.as_mut_ptr() as *mut i32;
//     // In general .write is required to avoid attempting to destruct
//     // the (uninitialized) previous contents of `ptr`, though for this
//     // simple example `*ptr = 5` would have worked as well.
//     ptr.write(5);
//     let x = TESBox::from_raw_in(ptr, Global);
// }
// # Ok::<(), stdx::alloc::AllocError>(())
Source

pub const unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Self

Constructs a box from a NonNull pointer in the given allocator.

After calling this function, the NonNull pointer is owned by the resulting Box. Specifically, the Box destructor will call the destructor of T and free the allocated memory. For this to be safe, the memory must have been allocated in accordance with the memory layout used by Box .

§Safety

This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.

The non-null pointer must point to a block of memory allocated by alloc.

§Examples

Recreate a Box which was previously converted to a NonNull pointer using Box::into_non_null_with_allocator:


use stdx::alloc::Global;
use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new_in(5, Global);
let (non_null, alloc) = TESBox::into_non_null_with_allocator(x);
let x = unsafe { TESBox::from_non_null_in(non_null, alloc) };

Manually create a Box from scratch by using the system allocator:

use std::alloc::Layout;
use stdx::alloc::{Allocator, Global};
use commonlibsse_ng::re::TESBox::TESBox;

unsafe {
    let non_null = Global.allocate(Layout::new::<i32>())?.cast::<i32>();
    // In general .write is required to avoid attempting to destruct
    // the (uninitialized) previous contents of `non_null`.
    non_null.write(5);
    let x = TESBox::from_non_null_in(non_null, Global);
}
Source

pub fn into_raw(b: Self) -> *mut T

Consumes the Box, returning a wrapped raw pointer.

The pointer will be properly aligned and non-null.

After calling this function, the caller is responsible for the memory previously managed by the Box. In particular, the caller should properly destroy T and release the memory, taking into account the memory layout used by Box. The easiest way to do this is to convert the raw pointer back into a Box with the Box::from_raw function, allowing the Box destructor to perform the cleanup.

Note: this is an associated function, which means that you have to call it as Box::into_raw(b) instead of b.into_raw(). This is so that there is no conflict with a method on the inner type.

§Examples

Converting the raw pointer back into a Box with Box::from_raw for automatic cleanup:

let x = TESBox::new(String::from("Hello"));
let ptr = TESBox::into_raw(x);
let x = unsafe { TESBox::from_raw(ptr) };

Manual cleanup by explicitly running the destructor and deallocating the memory:

use std::alloc::{dealloc, Layout};
use std::ptr;

let x = TESBox::new(String::from("Hello"));
let ptr = TESBox::into_raw(x);
unsafe {
    ptr::drop_in_place(ptr);
    dealloc(ptr as *mut u8, Layout::new::<String>());
}

Note: This is equivalent to the following:

let x = TESBox::new(String::from("Hello"));
let ptr = TESBox::into_raw(x);
unsafe {
    drop(TESBox::from_raw(ptr));
}
Source

pub fn into_non_null(b: Self) -> NonNull<T>

Consumes the Box, returning a wrapped NonNull pointer.

The pointer will be properly aligned.

After calling this function, the caller is responsible for the memory previously managed by the Box. In particular, the caller should properly destroy T and release the memory, taking into account the memory layout used by Box. The easiest way to do this is to convert the NonNull pointer back into a Box with the Box::from_non_null function, allowing the Box destructor to perform the cleanup.

Note: this is an associated function, which means that you have to call it as Box::into_non_null(b) instead of b.into_non_null(). This is so that there is no conflict with a method on the inner type.

§Examples

Converting the NonNull pointer back into a Box with Box::from_non_null for automatic cleanup:

use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new(String::from("Hello"));
let non_null = TESBox::into_non_null(x);
let x = unsafe { TESBox::from_non_null(non_null) };

Manual cleanup by explicitly running the destructor and deallocating the memory:


use std::alloc::{dealloc, Layout};
use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new(String::from("Hello"));
let non_null = TESBox::into_non_null(x);
unsafe {
    non_null.drop_in_place();
    dealloc(non_null.as_ptr().cast::<u8>(), Layout::new::<String>());
}

Note: This is equivalent to the following:

use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new(String::from("Hello"));
let non_null = TESBox::into_non_null(x);
unsafe {
    drop(TESBox::from_non_null(non_null));
}
Source

pub fn into_raw_with_allocator(b: Self) -> (*mut T, A)

Consumes the Box, returning a wrapped raw pointer and the allocator.

The pointer will be properly aligned and non-null.

After calling this function, the caller is responsible for the memory previously managed by the Box. In particular, the caller should properly destroy T and release the memory, taking into account the memory layout used by Box. The easiest way to do this is to convert the raw pointer back into a Box with the Box::from_raw_in function, allowing the Box destructor to perform the cleanup.

Note: this is an associated function, which means that you have to call it as Box::into_raw_with_allocator(b) instead of b.into_raw_with_allocator(). This is so that there is no conflict with a method on the inner type.

§Examples

Converting the raw pointer back into a Box with Box::from_raw_in for automatic cleanup:


use stdx::alloc::Global;
use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new_in(String::from("Hello"), Global);
let (ptr, alloc) = TESBox::into_raw_with_allocator(x);
let x = unsafe { TESBox::from_raw_in(ptr, alloc) };

Manual cleanup by explicitly running the destructor and deallocating the memory:


use std::alloc::Layout;
use std::ptr::{self, NonNull};
use stdx::alloc::{Allocator, Global};
use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new_in(String::from("Hello"), Global);
let (ptr, alloc) = TESBox::into_raw_with_allocator(x);
unsafe {
    ptr::drop_in_place(ptr);
    let non_null = NonNull::new_unchecked(ptr);
    alloc.deallocate(non_null.cast(), Layout::new::<String>());
}
Source

pub fn into_non_null_with_allocator(b: Self) -> (NonNull<T>, A)

Consumes the TESBox, returning a wrapped NonNull pointer and the allocator.

The pointer will be properly aligned.

After calling this function, the caller is responsible for the memory previously managed by the Box. In particular, the caller should properly destroy T and release the memory, taking into account the memory layout used by TESBox. The easiest way to do this is to convert the NonNull pointer back into a Box with the TESBox::from_non_null_in function, allowing the Box destructor to perform the cleanup.

Note: this is an associated function, which means that you have to call it as Box::into_non_null_with_allocator(b) instead of b.into_non_null_with_allocator(). This is so that there is no conflict with a method on the inner type.

§Examples

Converting the NonNull pointer back into a Box with Box::from_non_null_in for automatic cleanup:


use stdx::alloc::Global;

let x = TESBox::new_in(String::from("Hello"), Global);
let (non_null, alloc) = TESBox::into_non_null_with_allocator(x);
let x = unsafe { TESBox::from_non_null_in(non_null, alloc) };

Manual cleanup by explicitly running the destructor and deallocating the memory:


use stdx::alloc::{Allocator, Global};
use std::alloc::Layout;
use commonlibsse_ng::re::TESBox::TESBox;

let x = TESBox::new_in(String::from("Hello"), Global);
let (non_null, alloc) = TESBox::into_non_null_with_allocator(x);
unsafe {
    non_null.drop_in_place();
    alloc.deallocate(non_null.cast::<u8>(), Layout::new::<String>());
}
Source

pub fn as_mut_ptr(b: &mut Self) -> *mut T

Returns a raw mutable pointer to the Box’s contents.

The caller must ensure that the Box outlives the pointer this function returns, or else it will end up dangling.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying memory, and thus the returned pointer will remain valid when mixed with other calls to as_ptr and as_mut_ptr. Note that calling other methods that materialize references to the memory may still invalidate this pointer. See the example below for how this guarantee can be used.

§Examples

Due to the aliasing guarantee, the following code is legal:

use commonlibsse_ng::re::TESBox::TESBox;

unsafe {
    let mut b = TESBox::new(0);
    let ptr1 = TESBox::as_mut_ptr(&mut b);
    ptr1.write(1);
    let ptr2 = TESBox::as_mut_ptr(&mut b);
    ptr2.write(2);
    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
    ptr1.write(3);
}
Source

pub fn as_ptr(b: &Self) -> *const T

Returns a raw pointer to the Box’s contents.

The caller must ensure that the Box outlives the pointer this function returns, or else it will end up dangling.

The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the Box, use as_mut_ptr.

This method guarantees that for the purpose of the aliasing model, this method does not materialize a reference to the underlying memory, and thus the returned pointer will remain valid when mixed with other calls to as_ptr and as_mut_ptr. Note that calling other methods that materialize mutable references to the memory, as well as writing to this memory, may still invalidate this pointer. See the example below for how this guarantee can be used.

§Examples

Due to the aliasing guarantee, the following code is legal:


unsafe {
    let mut v = TESBox::new(0);
    let ptr1 = TESBox::as_ptr(&v);
    let ptr2 = TESBox::as_mut_ptr(&mut v);
    let _val = ptr2.read();
    // No write to this memory has happened yet, so `ptr1` is still valid.
    let _val = ptr1.read();
    // However, once we do a write...
    ptr2.write(1);
    // ... `ptr1` is no longer valid.
    // This would be UB: let _val = ptr1.read();
}
Source

pub const fn allocator(b: &Self) -> &A

Returns a reference to the underlying allocator.

Note: this is an associated function, which means that you have to call it as Box::allocator(&b) instead of b.allocator(). This is so that there is no conflict with a method on the inner type.

Source

pub fn leak<'a>(b: Self) -> &'a mut T
where A: 'a,

Consumes and leaks the Box, returning a mutable reference, &'a mut T.

Note that the type T must outlive the chosen lifetime 'a. If the type has only static references, or none at all, then this may be chosen to be 'static.

This function is mainly useful for data that lives for the remainder of the program’s life. Dropping the returned reference will cause a memory leak. If this is not acceptable, the reference should first be wrapped with the Box::from_raw function producing a Box. This Box can then be dropped which will properly destroy T and release the allocated memory.

Note: this is an associated function, which means that you have to call it as Box::leak(b) instead of b.leak(). This is so that there is no conflict with a method on the inner type.

§Examples

Simple usage:

let x = TESBox::new(41);
let static_ref: &'static mut usize = TESBox::leak(x);
*static_ref += 1;
assert_eq!(*static_ref, 42);

Unsized data:

// let x = vec![1, 2, 3].into_boxed_slice();
// let static_ref = TESBox::leak(x);
// static_ref[0] = 4;
// assert_eq!(*static_ref, [4, 2, 3]);
// # drop(unsafe { TESBox::from_raw(static_ref) });
Source

pub const fn into_pin(boxed: Self) -> Pin<Self>
where A: 'static,

Converts a TESBox<T> into a Pin<TESBox<T>>. If T does not implement Unpin, then *boxed will be pinned in memory and unable to be moved.

This conversion does not allocate on the heap and happens in place.

This is also available via From.

Constructing and pinning a TESBox with TESBox::into_pin(TESBox::new(x)) can also be written more concisely using [TESBox::pin](x). This into_pin method is useful if you already have a TESBox<T>, or you are constructing a (pinned) TESBox in a different way than with TESBox::new.

§Notes

It’s not recommended that crates add an impl like From<TESBox<T>> for Pin<T>, as it’ll introduce an ambiguity when calling Pin::from. A demonstration of such a poor impl is shown below.

struct Foo; // A type defined in this crate.
impl From<TESBox<()>> for Pin<Foo> {
    fn from(_: TESBox<()>) -> Pin<Foo> {
        Pin::new(Foo)
    }
}

let foo = TESBox::new(());
let bar = Pin::from(foo);

Trait Implementations§

Source§

impl<T: ?Sized, A: Allocator> AsMut<T> for TESBox<T, A>

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: ?Sized, A: Allocator> AsRef<T> for TESBox<T, A>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: ?Sized, A: Allocator> Borrow<T> for TESBox<T, A>

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T: ?Sized, A: Allocator> BorrowMut<T> for TESBox<T, A>

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T: Clone, A: Allocator + Clone> Clone for TESBox<[T], A>

Source§

fn clone_from(&mut self, source: &Self)

Copies source’s contents into self without creating a new allocation, so long as the two are of the same length.

§Examples
let x = TESBox::new([5, 6, 7]);
let mut y = TESBox::new([8, 9, 10]);
let yp: *const [i32] = &*y;

y.clone_from(&x);

// The value is the same
assert_eq!(x, y);

// And no allocation occurred
assert_eq!(yp, &*y);
Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
Source§

impl<T: Clone, A: Allocator + Clone> Clone for TESBox<T, A>

Source§

fn clone(&self) -> Self

Returns a new box with a clone() of this box’s contents.

§Examples
let x = TESBox::new(5);
let y = x.clone();

// The value is the same
assert_eq!(x, y);

// But they are unique objects
assert_ne!(&*x as *const i32, &*y as *const i32);
Source§

fn clone_from(&mut self, source: &Self)

Copies source’s contents into self without creating a new allocation.

§Examples
let x = TESBox::new(5);
let mut y = TESBox::new(10);
let yp: *const i32 = &*y;

y.clone_from(&x);

// The value is the same
assert_eq!(x, y);

// And no allocation occurred
assert_eq!(yp, &*y);
Source§

impl<T: Debug + ?Sized, A: Allocator> Debug for TESBox<T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for TESBox<[T]>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Default> Default for TESBox<T>

Source§

fn default() -> Self

Creates a TESBox<T>, with the Default value for T.

Source§

impl<T: ?Sized, A: Allocator> Deref for TESBox<T, A>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T: ?Sized, A: Allocator> DerefMut for TESBox<T, A>

Source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
Source§

impl<T: Display + ?Sized, A: Allocator> Display for TESBox<T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ?Sized, A: Allocator> Drop for TESBox<T, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<E: Error> Error for TESBox<E>

Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl<T: ?Sized + Hash, A: Allocator> Hash for TESBox<T, A>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: ?Sized + Hasher, A: Allocator> Hasher for TESBox<T, A>

Source§

fn finish(&self) -> u64

Returns the hash value for the values written so far. Read more
Source§

fn write(&mut self, bytes: &[u8])

Writes some data into this Hasher. Read more
Source§

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
Source§

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
Source§

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
Source§

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
Source§

fn write_u128(&mut self, i: u128)

Writes a single u128 into this hasher.
Source§

fn write_usize(&mut self, i: usize)

Writes a single usize into this hasher.
Source§

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
Source§

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
Source§

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
Source§

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
Source§

fn write_i128(&mut self, i: i128)

Writes a single i128 into this hasher.
Source§

fn write_isize(&mut self, i: isize)

Writes a single isize into this hasher.
Source§

fn write_length_prefix(&mut self, len: usize)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a length prefix into this hasher, as part of being prefix-free. Read more
Source§

fn write_str(&mut self, s: &str)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more
Source§

impl<T: ?Sized + Ord, A: Allocator> Ord for TESBox<T, A>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: ?Sized + PartialEq, A: Allocator> PartialEq for TESBox<T, A>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &Self) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for TESBox<T, A>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Self) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Self) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn ge(&self, other: &Self) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

fn gt(&self, other: &Self) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

impl<T: ?Sized, A: Allocator> Pointer for TESBox<T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ?Sized + Eq, A: Allocator> Eq for TESBox<T, A>

Auto Trait Implementations§

§

impl<T, A> Freeze for TESBox<T, A>
where A: Freeze, T: ?Sized,

§

impl<T, A> RefUnwindSafe for TESBox<T, A>

§

impl<T, A> Send for TESBox<T, A>
where A: Send, T: Send + ?Sized,

§

impl<T, A> Sync for TESBox<T, A>
where A: Sync, T: Sync + ?Sized,

§

impl<T, A> Unpin for TESBox<T, A>
where A: Unpin, T: Unpin + ?Sized,

§

impl<T, A> UnwindSafe for TESBox<T, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsErrorSource for T
where T: Error + 'static,

Source§

fn as_error_source(&self) -> &(dyn Error + 'static)

For maximum effectiveness, this needs to be called as a method to benefit from Rust’s automatic dereferencing of method receivers.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Formattable for T
where T: Deref, <T as Deref>::Target: Formattable,

Source§

impl<T> NumBytes for T
where T: Debug + AsRef<[u8]> + AsMut<[u8]> + PartialEq + Eq + PartialOrd + Ord + Hash + Borrow<[u8]> + BorrowMut<[u8]> + ?Sized,

Source§

impl<T> Parsable for T
where T: Deref, <T as Deref>::Target: Parsable,

Source§

impl<T, V> Sliceable<T> for V
where T: Send, V: Send + Sync + AsRef<[T]> + AsMut<[T]>,

Source§

impl<T, V> Sliceable<T> for V
where V: AsRef<[T]> + AsMut<[T]>,