pub struct ResultRegion<T, E> { /* private fields */ }
Expand description
A region to hold Result
s.
§Examples
Add results to a result region:
use flatcontainer::{RegionPreference, Push, Region, ResultRegion};
let mut r =
<ResultRegion<<() as RegionPreference>::Region, <String as RegionPreference>::Region>>::default();
let ok_index = r.push(Result::<(), String>::Ok(()));
let err_index = r.push(Result::<(), String>::Err("Error".to_string()));
assert_eq!(Ok(()), r.index(ok_index));
assert_eq!(Err("Error"), r.index(err_index));
Trait Implementations§
Source§impl<T: Default, E: Default> Default for ResultRegion<T, E>
impl<T: Default, E: Default> Default for ResultRegion<T, E>
Source§fn default() -> ResultRegion<T, E>
fn default() -> ResultRegion<T, E>
Returns the “default value” for a type. Read more
Source§impl<'de, T, E> Deserialize<'de> for ResultRegion<T, E>where
T: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, T, E> Deserialize<'de> for ResultRegion<T, E>where
T: Deserialize<'de>,
E: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, T: 'a, TC, E: 'a, EC> Push<&'a Result<T, E>> for ResultRegion<TC, EC>
impl<'a, T: 'a, TC, E: 'a, EC> Push<&'a Result<T, E>> for ResultRegion<TC, EC>
Source§impl<T, TC, E, EC> Push<Result<T, E>> for ResultRegion<TC, EC>
impl<T, TC, E, EC> Push<Result<T, E>> for ResultRegion<TC, EC>
Source§impl<T, E> Region for ResultRegion<T, E>
impl<T, E> Region for ResultRegion<T, E>
Source§type Owned = Result<<T as Region>::Owned, <E as Region>::Owned>
type Owned = Result<<T as Region>::Owned, <E as Region>::Owned>
An owned type that can be constructed from a read item.
Source§type ReadItem<'a> = Result<<T as Region>::ReadItem<'a>, <E as Region>::ReadItem<'a>>
where
Self: 'a
type ReadItem<'a> = Result<<T as Region>::ReadItem<'a>, <E as Region>::ReadItem<'a>> where Self: 'a
The type of the data that one gets out of the container.
Source§type Index = Result<<T as Region>::Index, <E as Region>::Index>
type Index = Result<<T as Region>::Index, <E as Region>::Index>
The type to index into the container. Should be treated
as an opaque type, even if known.
Source§fn merge_regions<'a>(regions: impl Iterator<Item = &'a Self> + Clone) -> Selfwhere
Self: 'a,
fn merge_regions<'a>(regions: impl Iterator<Item = &'a Self> + Clone) -> Selfwhere
Self: 'a,
Construct a region that can absorb the contents of
regions
in the future.Source§fn index(&self, index: Self::Index) -> Self::ReadItem<'_>
fn index(&self, index: Self::Index) -> Self::ReadItem<'_>
Index into the container. The index must be obtained by
pushing data into the container.
Source§fn reserve_regions<'a, I>(&mut self, regions: I)
fn reserve_regions<'a, I>(&mut self, regions: I)
Ensure that the region can absorb the items of
regions
without reallocationSource§impl<'a, T: 'a, TC, E: 'a, EC> ReserveItems<&'a Result<T, E>> for ResultRegion<TC, EC>
impl<'a, T: 'a, TC, E: 'a, EC> ReserveItems<&'a Result<T, E>> for ResultRegion<TC, EC>
Source§impl<T, TC, E, EC> ReserveItems<Result<T, E>> for ResultRegion<TC, EC>
impl<T, TC, E, EC> ReserveItems<Result<T, E>> for ResultRegion<TC, EC>
Auto Trait Implementations§
impl<T, E> Freeze for ResultRegion<T, E>
impl<T, E> RefUnwindSafe for ResultRegion<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for ResultRegion<T, E>
impl<T, E> Sync for ResultRegion<T, E>
impl<T, E> Unpin for ResultRegion<T, E>
impl<T, E> UnwindSafe for ResultRegion<T, E>where
T: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)