pub struct BridgeContext3<T>where
T: 'static,{ /* private fields */ }
Expand description
Async operation context for bridging rust code into SF COM api that supports cancellation.
Implementations§
source§impl<T> BridgeContext3<T>where
T: Send,
impl<T> BridgeContext3<T>where
T: Send,
sourcepub fn make(
callback: Option<&IFabricAsyncOperationCallback>,
) -> (Self, CancellationToken)
pub fn make( callback: Option<&IFabricAsyncOperationCallback>, ) -> (Self, CancellationToken)
Creates the context from callback, and returns a cancellation token that can be used in rust code, and the cancellation token is hooked into self, where Cancel() api cancels the operation.
sourcepub fn spawn<F>(
self,
rt: &impl Executor,
future: F,
) -> Result<IFabricAsyncOperationContext>
pub fn spawn<F>( self, rt: &impl Executor, future: F, ) -> Result<IFabricAsyncOperationContext>
Spawns the future on rt. Returns a context that can be returned to SF runtime. This is intended to be used in SF Begin COM api, where rust code is spawned in background and the context is returned to caller. This api is in some sense unsafe, because the developer needs to ensure the following:
- return type of the future needs to match SF COM api end return type.
sourcepub fn result(context: Option<&IFabricAsyncOperationContext>) -> Result<T>
pub fn result(context: Option<&IFabricAsyncOperationContext>) -> Result<T>
Get the result from the context from the SF End COM api. This api is in some sense unsafe, because the developer needs to ensure the following:
- context impl type is
BridgeContext3
, and the T matches the SF end api return type. Note that if T is of Resulttype, the current function return type is Result<Result >, so unwrap is needed.
Trait Implementations§
source§impl<T> AsImpl<BridgeContext3<T>> for IFabricAsyncOperationContextwhere
T: 'static,
impl<T> AsImpl<BridgeContext3<T>> for IFabricAsyncOperationContextwhere
T: 'static,
source§impl<T> AsImpl<BridgeContext3<T>> for IUnknownwhere
T: 'static,
impl<T> AsImpl<BridgeContext3<T>> for IUnknownwhere
T: 'static,
source§impl<T> ComObjectInner for BridgeContext3<T>where
T: 'static,
impl<T> ComObjectInner for BridgeContext3<T>where
T: 'static,
source§type Outer = BridgeContext3_Impl<T>
type Outer = BridgeContext3_Impl<T>
The generated
<foo>_Impl
type (aka the “boxed” type or “outer” type).source§fn into_object(self) -> ComObject<Self>
fn into_object(self) -> ComObject<Self>
Moves an instance of this type into a new ComObject box and returns it. Read more
source§impl<T> From<BridgeContext3<T>> for IFabricAsyncOperationContextwhere
T: 'static,
impl<T> From<BridgeContext3<T>> for IFabricAsyncOperationContextwhere
T: 'static,
source§fn from(this: BridgeContext3<T>) -> Self
fn from(this: BridgeContext3<T>) -> Self
Converts to this type from the input type.
source§impl<T> From<BridgeContext3<T>> for IInspectablewhere
T: 'static,
impl<T> From<BridgeContext3<T>> for IInspectablewhere
T: 'static,
source§fn from(this: BridgeContext3<T>) -> Self
fn from(this: BridgeContext3<T>) -> Self
Converts to this type from the input type.
source§impl<T> From<BridgeContext3<T>> for IUnknownwhere
T: 'static,
impl<T> From<BridgeContext3<T>> for IUnknownwhere
T: 'static,
source§fn from(this: BridgeContext3<T>) -> Self
fn from(this: BridgeContext3<T>) -> Self
Converts to this type from the input type.
source§impl<T> IFabricAsyncOperationContext_Impl for BridgeContext3<T>
impl<T> IFabricAsyncOperationContext_Impl for BridgeContext3<T>
Auto Trait Implementations§
impl<T> !Freeze for BridgeContext3<T>
impl<T> !RefUnwindSafe for BridgeContext3<T>
impl<T> Send for BridgeContext3<T>where
T: Send,
impl<T> !Sync for BridgeContext3<T>
impl<T> Unpin for BridgeContext3<T>where
T: Unpin,
impl<T> UnwindSafe for BridgeContext3<T>where
T: UnwindSafe,
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