Style and Clippy fixes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,16 +4,19 @@ use crate::static_data::{GrowthRate, GrowthRateLibrary};
|
||||
use std::ffi::{c_char, CStr};
|
||||
use std::ptr::drop_in_place;
|
||||
|
||||
/// Instantiates a new growth rate library with a capacity
|
||||
#[no_mangle]
|
||||
extern "C" fn growth_rate_library_new(capacity: usize) -> IdentifiablePointer<GrowthRateLibrary> {
|
||||
Box::new(GrowthRateLibrary::new(capacity)).into()
|
||||
}
|
||||
|
||||
/// Drops the growthrate library.
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn growth_rate_library_drop(ptr: OwnedPtr<GrowthRateLibrary>) {
|
||||
drop_in_place(ptr)
|
||||
}
|
||||
|
||||
/// Calculates the level for a given growth key name and a certain experience.
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn growth_rate_library_calculate_level(
|
||||
ptr: ExternPointer<GrowthRateLibrary>,
|
||||
@@ -24,6 +27,7 @@ unsafe extern "C" fn growth_rate_library_calculate_level(
|
||||
.calculate_level(&CStr::from_ptr(growth_rate).into(), experience)
|
||||
}
|
||||
|
||||
/// Calculates the experience for a given growth key name and a certain level.
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn growth_rate_library_calculate_experience(
|
||||
ptr: ExternPointer<GrowthRateLibrary>,
|
||||
@@ -34,9 +38,10 @@ unsafe extern "C" fn growth_rate_library_calculate_experience(
|
||||
.calculate_experience(&CStr::from_ptr(growth_rate).into(), level)
|
||||
}
|
||||
|
||||
/// Adds a new growth rate with a name and value.
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn growth_rate_library_add_growth_rate(
|
||||
ptr: ExternPointer<GrowthRateLibrary>,
|
||||
mut ptr: ExternPointer<GrowthRateLibrary>,
|
||||
name: BorrowedPtr<c_char>,
|
||||
growth_rate: OwnedPtr<Box<dyn GrowthRate>>,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user