ready and err methods added to Loadable impl
@@ -33,6 +33,20 @@ impl<R, E> Loadable<R, E> {
}
}
#[inline]
+ pub fn ready(self) -> Option<R> {
+ match self {
+ Loadable::Ready(r) => Some(r),
+ _ => None,
+ }
+ }
+ #[inline]
+ pub fn err(self) -> Option<E> {
+ match self {
+ Loadable::Err(e) => Some(e),
+ _ => None,
+ }
+ }
+ #[inline]
pub fn expect(self, msg: &str) -> R {
match self {
Self::Ready(r) => r,
