Struct flatcontainer::impls::result::ResultRegion
source · 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>
§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.
§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.
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)