Skip to content

Commit

Permalink
Improve macro of ffi_buffer
Browse files Browse the repository at this point in the history
Signed-off-by: kexuan.yang <kexuan.yang@gmail.com>
  • Loading branch information
yangkx1024 committed Aug 16, 2024
1 parent c067d70 commit dc39a48
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/ffi/ffi_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,18 @@ where
}

macro_rules! impl_release_for_primary {
($ident:ident) => {
impl Releasable for $ident {
unsafe fn release(&mut self) {
// Do nothing, we need nothing to be release inside primary type
($($ident:ident),+) => {
$(
impl Releasable for $ident {
unsafe fn release(&mut self) {
// Do nothing, we need nothing to be release inside primary type
}
}
}
)+
};
}

impl_release_for_primary!(bool);

impl_release_for_primary!(i32);

impl_release_for_primary!(i64);

impl_release_for_primary!(f32);

impl_release_for_primary!(f64);
impl_release_for_primary!(bool, i32, i64, f32, f64);

impl ByteSlice {
pub(super) fn new(string: String) -> Self {
Expand Down

0 comments on commit dc39a48

Please sign in to comment.