pub struct ResourceRequestHandle { /* private fields */ }Expand description
Owns one native handle.
A resource load that a resource provider answers.
See mln_resource_request in the
C API reference.
Implementations§
Source§impl ResourceRequestHandle
impl ResourceRequestHandle
Sourcepub fn complete(self, response: &ResourceResponse<'_>) -> Result<()>
pub fn complete(self, response: &ResourceResponse<'_>) -> Result<()>
Answers a resource request.
A failed answer fails the request with ResourceErrorReason::Other, as
ResourceRequestHandle::release() does.
See mln_resource_request_complete in the
C API reference.
§Errors
Status::InvalidStatewhen the library cancelled the request.
Sourcepub fn is_cancelled(&self) -> Result<bool>
pub fn is_cancelled(&self) -> Result<bool>
Reads whether the library cancelled a resource request.
See mln_resource_request_is_cancelled in the
C API reference.
Sourcepub fn pass_through(self) -> Result<()>
pub fn pass_through(self) -> Result<()>
Hands a resource request back to the library to load as usual.
A failed call fails the request with ResourceErrorReason::Other, as
ResourceRequestHandle::release() does.
See mln_resource_request_pass_through in the
C API reference.
§Errors
Status::InvalidStatewhen the library cancelled the request.
Sourcepub fn release(self) -> Result<(), ReleaseError<Self>>
pub fn release(self) -> Result<(), ReleaseError<Self>>
Releases a resource request.
Releasing a request without an answer fails it with
ResourceErrorReason::Other.
See mln_resource_request_release in the
C API reference.
Sourcepub fn set_cancel_callback(
&self,
handler: ResourceRequestCancelHandler,
) -> Result<bool>
pub fn set_cancel_callback( &self, handler: ResourceRequestCancelHandler, ) -> Result<bool>
Calls a callback when the library cancels a resource request.
The callback never runs after the request is answered. A request takes one cancel callback. When the library has already cancelled the request, the call reports that instead and the callback never runs.
See mln_resource_request_set_cancel_callback in the
C API reference.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResourceRequestHandle
impl RefUnwindSafe for ResourceRequestHandle
impl Send for ResourceRequestHandle
impl Sync for ResourceRequestHandle
impl Unpin for ResourceRequestHandle
impl UnsafeUnpin for ResourceRequestHandle
impl UnwindSafe for ResourceRequestHandle
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> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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