127 lines
2.8 KiB
Rust
Executable File
127 lines
2.8 KiB
Rust
Executable File
pub(crate) mod cacheable;
|
|
pub(crate) mod cached_value;
|
|
pub mod capabilities;
|
|
pub mod extern_ref;
|
|
pub mod ffi_array;
|
|
pub mod script;
|
|
pub(crate) mod temporary;
|
|
|
|
pub use capabilities::*;
|
|
|
|
pub(crate) use cacheable::Cacheable;
|
|
pub use script::Script;
|
|
|
|
#[repr(u8)]
|
|
pub enum ScriptCategory {
|
|
Move,
|
|
Ability,
|
|
Status,
|
|
Pokemon,
|
|
Battle,
|
|
Side,
|
|
ItemBattleTrigger,
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! wasm_reference_getters {
|
|
(
|
|
$base_type:ty,
|
|
$(
|
|
$(#[$attr:meta])*
|
|
$v:vis fn $name:ident(&self) -> $type:ty;
|
|
)*
|
|
) => {
|
|
impl $base_type {
|
|
$(
|
|
$(#[$attr])*
|
|
$v fn $name(&self) -> $type {
|
|
paste::paste!{
|
|
unsafe{
|
|
[<$base_type:snake _get_ $name>](self.inner.reference).get_value().unwrap()
|
|
}
|
|
}
|
|
}
|
|
)*
|
|
|
|
}
|
|
|
|
#[cfg(not(feature = "mock_data"))]
|
|
extern "wasm" {
|
|
$(
|
|
paste::paste!{
|
|
fn [<$base_type:snake _get_ $name>](r: ExternRef<$base_type>) -> ExternRef<$type>;
|
|
}
|
|
)*
|
|
}
|
|
};
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! wasm_optional_reference_getters {
|
|
(
|
|
$base_type:ty,
|
|
$(
|
|
$(#[$attr:meta])*
|
|
$v:vis fn $name:ident(&self) -> Option<$type:ty>;
|
|
)*
|
|
) => {
|
|
impl $base_type {
|
|
$(
|
|
$(#[$attr])*
|
|
$v fn $name(&self) -> Option<$type> {
|
|
paste::paste!{
|
|
unsafe{
|
|
[<$base_type:snake _get_ $name>](self.inner.reference).get_value()
|
|
}
|
|
}
|
|
}
|
|
)*
|
|
|
|
}
|
|
|
|
#[cfg(not(feature = "mock_data"))]
|
|
extern "wasm" {
|
|
$(
|
|
paste::paste!{
|
|
fn [<$base_type:snake _get_ $name>](r: ExternRef<$base_type>) -> ExternRef<$type>;
|
|
}
|
|
)*
|
|
}
|
|
};
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! wasm_value_getters {
|
|
(
|
|
$base_type:ty,
|
|
$(
|
|
$(#[$attr:meta])*
|
|
$v:vis fn $name:ident(&self) -> $type:ty;
|
|
)*
|
|
) => {
|
|
#[cfg(not(feature = "mock_data"))]
|
|
impl $base_type {
|
|
$(
|
|
$(#[$attr])*
|
|
$v fn $name(&self) -> $type {
|
|
paste::paste!{
|
|
unsafe{
|
|
[<$base_type:snake _get_ $name>](self.inner.reference)
|
|
}
|
|
}
|
|
}
|
|
)*
|
|
|
|
}
|
|
|
|
#[cfg(not(feature = "mock_data"))]
|
|
extern "wasm" {
|
|
$(
|
|
paste::paste!{
|
|
fn [<$base_type:snake _get_ $name>](r: ExternRef<$base_type>) -> $type;
|
|
}
|
|
)*
|
|
}
|
|
};
|
|
}
|