Impl io::error::repr_bitpacked::Repr::new
that accepts `ErrorData<Box<Custom>>` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
d11ff2a06e
commit
1713e25a41
@ -132,6 +132,15 @@ unsafe impl Send for Repr {}
|
||||
unsafe impl Sync for Repr {}
|
||||
|
||||
impl Repr {
|
||||
pub(super) fn new(dat: ErrorData<Box<Custom>>) -> Self {
|
||||
match dat {
|
||||
ErrorData::Os(code) => Self::new_os(code),
|
||||
ErrorData::Simple(kind) => Self::new_simple(kind),
|
||||
ErrorData::SimpleMessage(simple_message) => Self::new_simple_message(simple_message),
|
||||
ErrorData::Custom(b) => Self::new_custom(b),
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn new_custom(b: Box<Custom>) -> Self {
|
||||
let p = Box::into_raw(b).cast::<u8>();
|
||||
// Should only be possible if an allocator handed out a pointer with
|
||||
|
Loading…
Reference in New Issue
Block a user