Struct gstd::msg::CreateProgramFuture
source · pub struct CreateProgramFuture {
pub waiting_reply_to: MessageId,
pub program_id: ActorId,
}
Expand description
Async functions that relate to creating programs wait for a reply from the
program’s init function. These functions have the suffix _for_reply
, such
as crate::prog::create_program_bytes_for_reply
.
To get the reply payload (in bytes), one should use .await
syntax. After
calling a corresponding async function, the program interrupts its execution
until a reply arrives.
This future keeps the sent message identifier (MessageId
) to wake the
program after a reply arrives. Also, it keeps an identifier of a newly
created program (ActorId
).
§Examples
The following example explicitly annotates variable types for demonstration purposes only. Usually, annotating them is unnecessary because they can be inferred automatically.
use gstd::{msg::CreateProgramFuture, prog, ActorId};
#[gstd::async_main]
async fn main() {
let future: CreateProgramFuture =
prog::create_program_bytes_for_reply(code_id, b"salt", b"PING", 0, 0)
.expect("Unable to create a program");
let (prog_id, reply): (ActorId, Vec<u8>) = future.await.expect("Unable to get a reply");
}
Fields§
§waiting_reply_to: MessageId
A message identifier for an expected reply.
program_id: ActorId
An identifier of a newly created program.
Implementations§
Trait Implementations§
source§impl FusedFuture for CreateProgramFuture
impl FusedFuture for CreateProgramFuture
source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true
if the underlying future should no longer be polled.source§impl Future for CreateProgramFuture
impl Future for CreateProgramFuture
Auto Trait Implementations§
impl Freeze for CreateProgramFuture
impl RefUnwindSafe for CreateProgramFuture
impl Send for CreateProgramFuture
impl Sync for CreateProgramFuture
impl Unpin for CreateProgramFuture
impl UnwindSafe for CreateProgramFuture
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> FutureExt for T
impl<T> FutureExt for T
source§fn map<U, F>(self, f: F) -> Map<Self, F> ⓘ
fn map<U, F>(self, f: F) -> Map<Self, F> ⓘ
source§fn map_into<U>(self) -> MapInto<Self, U> ⓘ
fn map_into<U>(self) -> MapInto<Self, U> ⓘ
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F> ⓘ
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F> ⓘ
f
. Read moresource§fn left_future<B>(self) -> Either<Self, B> ⓘ
fn left_future<B>(self) -> Either<Self, B> ⓘ
source§fn right_future<A>(self) -> Either<A, Self> ⓘ
fn right_future<A>(self) -> Either<A, Self> ⓘ
source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
source§fn flatten(self) -> Flatten<Self> ⓘ
fn flatten(self) -> Flatten<Self> ⓘ
source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
source§fn fuse(self) -> Fuse<Self> ⓘwhere
Self: Sized,
fn fuse(self) -> Fuse<Self> ⓘwhere
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moresource§fn inspect<F>(self, f: F) -> Inspect<Self, F> ⓘ
fn inspect<F>(self, f: F) -> Inspect<Self, F> ⓘ
source§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
source§fn unit_error(self) -> UnitError<Self> ⓘwhere
Self: Sized,
fn unit_error(self) -> UnitError<Self> ⓘwhere
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.source§fn never_error(self) -> NeverError<Self> ⓘwhere
Self: Sized,
fn never_error(self) -> NeverError<Self> ⓘwhere
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.