use core::borrow::Borrow; use super::*; /// A type category for values lent out by Unimock. #[doc(hidden)] pub struct Lending(core::marker::PhantomData T>); impl Kind for Lending { type Return = Lent; } impl Return for Lending { type Type = Box + Send + Sync>; } impl IntoReturnOnce> for T0 where T0: Borrow + Send + Sync + 'static, { fn into_return_once(self) -> OutputResult> { Ok(Lent(Box::new(self))) } } impl IntoReturn> for T0 where T0: Borrow + Send + Sync + 'static, { fn into_return(self) -> OutputResult> { Ok(Lent(Box::new(self))) } } pub struct Lent(Box + Send + Sync>); impl GetOutput for Lent { type Output<'u> = &'u T where Self: 'u; fn output(&self) -> Option> { Some(self.0.as_ref().borrow()) } }