-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from SpringQL/build/v0.15.0
build: v0.15.0
- Loading branch information
Showing
6 changed files
with
157 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This file is part of https://github.com/SpringQL/SpringQL-client-c which is licensed under MIT OR Apache-2.0. See file LICENSE-MIT or LICENSE-APACHE for full license details. | ||
|
||
use ::springql::SpringSourceRowBuilder as SourceRowBuilder; | ||
|
||
use std::{ffi::c_void, mem}; | ||
|
||
/// Builder of SpringSourceRow | ||
#[non_exhaustive] | ||
#[repr(transparent)] | ||
pub struct SpringSourceRowBuilder(*mut c_void); | ||
|
||
impl SpringSourceRowBuilder { | ||
pub fn new(underlying: SourceRowBuilder) -> Self { | ||
SpringSourceRowBuilder(unsafe { mem::transmute(Box::new(underlying)) }) | ||
} | ||
|
||
pub fn to_row_builder(&self) -> SourceRowBuilder { | ||
unsafe { &*(self.0 as *const SourceRowBuilder) }.clone() | ||
} | ||
|
||
pub fn drop(ptr: *mut SpringSourceRowBuilder) { | ||
let outer = unsafe { Box::from_raw(ptr) }; | ||
let inner = unsafe { Box::from_raw(outer.0) }; | ||
drop(inner); | ||
drop(outer); | ||
} | ||
|
||
pub fn into_ptr(self) -> *mut SpringSourceRowBuilder { | ||
Box::into_raw(Box::new(self)) | ||
} | ||
} | ||
|
||
impl Default for SpringSourceRowBuilder { | ||
fn default() -> Self { | ||
Self::new(SourceRowBuilder::default()) | ||
} | ||
} |