Skip to main content

ResourceRef

Struct ResourceRef 

Source
pub struct ResourceRef<'a> { /* private fields */ }
Expand description

A borrowed reference to a Resource.

This is a non-owning view that can be used for read-only operations. It does NOT call destroy when dropped and should only be used while the underlying Resource is still alive.

Obtained from Tasker::resource().

Implementations§

Source§

impl<'a> ResourceRef<'a>

Source

pub fn loaded(&self) -> bool

Check if resources have been loaded.

Source

pub fn status(&self, id: MaaId) -> MaaStatus

Get the status of a loading operation.

Source

pub fn wait(&self, id: MaaId) -> MaaStatus

Wait for a loading operation to complete.

Source

pub fn hash(&self) -> MaaResult<String>

Get resource hash.

Source

pub fn get_default_recognition_param( &self, reco_type: &str, ) -> MaaResult<Option<Value>>

Get valid default parameters for a recognition type as JSON.

Source

pub fn get_default_action_param( &self, action_type: &str, ) -> MaaResult<Option<Value>>

Get valid default parameters for an action type as JSON.

Source

pub fn node_list(&self) -> MaaResult<Vec<String>>

Get node list.

Source

pub fn get_node_data(&self, node_name: &str) -> MaaResult<Option<String>>

Get node data as JSON string.

Source

pub fn raw(&self) -> *mut MaaResource

Get the raw handle.

Auto Trait Implementations§

§

impl<'a> Freeze for ResourceRef<'a>

§

impl<'a> RefUnwindSafe for ResourceRef<'a>

§

impl<'a> !Send for ResourceRef<'a>

§

impl<'a> !Sync for ResourceRef<'a>

§

impl<'a> Unpin for ResourceRef<'a>

§

impl<'a> UnwindSafe for ResourceRef<'a>

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
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, 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.