pub enum BatchResult<C = GenerationContinuation> {
Succeeded {
custom_id: String,
output: Box<GenerateResponse<C>>,
},
Failed {
custom_id: String,
error: RemoteFailure,
},
Cancelled {
custom_id: String,
},
Expired {
custom_id: String,
},
}Expand description
One terminal batch row.
Variants§
Succeeded
A row completed successfully.
Fields
§
output: Box<GenerateResponse<C>>Normalized generation output.
Failed
A row failed.
Fields
§
error: RemoteFailureProvider-authored row failure with explicitly accessed native evidence.
Cancelled
A row was cancelled.
Expired
A row expired before completion.
Implementations§
Source§impl<C> BatchResult<C>
impl<C> BatchResult<C>
Sourcepub fn try_map_continuation<D>(
self,
map: impl FnMut(C) -> Result<D, KitError>,
) -> Result<BatchResult<D>, KitError>
pub fn try_map_continuation<D>( self, map: impl FnMut(C) -> Result<D, KitError>, ) -> Result<BatchResult<D>, KitError>
Maps continuation state carried by a successful row.
§Errors
Returns the mapping error for a successful row continuation. Failure, cancellation, and expiration rows retain their exact correlation and evidence.
§Examples
use providers_kit::batch::BatchResult;
let row: BatchResult<()> = BatchResult::Cancelled { custom_id: "row-1".into() };
let mapped: BatchResult<String> = row.try_map_continuation(|()| Ok("state".into()))?;
assert!(matches!(mapped, BatchResult::Cancelled { custom_id } if custom_id == "row-1"));
Trait Implementations§
Source§impl<C: Clone> Clone for BatchResult<C>
impl<C: Clone> Clone for BatchResult<C>
Source§impl<C: Debug> Debug for BatchResult<C>
impl<C: Debug> Debug for BatchResult<C>
Source§impl<'de, C> Deserialize<'de> for BatchResult<C>
impl<'de, C> Deserialize<'de> for BatchResult<C>
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<C: PartialEq> PartialEq for BatchResult<C>
impl<C: PartialEq> PartialEq for BatchResult<C>
Source§impl<C> Serialize for BatchResult<C>
impl<C> Serialize for BatchResult<C>
impl<C: PartialEq> StructuralPartialEq for BatchResult<C>
Auto Trait Implementations§
impl<C> Freeze for BatchResult<C>
impl<C> RefUnwindSafe for BatchResult<C>
impl<C> Send for BatchResult<C>
impl<C> Sync for BatchResult<C>
impl<C> Unpin for BatchResult<C>
impl<C> UnsafeUnpin for BatchResult<C>
impl<C> UnwindSafe for BatchResult<C>
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