pub struct MessageContext {
pub source_name: Arc<Name>,
pub destination_name: Option<Arc<Name>>,
pub payload_type: String,
pub metadata: HashMap<String, String>,
pub input_connection: u64,
pub identity: String,
}Expand description
Generic message context for language bindings (UniFFI-compatible)
Provides routing and descriptive metadata needed for replying, auditing, and instrumentation across different language bindings. This type is exported to foreign languages via UniFFI.
Fields§
§source_name: Arc<Name>Fully-qualified sender identity
destination_name: Option<Arc<Name>>Fully-qualified destination identity (may be empty for broadcast/group scenarios)
payload_type: StringLogical/semantic type (defaults to “msg” if unspecified)
metadata: HashMap<String, String>Arbitrary key/value pairs supplied by the sender (e.g. tracing IDs)
input_connection: u64Numeric identifier of the inbound connection carrying the message
identity: StringIdentity contained in the message
Implementations§
Source§impl MessageContext
impl MessageContext
Sourcepub fn new(
source: Name,
destination: Option<Name>,
payload_type: String,
metadata: HashMap<String, String>,
input_connection: u64,
identity: String,
) -> Self
pub fn new( source: Name, destination: Option<Name>, payload_type: String, metadata: HashMap<String, String>, input_connection: u64, identity: String, ) -> Self
Create a new MessageContext
Sourcepub fn source_as_slim_name(&self) -> SlimName
pub fn source_as_slim_name(&self) -> SlimName
Get the source name as a SlimName (for internal use)
Sourcepub fn from_proto_message(
msg: ProtoMessage,
) -> Result<(Self, Vec<u8>), SessionError>
pub fn from_proto_message( msg: ProtoMessage, ) -> Result<(Self, Vec<u8>), SessionError>
Build a MessageContext plus the raw payload bytes from a low-level
ProtoMessage. Returns an error if the message type is unsupported
(i.e. not a publish payload).
On success:
- The context captures source/destination identities
payload_typedefaults to “msg” if unsetmetadatais copied from the underlying protocol envelope- The returned
Vec<u8>is the raw application payload
Trait Implementations§
Source§impl Clone for MessageContext
impl Clone for MessageContext
Source§fn clone(&self) -> MessageContext
fn clone(&self) -> MessageContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<UT> ConvertError<UT> for MessageContext
impl<UT> ConvertError<UT> for MessageContext
fn try_convert_unexpected_callback_error( e: UnexpectedUniFFICallbackError, ) -> Result<Self>
Source§impl Debug for MessageContext
impl Debug for MessageContext
Source§impl<UT> FfiConverter<UT> for MessageContext
impl<UT> FfiConverter<UT> for MessageContext
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Source§type FfiType = RustBuffer
type FfiType = RustBuffer
Source§fn lower(v: Self) -> RustBuffer
fn lower(v: Self) -> RustBuffer
Source§fn try_lift(buf: RustBuffer) -> Result<Self>
fn try_lift(buf: RustBuffer) -> Result<Self>
Source§impl<UT> Lift<UT> for MessageContext
impl<UT> Lift<UT> for MessageContext
Source§impl<UT> LiftRef<UT> for MessageContext
impl<UT> LiftRef<UT> for MessageContext
type LiftType = MessageContext
Source§impl<UT> LiftReturn<UT> for MessageContext
impl<UT> LiftReturn<UT> for MessageContext
Source§type ReturnType = <MessageContext as Lift<UT>>::FfiType
type ReturnType = <MessageContext as Lift<UT>>::FfiType
Source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
Source§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus,
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self
Source§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
Source§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Source§impl<UT> Lower<UT> for MessageContext
impl<UT> Lower<UT> for MessageContext
type FfiType = <MessageContext as FfiConverter<UT>>::FfiType
fn lower(obj: Self) -> Self::FfiType
fn write(obj: Self, buf: &mut Vec<u8>)
Source§fn lower_into_rust_buffer(obj: Self) -> RustBuffer
fn lower_into_rust_buffer(obj: Self) -> RustBuffer
Source§impl<UT> LowerError<UT> for MessageContext
impl<UT> LowerError<UT> for MessageContext
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for MessageContext
impl<UT> LowerReturn<UT> for MessageContext
Source§type ReturnType = <MessageContext as Lower<UT>>::FfiType
type ReturnType = <MessageContext as Lower<UT>>::FfiType
Source§fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl PartialEq for MessageContext
impl PartialEq for MessageContext
Source§fn eq(&self, other: &MessageContext) -> bool
fn eq(&self, other: &MessageContext) -> bool
self and other values to be equal, and is used by ==.Source§impl<UT> TypeId<UT> for MessageContext
impl<UT> TypeId<UT> for MessageContext
impl StructuralPartialEq for MessageContext
Auto Trait Implementations§
impl Freeze for MessageContext
impl RefUnwindSafe for MessageContext
impl Send for MessageContext
impl Sync for MessageContext
impl Unpin for MessageContext
impl UnsafeUnpin for MessageContext
impl UnwindSafe for MessageContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request