pub struct ResearchWireEnvelopeV1 {
pub schema: String,
pub version: u16,
pub kind: ResearchWireKindV1,
pub payload: Value,
}Expand description
A strict, versioned envelope carrying one research contract value.
The envelope uses a JSON Value for the payload so the same transport can
cross Node, Python, and Go without requiring those SDKs to instantiate Rust
types. Self::validate immediately decodes the value into the closed
payload type selected by kind, preserving Rust-side validation and
rejecting unknown payload fields.
Fields§
§schema: String§version: u16§kind: ResearchWireKindV1§payload: ValueImplementations§
Source§impl ResearchWireEnvelopeV1
impl ResearchWireEnvelopeV1
Sourcepub fn new(
kind: ResearchWireKindV1,
payload: Value,
) -> Result<Self, ResearchProtocolError>
pub fn new( kind: ResearchWireKindV1, payload: Value, ) -> Result<Self, ResearchProtocolError>
Construct and validate an envelope from an arbitrary JSON payload.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self, ResearchProtocolError>
pub fn from_slice(bytes: &[u8]) -> Result<Self, ResearchProtocolError>
Decode and validate a bounded JSON wire message.
Sourcepub fn from_value(value: Value) -> Result<Self, ResearchProtocolError>
pub fn from_value(value: Value) -> Result<Self, ResearchProtocolError>
Decode and validate a JSON value at the process boundary.
Sourcepub fn to_vec(&self) -> Result<Vec<u8>, ResearchProtocolError>
pub fn to_vec(&self) -> Result<Vec<u8>, ResearchProtocolError>
Encode a validated envelope with the process-boundary size limit.
Sourcepub fn validate(&self) -> Result<(), ResearchProtocolError>
pub fn validate(&self) -> Result<(), ResearchProtocolError>
Validate envelope identity, bounded encoding, and the selected payload.
Sourcepub const fn kind(&self) -> ResearchWireKindV1
pub const fn kind(&self) -> ResearchWireKindV1
Return the payload kind without exposing a second string authority.
Sourcepub fn from_research_event(
payload: ResearchEventV1,
) -> Result<Self, ResearchProtocolError>
pub fn from_research_event( payload: ResearchEventV1, ) -> Result<Self, ResearchProtocolError>
Construct a research-event envelope.
Sourcepub fn from_reproducibility_manifest(
payload: ResearchReproducibilityManifestV1,
) -> Result<Self, ResearchProtocolError>
pub fn from_reproducibility_manifest( payload: ResearchReproducibilityManifestV1, ) -> Result<Self, ResearchProtocolError>
Construct a reproducibility-manifest envelope.
Sourcepub fn payload_as<T>(
&self,
expected: ResearchWireKindV1,
) -> Result<T, ResearchProtocolError>where
T: DeserializeOwned,
pub fn payload_as<T>(
&self,
expected: ResearchWireKindV1,
) -> Result<T, ResearchProtocolError>where
T: DeserializeOwned,
Decode a typed payload after checking that the envelope kind matches.
Trait Implementations§
Source§impl Clone for ResearchWireEnvelopeV1
impl Clone for ResearchWireEnvelopeV1
Source§fn clone(&self) -> ResearchWireEnvelopeV1
fn clone(&self) -> ResearchWireEnvelopeV1
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResearchWireEnvelopeV1
impl Debug for ResearchWireEnvelopeV1
Source§impl<'de> Deserialize<'de> for ResearchWireEnvelopeV1
impl<'de> Deserialize<'de> for ResearchWireEnvelopeV1
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 PartialEq for ResearchWireEnvelopeV1
impl PartialEq for ResearchWireEnvelopeV1
Source§impl Serialize for ResearchWireEnvelopeV1
impl Serialize for ResearchWireEnvelopeV1
impl StructuralPartialEq for ResearchWireEnvelopeV1
Auto Trait Implementations§
impl Freeze for ResearchWireEnvelopeV1
impl RefUnwindSafe for ResearchWireEnvelopeV1
impl Send for ResearchWireEnvelopeV1
impl Sync for ResearchWireEnvelopeV1
impl Unpin for ResearchWireEnvelopeV1
impl UnsafeUnpin for ResearchWireEnvelopeV1
impl UnwindSafe for ResearchWireEnvelopeV1
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
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> ⓘ
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 more