Skip to content

Commit

Permalink
mulling over trait ideas
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Sep 4, 2023
1 parent 64d3461 commit 60b67de
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sys/tskbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ pub struct TskBox<T> {
free: unsafe extern "C" fn(*mut T) -> i32,
}

// WIP
trait TskInit {
type Options: Sized;
unsafe fn init(tsk: *mut Self, option: Self::Options) -> i32;
}

// WIP
trait TskFree {
unsafe fn free(tsk: *mut Self);
}

impl<T> TskBox<T> {
pub fn new<F: Fn(*mut T) -> i32>(init: F, free: unsafe extern "C" fn(*mut T) -> i32) -> Self {
let x = unsafe { libc::malloc(std::mem::size_of::<T>()) as *mut T };
Expand Down

0 comments on commit 60b67de

Please sign in to comment.