mod basic_wrapper;
mod threaded_wrapper;
use std::fmt::Debug;
use std::ops::DerefMut;
use crate::IsBar;
pub use basic_wrapper::BarWrapper;
pub use threaded_wrapper::ThreadedBarWrapper;
#[allow(clippy::module_name_repetitions)]
#[cfg(not(feature = "nightly"))]
pub trait IsBarWrapper: crate::sealant::Sealed {
type Bar: IsBar;
type Error: Debug;
fn try_bar<'b>(&'b mut self)
-> Result<Box<dyn DerefMut<Target = Self::Bar> + 'b>, Self::Error>;
fn bar<'b>(&'b mut self) -> Box<dyn DerefMut<Target = Self::Bar> + 'b> {
self.try_bar().unwrap()
}
}
#[allow(clippy::module_name_repetitions)]
#[cfg(feature = "nightly")]
pub trait IsBarWrapper: crate::sealant::Sealed {
type Bar: IsBar;
type Error: Debug;
type BarGuard<'g>: DerefMut<Target = Self::Bar>
where
Self: 'g;
fn try_bar<'g>(&'g mut self) -> Result<Self::BarGuard<'g>, Self::Error>;
fn bar<'g>(&'g mut self) -> Self::BarGuard<'g> {
self.try_bar().unwrap()
}
}