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 + Sync
pub fn get_keys( &self, ) -> impl Future<Output = Result<Vec<String>, TerminalError>> + Send + Sync
pub fn set<T: Serialize>(&self, key: &str, t: T)
pub fn clear(&self, key: &str)
pub fn clear_all(&self)
pub fn sleep( &self, duration: Duration, ) -> impl Future<Output = Result<(), TerminalError>> + Send + Sync
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, req: Req, ) -> impl Future<Output = Result<Res, TerminalError>> + Send + Sync
pub fn send<Req: Serialize>( &self, request_target: RequestTarget, req: Req, delay: Option<Duration>, )
pub fn awakeable<T: Deserialize>( &self, ) -> (String, impl Future<Output = Result<T, TerminalError>> + Send + Sync)
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 Future<Output = Result<T, TerminalError>> + Send + Sync
pub fn peek_promise<T: Deserialize>( &self, name: &str, ) -> impl Future<Output = Result<Option<T>, TerminalError>> + Send + Sync
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 copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
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