pub struct CodexOkRaw<T, C = HashMap<String, String>> {
pub value: T,
pub location: &'static Location<'static>,
pub execution_meta: C,
}Expand description
Detailed diagnostic information for a successful execution.
CodexOkRaw wraps the underlying success value and automatically captures
the precise file and line number where the success was instantiated.
It also provides a metadata envelope for injecting contextual data
(e.g., execution time, row counts, or process IDs) into the success path.
§Type Parameters
T- The type of the successful value being wrapped.C- The type of the execution metadata. Defaults toHashMap<String, String>for dynamic key-value pairs, but can be replaced with a strongly-typed struct for better observability.
§Fields
value- The underlying success outcome.location- The source code location (file and line) of theCodexOkRawinstantiation. This field is ignored during serialization.execution_meta- A container for diagnostic information associated with the successful execution.
§Examples
use cirious_codex_result::CodexOkRaw;
use std::collections::HashMap;
// Explicitly provide the type to guide the compiler's inference
let result: CodexOkRaw<&str, HashMap<String, String>> = CodexOkRaw::new("Operation complete")
.with_meta("duration_ms", "42")
.with_meta("affected_rows", "5");
assert_eq!(result.value, "Operation complete");
assert_eq!(result.execution_meta.get("duration_ms").unwrap(), "42");Fields§
§value: TThe underlying successful value.
location: &'static Location<'static>The precise location in the source code where this success was created.
execution_meta: CArbitrary key-value metadata associated with this successful execution.
Implementations§
Source§impl<T, C> CodexOkRaw<T, C>
impl<T, C> CodexOkRaw<T, C>
Sourcepub fn new(value: T) -> Selfwhere
C: Default,
pub fn new(value: T) -> Selfwhere
C: Default,
Wraps the result in a success scenario, natively capturing the location.
This method uses the #[track_caller] attribute to ensure that the
location captured is the site where CodexOkRaw::new was called, rather
than the location inside the new function itself.
§Arguments
value- The successful outcome value to be wrapped.
Source§impl<T, S: BuildHasher> CodexOkRaw<T, HashMap<String, String, S>>
impl<T, S: BuildHasher> CodexOkRaw<T, HashMap<String, String, S>>
Sourcepub fn with_meta<K: Into<String>, V: Into<String>>(
self,
key: K,
value: V,
) -> Self
pub fn with_meta<K: Into<String>, V: Into<String>>( self, key: K, value: V, ) -> Self
Injects arbitrary execution metadata into the success envelope.
This method uses a builder-like pattern to allow chainable insertions of diagnostic metadata key-value pairs.
§Arguments
key- The metadata key (e.g.,"duration_ms").value- The string representation of the metadata value.
Trait Implementations§
Source§impl<'de, T, C> Deserialize<'de> for CodexOkRaw<T, C>
impl<'de, T, C> Deserialize<'de> for CodexOkRaw<T, 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>,
Source§impl<T: Display, C> Display for CodexOkRaw<T, C>
impl<T: Display, C> Display for CodexOkRaw<T, C>
Auto Trait Implementations§
impl<T, C> Freeze for CodexOkRaw<T, C>
impl<T, C> RefUnwindSafe for CodexOkRaw<T, C>where
T: RefUnwindSafe,
C: RefUnwindSafe,
impl<T, C> Send for CodexOkRaw<T, C>
impl<T, C> Sync for CodexOkRaw<T, C>
impl<T, C> Unpin for CodexOkRaw<T, C>
impl<T, C> UnsafeUnpin for CodexOkRaw<T, C>where
T: UnsafeUnpin,
C: UnsafeUnpin,
impl<T, C> UnwindSafe for CodexOkRaw<T, C>where
T: UnwindSafe,
C: 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
Source§impl<T> CodexOkWrap for T
impl<T> CodexOkWrap for T
Source§fn into_codex(self) -> CodexOkRaw<T>
fn into_codex(self) -> CodexOkRaw<T>
CodexOkRaw, natively capturing the caller location.