ezrosent / allocators-rs

Allocators in Rust
Apache License 2.0
311 stars 28 forks source link

alloc-fmt: Implement unwrap and expect #162

Closed joshlf closed 6 years ago

joshlf commented 6 years ago

We use the unwrap and expect methods on Option and Result a lot, and these panic on failure. This causes problems for debugging just as explicit panics/assertion failures do. Thus, we should add unwrap and expect implementations to alloc-fmt that use alloc-fmt's panic so that we can use them in a global-allocator-safe manner.

Probably the easiest way to do this is to have a trait with default impls for Option and Result with alloc_unwrap and alloc_expect methods. That way, we'd only need to import this trait in order to add those methods to Option and Result.

joshlf commented 6 years ago

Closed by #163.