Skip to main content

ResourceRequestHandle

Struct ResourceRequestHandle 

Source
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

Source

pub fn id(&self) -> u64

Returns the native handle value.

Source§

impl ResourceRequestHandle

Source

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::InvalidState when the library cancelled the request.
Source

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.

Source

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::InvalidState when the library cancelled the request.
Source

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.

Source

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§

Source§

impl Debug for ResourceRequestHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.