Feature gate: #![feature(thin_box)]
This is a tracking issue for ThinBox for making heap allocated DSTs which only occupy 1 pointer on the stack.
Public API
Note: This API is expected to grow to match Box as necessary over time. The initial API is the minimum needed for basic usage for error handling.
pub struct ThinBox<T: ?Sized> { /* ... */ }
impl<T> ThinBox<T> {
pub fn new(value: T) -> Self;
}
impl<Dyn: ?Sized> ThinBox<Dyn> {
pub fn new_unsize<T>(value: T) -> Self
where
T: Unsize<Dyn>;
}
impl<T: ?Sized + Debug> Debug for ThinBox<T> { /* ... */ }
impl<T: ?Sized + Display> Display for ThinBox<T> { /* ... */ }
impl<T: ?Sized + Error> Error for ThinBox<T> { /* ... */ }
impl<T: ?Sized> Deref for ThinBox<T> { type Target = T; /* ... */ }
impl<T: ?Sized> DerefMut for ThinBox<T> { /* ... */ }
impl<T: ?Sized> Drop for ThinBox<T> { /* ... */ }
unsafe impl<T: ?Sized + Send> Send for ThinBox<T> {}
unsafe impl<T: ?Sized + Sync> Sync for ThinBox<T> {}
Steps / History
Unresolved Questions
- Can ThinBox be made covariant? (comment)
- Is
const_allocate fleshed out and tested enough to justify it being used in thinbox's impl? Does T-lang agree we'll always have some way to procedurally generate allocations in const eval? (in contrast to declaratively via constants, statics or anonymous promoteds)
Feature gate:
#![feature(thin_box)]This is a tracking issue for
ThinBoxfor making heap allocated DSTs which only occupy 1 pointer on the stack.Public API
Note: This API is expected to grow to match
Boxas necessary over time. The initial API is the minimum needed for basic usage for error handling.Steps / History
SendandSync: ImplementSendandSyncforThinBox<T>#98595Unresolved Questions
ThinBox<T>covariant inT#98585const_allocatefleshed out and tested enough to justify it being used in thinbox's impl? Does T-lang agree we'll always have some way to procedurally generate allocations in const eval? (in contrast to declaratively via constants, statics or anonymous promoteds)