pub enum CheckpointResult<T, E> {
Ok(T),
Err(E),
}Expand description
Represent the checkpointed outcome of a durable step operation.
Unlike std::result::Result, both the success and error values in a
CheckpointResult are valid, serialized checkpoint data. A step that
returns an error still has that error checkpointed and replayed
identically on subsequent invocations.
§Type Parameters
T— The success value type. Must implementSerialize + DeserializeOwned.E— The error value type. Must implementSerialize + DeserializeOwned.
§Examples
use durable_lambda_core::types::CheckpointResult;
// A successful checkpoint result.
let ok: CheckpointResult<i32, String> = CheckpointResult::Ok(42);
assert_eq!(ok, CheckpointResult::Ok(42));
// An error checkpoint result — the error is also checkpointed.
let err: CheckpointResult<i32, String> = CheckpointResult::Err("validation failed".into());
// Both variants serialize to JSON for checkpoint storage.
let json = serde_json::to_string(&ok).unwrap();
let deserialized: CheckpointResult<i32, String> = serde_json::from_str(&json).unwrap();
assert_eq!(deserialized, CheckpointResult::Ok(42));Variants§
Ok(T)
The step completed successfully with this value.
Err(E)
The step returned an error, which is also checkpointed.
Trait Implementations§
Source§impl<T, E> Clone for CheckpointResult<T, E>
impl<T, E> Clone for CheckpointResult<T, E>
Source§fn clone(&self) -> CheckpointResult<T, E>
fn clone(&self) -> CheckpointResult<T, E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, E> Debug for CheckpointResult<T, E>
impl<T, E> Debug for CheckpointResult<T, E>
Source§impl<'de, T, E> Deserialize<'de> for CheckpointResult<T, E>where
T: Deserialize<'de>,
E: Deserialize<'de>,
impl<'de, T, E> Deserialize<'de> for CheckpointResult<T, E>where
T: Deserialize<'de>,
E: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CheckpointResult<T, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CheckpointResult<T, E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T, E> PartialEq for CheckpointResult<T, E>
impl<T, E> PartialEq for CheckpointResult<T, E>
Source§impl<T, E> Serialize for CheckpointResult<T, E>
impl<T, E> Serialize for CheckpointResult<T, E>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T, E> StructuralPartialEq for CheckpointResult<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for CheckpointResult<T, E>
impl<T, E> RefUnwindSafe for CheckpointResult<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for CheckpointResult<T, E>
impl<T, E> Sync for CheckpointResult<T, E>
impl<T, E> Unpin for CheckpointResult<T, E>
impl<T, E> UnsafeUnpin for CheckpointResult<T, E>where
T: UnsafeUnpin,
E: UnsafeUnpin,
impl<T, E> UnwindSafe for CheckpointResult<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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
impl<B> IntoFunctionResponse<B, Body> for Bwhere
B: Serialize,
Source§fn into_response(self) -> FunctionResponse<B, Body>
fn into_response(self) -> FunctionResponse<B, Body>
Convert the type into a FunctionResponse.
Creates a shared type from an unshared type.