ark_api_ffi/ffi/resource_v1.rs
1define_api_id!(0x37d7_3b57_d84f_2ea9, "resource-v1");
2
3use crate::FFIResult;
4
5pub type ResourceHandleRepr = u32;
6
7#[ark_api_macros::ark_bindgen(imports = "ark-resource-v1")]
8mod resource {
9 use super::*;
10
11 extern "C" {
12 /// Requests the latest version of a resource given the provided name
13 ///
14 /// This will start downloading the resource if it isn't present in Ark
15 pub fn request_resource_by_name(name: &str) -> ResourceHandleRepr;
16
17 /// Retrieve the handle's data
18 ///
19 /// Returns [`Unavailable`](crate::ErrorCode::Unavailable) if the resource hasn't finished downloading
20 pub fn try_retrieve(resource_handle: ResourceHandleRepr) -> FFIResult<Vec<u8>>;
21
22 /// Check if the resource is available for use
23 ///
24 /// Returns [`Unavailable`](crate::ErrorCode::Unavailable) if the resource hasn't finished downloading
25 pub fn is_ready(resource_handle: ResourceHandleRepr) -> FFIResult<()>;
26 }
27}
28
29pub use resource::*;