You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
542 B

use super::*;
use smallbox::{
SmallBox,
space,
smallbox,
};
type OwnedObjectStackSize = space::S4;
/// An object that can be expose serialise+deserialise methods
pub trait Object{
// TODO
}
/// A polymorphic `Object` that is owned.
pub type OwnedObject<'a> = SmallBox<dyn Object + 'a, OwnedObjectStackSize>;
pub trait ObjectExt<'a>: Sized
{
fn into_owned(self) -> OwnedObject<'a>;
}
impl<'a, T: 'a> ObjectExt<'a> for T
where T: Object
{
#[inline] fn into_owned(self) -> OwnedObject<'a> {
smallbox!(self)
}
}