Clippy fixes and documentation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-06-24 15:05:58 +02:00
parent 78bb91093b
commit 3400d9ec1e
12 changed files with 61 additions and 4 deletions

View File

@@ -25,6 +25,8 @@ pub trait ScriptResolver: Debug {
/// shared between all different usages.
fn load_item_script(&self, _key: &dyn Item) -> Result<Option<Arc<dyn ItemScript>>>;
/// Returns a reference to this script resolver as an Any. This is used to downcast the
/// ScriptResolver to a specific implementation.
fn as_any(&self) -> &dyn std::any::Any;
}

View File

@@ -378,6 +378,7 @@ impl Battle {
}
}
/// Gets the inner pointer to the reference counted data.
pub fn as_ptr(&self) -> *const c_void {
Arc::as_ptr(&self.data) as *const c_void
}

View File

@@ -354,6 +354,7 @@ impl BattleSide {
}
}
/// Gets the inner pointer to the reference counted data.
pub fn as_ptr(&self) -> *const c_void {
Arc::as_ptr(&self.data) as *const c_void
}

View File

@@ -543,7 +543,7 @@ impl Pokemon {
/// Change the form of the Pokemon.
pub fn change_form(&self, form: &Arc<dyn Form>) -> Result<()> {
if Arc::ptr_eq(&self.form(), form) {
if self.form().eq(form.deref()) {
return Ok(());
}
*self.data.form.write() = form.clone();
@@ -816,6 +816,7 @@ impl Pokemon {
}
}
/// Gets the inner pointer to the reference counted data.
pub fn as_ptr(&self) -> *const c_void {
Arc::as_ptr(&self.data) as *const c_void
}