pub struct PayloadRaw<T, C> {
pub value: Arc<Vec<u8>>,
pub neuron: Arc<dyn Neuron<T, C> + Send + Sync>,
pub trace: TraceContext,
}Expand description
A type-erased raw payload containing bytes, its associated neuron, and tracing context.
§Examples
let payload = PayloadRaw::new(vec![1, 2, 3], neuron);
assert_eq!(*payload.value, vec![1, 2, 3]);Fields§
§value: Arc<Vec<u8>>§neuron: Arc<dyn Neuron<T, C> + Send + Sync>§trace: TraceContextImplementations§
Source§impl<T, C> PayloadRaw<T, C>
impl<T, C> PayloadRaw<T, C>
pub fn from_parts( value: Arc<Vec<u8>>, neuron: Arc<dyn Neuron<T, C> + Send + Sync>, trace: TraceContext, ) -> Self
Sourcepub fn with_correlation(
value: Vec<u8>,
neuron: Arc<dyn Neuron<T, C> + Send + Sync>,
correlation_id: Option<Uuid>,
) -> Arc<Self>
pub fn with_correlation( value: Vec<u8>, neuron: Arc<dyn Neuron<T, C> + Send + Sync>, correlation_id: Option<Uuid>, ) -> Arc<Self>
Helper to create a new PayloadRaw with default tracing fields (new span_id, no parent_id). Used when initiating a new signal where payload is already raw bytes.
Sourcepub fn new(
value: Vec<u8>,
neuron: Arc<dyn Neuron<T, C> + Send + Sync>,
) -> Arc<Self>
pub fn new( value: Vec<u8>, neuron: Arc<dyn Neuron<T, C> + Send + Sync>, ) -> Arc<Self>
§Examples
let ns = Arc::new(NamespaceImpl { delimiter: ".", parts: vec!["test"] });
let neuron = Arc::new(NeuronImpl::<Dummy, Dummy>::new(ns));
let raw_data = vec![1, 2, 3];
let payload = PayloadRaw::new(raw_data.clone(), neuron);
assert_eq!(*payload.value, raw_data);pub fn correlation_id(&self) -> Uuid
pub fn span_id(&self) -> u64
pub fn parent_id(&self) -> Option<u64>
Trait Implementations§
Source§impl<T, C> LogTrace for PayloadRaw<T, C>
impl<T, C> LogTrace for PayloadRaw<T, C>
fn correlation_id(&self) -> Uuid
fn span_id(&self) -> u64
fn parent_id(&self) -> Option<u64>
fn neuron_name(&self) -> String
Source§fn trace_context(&self) -> TraceContext
fn trace_context(&self) -> TraceContext
Returns the full trace context.
Source§fn span_info(&self, name: &'static str) -> Span
fn span_info(&self, name: &'static str) -> Span
Returns a tracing span with the tracing fields attached at INFO level.
Source§fn span_debug(&self, name: &'static str) -> Span
fn span_debug(&self, name: &'static str) -> Span
Returns a tracing span with the tracing fields attached at DEBUG level.
Auto Trait Implementations§
impl<T, C> Freeze for PayloadRaw<T, C>
impl<T, C> !RefUnwindSafe for PayloadRaw<T, C>
impl<T, C> Send for PayloadRaw<T, C>
impl<T, C> Sync for PayloadRaw<T, C>
impl<T, C> Unpin for PayloadRaw<T, C>
impl<T, C> !UnwindSafe for PayloadRaw<T, 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
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 more