pub struct ContextInternal { /* private fields */ }
Expand description
Internal context interface.
For the high level interfaces, look at crate::context
.
Implementations§
Source§impl ContextInternal
impl ContextInternal
pub fn service_name(&self) -> &str
pub fn handler_name(&self) -> &str
pub fn input<T: Deserialize>(&self) -> impl Future<Output = (T, InputMetadata)>
pub fn get<T: Deserialize>( &self, key: &str, ) -> impl Future<Output = Result<Option<T>, TerminalError>> + Send
pub fn get_keys( &self, ) -> impl Future<Output = Result<Vec<String>, TerminalError>> + Send
pub fn set<T: Serialize>(&self, key: &str, t: T)
pub fn clear(&self, key: &str)
pub fn clear_all(&self)
pub fn select( &self, handles: Vec<NotificationHandle>, ) -> impl Future<Output = Result<usize, TerminalError>> + Send
pub fn sleep( &self, sleep_duration: Duration, ) -> impl DurableFuture<Output = Result<(), TerminalError>> + Send
pub fn request<Req, Res>( &self, request_target: RequestTarget, req: Req, ) -> Request<'_, Req, Res>
pub fn call<Req: Serialize, Res: Deserialize>( &self, request_target: RequestTarget, idempotency_key: Option<String>, headers: Vec<(String, String)>, req: Req, ) -> impl CallFuture<Response = Res> + Send
pub fn send<Req: Serialize>( &self, request_target: RequestTarget, idempotency_key: Option<String>, headers: Vec<(String, String)>, req: Req, delay: Option<Duration>, ) -> impl InvocationHandle
pub fn invocation_handle(&self, invocation_id: String) -> impl InvocationHandle
pub fn awakeable<T: Deserialize>( &self, ) -> (String, impl DurableFuture<Output = Result<T, TerminalError>> + Send)
pub fn resolve_awakeable<T: Serialize>(&self, id: &str, t: T)
pub fn reject_awakeable(&self, id: &str, failure: TerminalError)
pub fn promise<T: Deserialize>( &self, name: &str, ) -> impl DurableFuture<Output = Result<T, TerminalError>> + Send
pub fn peek_promise<T: Deserialize>( &self, name: &str, ) -> impl Future<Output = Result<Option<T>, TerminalError>> + Send
pub fn resolve_promise<T: Serialize>(&self, name: &str, t: T)
pub fn reject_promise(&self, id: &str, failure: TerminalError)
pub fn run<'a, Run, Fut, Out>(
&'a self,
run_closure: Run,
) -> impl RunFuture<Result<Out, TerminalError>> + Send + 'awhere
Run: RunClosure<Fut = Fut, Output = Out> + Send + 'a,
Fut: Future<Output = HandlerResult<Out>> + Send + 'a,
Out: Serialize + Deserialize + 'static,
pub fn handle_handler_result<T: Serialize>(&self, res: HandlerResult<T>)
pub fn end(&self)
Trait Implementations§
Source§impl Clone for ContextInternal
impl Clone for ContextInternal
Source§fn clone(&self) -> ContextInternal
fn clone(&self) -> ContextInternal
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ContextInternal
impl RefUnwindSafe for ContextInternal
impl Send for ContextInternal
impl Sync for ContextInternal
impl Unpin for ContextInternal
impl UnwindSafe for ContextInternal
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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