pub fn try_box<T>(value: T) -> Result<Box<T>, T>Expand description
Move value into a new heap allocation, or hand it back if the global
allocator is exhausted.
The stable equivalent of the unstable Box::try_new. On Err(value) the
caller still owns value and decides how to dispose of it — for a backend
handle, dropping it undeclares the entity the backend just created, which
is what keeps a failed create from leaking a half-registered entity.
A zero-sized T never allocates and always succeeds, exactly as
Box::new does.