fix Boxed types

This commit is contained in:
Jessie
2023-09-22 03:25:30 -04:00
parent ac89ef0821
commit c06670e72b
3 changed files with 45 additions and 10 deletions

View File

@@ -8,15 +8,14 @@ use alloc::format;
use alloc::string::String;
use core::fmt::{Debug, Display, Formatter};
use core::any::Any;
use crate::autotraits::{NotAnything, NotNothing};
mod autotraits;
// ==============================
// Anything
// ==============================
auto trait NotAnything {}
impl !NotAnything for Anything {}
pub struct Anything {
error: Box<dyn DynError>,
@@ -118,12 +117,11 @@ impl<T: Any + NotAnything + Debug > DynError for T {
}
}
// ==============================
// Anything
// Nothing
// ==============================
auto trait NotNothing {}
impl !NotNothing for Nothing {}
#[derive(Debug)]
pub struct Nothing;
@@ -131,4 +129,3 @@ pub struct Nothing;
impl<T: NotNothing> From<T> for Nothing {
fn from(_: T) -> Self { Nothing }
}