pub struct ResourceManager {
pub resource_manager: NonNull<NativeResourceManager>,
}Expand description
Resource Manager
Fields§
§resource_manager: NonNull<NativeResourceManager>Implementations§
Source§impl ResourceManager
impl ResourceManager
Sourcepub fn new(env: Env, resource_manager: Object<'_>) -> Self
pub fn new(env: Env, resource_manager: Object<'_>) -> Self
Use the resource manager from arkts to create a raw file manager. Be aware that none of these methods are thread-safe.
§Example
use napi_derive_ohos::napi;
use napi_ohos::{bindgen_prelude::Object, Env};
use ohos_raw_binding::Raw;
#[napi]
pub fn raw_example(
env: Env,
#[napi(ts_arg_type = "resourceManager.ResourceManager")] resource_manager: Object,
) -> i32 {
let raw_manager = Raw::new(env, resource_manager);
let raw_dir = raw_manager.open_dir("");
let count = raw_dir.count();
count
}pub fn from_raw(raw: *mut NativeResourceManager) -> Self
Sourcepub fn open_dir<S: AsRef<str>>(
&self,
path: S,
recursive: bool,
) -> Result<RawDir, RawFileError>
pub fn open_dir<S: AsRef<str>>( &self, path: S, recursive: bool, ) -> Result<RawDir, RawFileError>
get raw file dirs
pub fn is_raw_dir<S: AsRef<str>>(&self, path: S) -> bool
pub fn drawable_descriptor( &self, id: u32, density: Option<ScreenDensity>, icon_type: Option<IconType>, ) -> Result<*mut *mut ArkUI_DrawableDescriptor, RawFileError>
pub fn drawable_descriptor_by_name( &self, name: String, density: Option<ScreenDensity>, icon_type: Option<IconType>, ) -> Result<*mut *mut ArkUI_DrawableDescriptor, RawFileError>
pub fn media( &self, res_id: u32, density: Option<ScreenDensity>, ) -> Result<Vec<u8>, RawFileError>
pub fn media_base64( &self, res_id: u32, density: Option<ScreenDensity>, ) -> Result<Vec<u8>, RawFileError>
pub fn media_by_name( &self, name: String, density: Option<ScreenDensity>, ) -> Result<Vec<u8>, RawFileError>
pub fn media_base64_by_name( &self, name: String, density: Option<ScreenDensity>, ) -> Result<Vec<u8>, RawFileError>
Trait Implementations§
Source§impl Drop for ResourceManager
impl Drop for ResourceManager
impl Send for ResourceManager
impl Sync for ResourceManager
Auto Trait Implementations§
impl Freeze for ResourceManager
impl RefUnwindSafe for ResourceManager
impl Unpin for ResourceManager
impl UnsafeUnpin for ResourceManager
impl UnwindSafe for ResourceManager
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