pub enum SysmemAllocation {
Pending,
WaitingForSync {
future: QueryResponseFut<()>,
token_fn: Option<Box<dyn FnOnce() + Send + Sync>>,
buffer_collection: BufferCollectionProxy,
},
WaitingForAllocation(QueryResponseFut<BufferCollectionWaitForAllBuffersAllocatedResult>, BufferCollectionProxy),
Done(Result<(), Error>),
}
Expand description
A Future that communicates with the fuchsia.sysmem2.Allocator
service to allocate shared
buffers.
Variants§
Pending
WaitingForSync
Waiting for the Sync response from the Allocator
Fields
buffer_collection: BufferCollectionProxy
WaitingForAllocation(QueryResponseFut<BufferCollectionWaitForAllBuffersAllocatedResult>, BufferCollectionProxy)
Waiting for the buffers to be allocated, which should eventually happen after delivering the token.
Done(Result<(), Error>)
Allocation is completed. The result here represents whether it completed successfully or an error.
Implementations§
Source§impl SysmemAllocation
impl SysmemAllocation
Sourcepub fn pending() -> Self
pub fn pending() -> Self
A pending allocation which has not been started, and will never finish.
Sourcepub fn allocate<F: FnOnce(ClientEnd<BufferCollectionTokenMarker>) + 'static + Send + Sync>(
allocator: AllocatorProxy,
name: BufferName<'_>,
debug_info: Option<AllocatorDebugInfo>,
constraints: BufferCollectionConstraints,
token_target_fn: F,
) -> Result<Self, Error>
pub fn allocate<F: FnOnce(ClientEnd<BufferCollectionTokenMarker>) + 'static + Send + Sync>( allocator: AllocatorProxy, name: BufferName<'_>, debug_info: Option<AllocatorDebugInfo>, constraints: BufferCollectionConstraints, token_target_fn: F, ) -> Result<Self, Error>
Allocate a new shared memory collection, using allocator
to communicate with the Allocator
service. constraints
will be used to allocate the collection. A shared collection token
client end will be provided to the token_target_fn
once the request has been synced with
the collection. This token can be used with SysmemAllocation::shared
to finish allocating
the shared buffers or provided to another service to share allocation, or duplicated to
share this memory with more than one other client.
Sourcepub fn bind(
allocator: AllocatorProxy,
token: ClientEnd<BufferCollectionTokenMarker>,
constraints: BufferCollectionConstraints,
) -> Result<Self, Error>
pub fn bind( allocator: AllocatorProxy, token: ClientEnd<BufferCollectionTokenMarker>, constraints: BufferCollectionConstraints, ) -> Result<Self, Error>
Bind to a shared memory collection, using allocator
to communicate with the Allocator
service and a token
which has already been allocated. constraints
is set to communicate
the requirements of this client.
Trait Implementations§
Source§impl FusedFuture for SysmemAllocation
impl FusedFuture for SysmemAllocation
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 SysmemAllocation
impl Future for SysmemAllocation
Auto Trait Implementations§
impl Freeze for SysmemAllocation
impl !RefUnwindSafe for SysmemAllocation
impl Send for SysmemAllocation
impl Sync for SysmemAllocation
impl Unpin for SysmemAllocation
impl !UnwindSafe for SysmemAllocation
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
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read more§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
§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 more§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read more§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>>
§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,
§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 = ()
>.§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
>.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<F> TimeoutExt for Fwhere
F: Future,
impl<F> TimeoutExt for Fwhere
F: Future,
§fn on_timeout<WT, OT>(self, time: WT, on_timeout: OT) -> OnTimeout<Self, OT>
fn on_timeout<WT, OT>(self, time: WT, on_timeout: OT) -> OnTimeout<Self, OT>
on_timeout
to produce a result
when the timeout occurs.§fn on_stalled<OS>(
self,
timeout: Duration,
on_stalled: OS,
) -> OnStalled<Self, OS>
fn on_stalled<OS>( self, timeout: Duration, on_stalled: OS, ) -> OnStalled<Self, OS>
on_stalled
to produce a result
when the future hasn’t been otherwise polled within the timeout
.
This is a heuristic - spurious wakeups will keep the detection from triggering,
and moving all work to external tasks or threads with force the triggering early.§impl<F, T, E> TryFuture for F
impl<F, T, E> TryFuture for F
§impl<Fut> TryFutureExt for Futwhere
Fut: TryFuture + ?Sized,
impl<Fut> TryFutureExt for Futwhere
Fut: TryFuture + ?Sized,
§fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>where
Self::Ok: Sink<Item, Error = Self::Error>,
Self: Sized,
fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>where
Self::Ok: Sink<Item, Error = Self::Error>,
Self: Sized,
Sink
]. Read more