Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trait objects without an explicit dyn are deprecated #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Timer {
unsafe fn spawn_inner<'a>(name: &str,
period_ticks: FreeRtosTickType,
auto_reload: bool,
callback: Box<Fn(Timer) + Send + 'a>,)
callback: Box<dyn Fn(Timer) + Send + 'a>,)
-> Result<Timer, FreeRtosError> {
let f = Box::new(callback);
let param_ptr = &*f as *const _ as *mut _;
Expand Down Expand Up @@ -105,7 +105,7 @@ impl Timer {
detached: true
};
if let Ok(callback_ptr) = timer.get_id() {
let b = Box::from_raw(callback_ptr as *mut Box<Fn(Timer)>);
let b = Box::from_raw(callback_ptr as *mut Box<dyn Fn(Timer)>);
b(timer);
Box::into_raw(b);
}
Expand Down Expand Up @@ -188,7 +188,7 @@ impl Drop for Timer {
unsafe {
if let Ok(callback_ptr) = self.get_id() {
// free the memory
Box::from_raw(callback_ptr as *mut Box<Fn(Timer)>);
Box::from_raw(callback_ptr as *mut Box<dyn Fn(Timer)>);
}

// todo: configurable timeout?
Expand Down