-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
21 additions
and
44 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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
use glib_sys::GType; | ||
|
||
// `g_param_spec_types` extern binding generated by build.rs | ||
include!(concat!(env!("OUT_DIR"), "/param_spec.rs")); | ||
#[repr(C)] | ||
pub struct GParamSpecTypes(*const GType); | ||
|
||
/// # Safety | ||
/// This should be safe as long as the offset added to g_param_spec_types is in bounds. | ||
pub unsafe fn g_param_spec_types_get_type(offset: usize) -> GType { | ||
*g_param_spec_types.add(offset) | ||
unsafe impl Sync for GParamSpecTypes {} | ||
|
||
impl GParamSpecTypes { | ||
/// # Safety | ||
/// This should be safe as long as the offset added to g_param_spec_types is in bounds. | ||
pub unsafe fn get_type(&self, offset: usize) -> GType { | ||
*self.0.add(offset) | ||
} | ||
} | ||
|
||
extern "C" { | ||
static g_param_spec_types: GParamSpecTypes; | ||
} | ||
|
||
//#[cfg(not(target_os = "windows"))] | ||
pub static __imp_g_param_spec_types: &'static GParamSpecTypes = unsafe { &g_param_spec_types }; | ||
|
||
//#[cfg(all(target_env = "msvc", not(feature = "static")))] | ||
//pub static __imp_g_param_spec_types: &'static GParamSpecTypes = unsafe { &g_param_spec_types }; |
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