pub struct MessageContext { /* private fields */ }Expand description
Context of currently processing incoming message.
Implementations§
Source§impl MessageContext
impl MessageContext
Sourcepub fn new(
dispatch: IncomingDispatch,
program_id: ActorId,
settings: ContextSettings,
) -> MessageContext
pub fn new( dispatch: IncomingDispatch, program_id: ActorId, settings: ContextSettings, ) -> MessageContext
Create new message context.
Returns None if outgoing messages bytes limit exceeded.
Sourcepub fn settings(&self) -> &ContextSettings
pub fn settings(&self) -> &ContextSettings
Getter for inner settings.
Sourcepub fn kind(&self) -> DispatchKind
pub fn kind(&self) -> DispatchKind
Getter for inner dispatch kind
Sourcepub fn reply_sent(&self) -> bool
pub fn reply_sent(&self) -> bool
Return bool defining was reply sent within the execution.
Sourcepub fn init_program(
&mut self,
packet: InitPacket,
delay: u32,
) -> Result<(MessageId, ActorId), MessageError>
pub fn init_program( &mut self, packet: InitPacket, delay: u32, ) -> Result<(MessageId, ActorId), MessageError>
Send a new program initialization message.
Generates a new message from provided data packet. Returns message id and generated program id.
Sourcepub fn send_commit(
&mut self,
handle: u32,
packet: HandlePacket,
delay: u32,
reservation: Option<ReservationId>,
) -> Result<MessageId, MessageError>
pub fn send_commit( &mut self, handle: u32, packet: HandlePacket, delay: u32, reservation: Option<ReservationId>, ) -> Result<MessageId, MessageError>
Send a new program initialization message.
Generates message from provided data packet and stored by handle payload. Returns message id.
Sourcepub fn send_init(&mut self) -> Result<u32, MessageError>
pub fn send_init(&mut self) -> Result<u32, MessageError>
Provide space for storing payload for future message creation.
Returns it’s handle.
Sourcepub fn send_push(
&mut self,
handle: u32,
buffer: &[u8],
) -> Result<(), MessageError>
pub fn send_push( &mut self, handle: u32, buffer: &[u8], ) -> Result<(), MessageError>
Pushes payload into stored payload by handle.
Sourcepub fn send_push_input(
&mut self,
handle: u32,
range: CheckedRange,
) -> Result<(), MessageError>
pub fn send_push_input( &mut self, handle: u32, range: CheckedRange, ) -> Result<(), MessageError>
Pushes the incoming buffer/payload into stored payload by handle.
Sourcepub fn check_input_range(
&self,
offset: u32,
len: u32,
) -> Result<CheckedRange, MessageError>
pub fn check_input_range( &self, offset: u32, len: u32, ) -> Result<CheckedRange, MessageError>
Check if provided offset/len are correct for the current payload
limits. Result CheckedRange instance is accepted by
send_push_input/reply_push_input and has the method len
allowing to charge gas before the calls.
Sourcepub fn reply_commit(
&mut self,
packet: ReplyPacket,
reservation: Option<ReservationId>,
) -> Result<MessageId, ExtError>
pub fn reply_commit( &mut self, packet: ReplyPacket, reservation: Option<ReservationId>, ) -> Result<MessageId, ExtError>
Send reply message.
Generates reply from provided data packet and stored reply payload. Returns message id.
Sourcepub fn reply_push(&mut self, buffer: &[u8]) -> Result<(), ExtError>
pub fn reply_push(&mut self, buffer: &[u8]) -> Result<(), ExtError>
Pushes payload into stored reply payload.
Sourcepub fn reply_destination(&self) -> ActorId
pub fn reply_destination(&self) -> ActorId
Return reply destination.
Sourcepub fn reply_push_input(&mut self, range: CheckedRange) -> Result<(), ExtError>
pub fn reply_push_input(&mut self, range: CheckedRange) -> Result<(), ExtError>
Pushes the incoming message buffer into stored reply payload.
Sourcepub fn wake(
&mut self,
waker_id: MessageId,
delay: u32,
) -> Result<(), MessageError>
pub fn wake( &mut self, waker_id: MessageId, delay: u32, ) -> Result<(), MessageError>
Wake message by it’s message id.
Sourcepub fn reply_deposit(
&mut self,
message_id: MessageId,
amount: u64,
) -> Result<(), MessageError>
pub fn reply_deposit( &mut self, message_id: MessageId, amount: u64, ) -> Result<(), MessageError>
Create deposit to handle future reply on message id was sent.
Sourcepub fn current(&self) -> &IncomingMessage
pub fn current(&self) -> &IncomingMessage
Current processing incoming message.
Sourcepub fn program_id(&self) -> ActorId
pub fn program_id(&self) -> ActorId
Current program’s id.
Sourcepub fn drain(self) -> (ContextOutcome, ContextStore)
pub fn drain(self) -> (ContextOutcome, ContextStore)
Destructs context after execution and returns provided outcome and store.
Trait Implementations§
Source§impl Clone for MessageContext
impl Clone for MessageContext
Source§fn clone(&self) -> MessageContext
fn clone(&self) -> MessageContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MessageContext
impl RefUnwindSafe for MessageContext
impl Send for MessageContext
impl Sync for MessageContext
impl Unpin for MessageContext
impl UnwindSafe for MessageContext
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> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moreSource§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.