use crate::app_interface::Pokemon; use crate::{ExternRef, ExternalReferenceType}; #[derive(Clone)] pub struct Party { reference: ExternRef, } impl Party { pub fn new(reference: ExternRef) -> Self { Self { reference } } #[cfg(not(feature = "mock_data"))] pub fn get_pokemon(&self, index: usize) -> Option { unsafe { party_get_pokemon(self.reference, index).get_value() } } } impl ExternalReferenceType for Party { fn from_extern_value(reference: ExternRef) -> Self { Self::new(reference) } } #[cfg(not(feature = "mock_data"))] extern "wasm" { fn party_get_pokemon(r: ExternRef, index: usize) -> ExternRef; }