-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simple implementation of InterfaceInfo, TypeInfo and TypeValueTable
Signed-off-by: fbrouille <[email protected]>
- Loading branch information
Showing
11 changed files
with
44 additions
and
275 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 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 |
---|---|---|
@@ -1,84 +1,6 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
use crate::translate::{ | ||
FromGlib, FromGlibPtrNone, IntoGlib, Stash, StashMut, ToGlibPtr, ToGlibPtrMut, | ||
}; | ||
|
||
#[derive(Debug)] | ||
#[doc(alias = "GInterfaceInfo")] | ||
#[repr(transparent)] | ||
pub struct InterfaceInfo(gobject_ffi::GInterfaceInfo); | ||
|
||
impl InterfaceInfo { | ||
#[inline] | ||
pub fn as_ptr(&self) -> *mut gobject_ffi::GInterfaceInfo { | ||
&self.0 as *const gobject_ffi::GInterfaceInfo as *mut _ | ||
} | ||
|
||
#[doc = "Borrows the underlying C value."] | ||
#[inline] | ||
pub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const gobject_ffi::GInterfaceInfo) -> &'a Self { | ||
&*(ptr as *const Self) | ||
} | ||
|
||
#[doc = "Borrows the underlying C value mutably."] | ||
#[inline] | ||
pub unsafe fn from_glib_ptr_borrow_mut<'a>( | ||
ptr: *mut gobject_ffi::GInterfaceInfo, | ||
) -> &'a mut Self { | ||
&mut *(ptr as *mut Self) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl IntoGlib for InterfaceInfo { | ||
type GlibType = gobject_ffi::GInterfaceInfo; | ||
|
||
#[inline] | ||
fn into_glib(self) -> Self::GlibType { | ||
self.0 | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlib<gobject_ffi::GInterfaceInfo> for InterfaceInfo { | ||
#[inline] | ||
unsafe fn from_glib(val: gobject_ffi::GInterfaceInfo) -> Self { | ||
Self(val) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtr<'a, *const gobject_ffi::GInterfaceInfo> for InterfaceInfo { | ||
type Storage = (); | ||
|
||
#[inline] | ||
fn to_glib_none(&'a self) -> Stash<'a, *const gobject_ffi::GInterfaceInfo, Self> { | ||
Stash(self.as_ptr() as *const _, ()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtrMut<'a, *mut gobject_ffi::GInterfaceInfo> for InterfaceInfo { | ||
type Storage = (); | ||
|
||
#[inline] | ||
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut gobject_ffi::GInterfaceInfo, Self> { | ||
StashMut(self.as_ptr(), ()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*mut gobject_ffi::GInterfaceInfo> for InterfaceInfo { | ||
unsafe fn from_glib_none(ptr: *mut gobject_ffi::GInterfaceInfo) -> Self { | ||
debug_assert!(!ptr.is_null()); | ||
Self(*ptr) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*const gobject_ffi::GInterfaceInfo> for InterfaceInfo { | ||
unsafe fn from_glib_none(ptr: *const gobject_ffi::GInterfaceInfo) -> Self { | ||
<Self as FromGlibPtrNone<_>>::from_glib_none(ptr as *mut gobject_ffi::GInterfaceInfo) | ||
} | ||
} | ||
pub struct InterfaceInfo(pub gobject_ffi::GInterfaceInfo); |
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 |
---|---|---|
@@ -1,82 +1,6 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
use crate::translate::{ | ||
FromGlib, FromGlibPtrNone, IntoGlib, Stash, StashMut, ToGlibPtr, ToGlibPtrMut, | ||
}; | ||
|
||
#[derive(Debug)] | ||
#[doc(alias = "GTypeInfo")] | ||
#[repr(transparent)] | ||
pub struct TypeInfo(gobject_ffi::GTypeInfo); | ||
|
||
impl TypeInfo { | ||
#[inline] | ||
pub fn as_ptr(&self) -> *mut gobject_ffi::GTypeInfo { | ||
&self.0 as *const gobject_ffi::GTypeInfo as *mut _ | ||
} | ||
|
||
#[doc = "Borrows the underlying C value."] | ||
#[inline] | ||
pub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const gobject_ffi::GTypeInfo) -> &'a Self { | ||
&*(ptr as *const Self) | ||
} | ||
|
||
#[doc = "Borrows the underlying C value mutably."] | ||
#[inline] | ||
pub unsafe fn from_glib_ptr_borrow_mut<'a>(ptr: *mut gobject_ffi::GTypeInfo) -> &'a mut Self { | ||
&mut *(ptr as *mut Self) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl IntoGlib for TypeInfo { | ||
type GlibType = gobject_ffi::GTypeInfo; | ||
|
||
#[inline] | ||
fn into_glib(self) -> Self::GlibType { | ||
self.0 | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlib<gobject_ffi::GTypeInfo> for TypeInfo { | ||
#[inline] | ||
unsafe fn from_glib(val: gobject_ffi::GTypeInfo) -> Self { | ||
Self(val) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtr<'a, *const gobject_ffi::GTypeInfo> for TypeInfo { | ||
type Storage = (); | ||
|
||
#[inline] | ||
fn to_glib_none(&'a self) -> Stash<'a, *const gobject_ffi::GTypeInfo, Self> { | ||
Stash(self.as_ptr() as *const _, ()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtrMut<'a, *mut gobject_ffi::GTypeInfo> for TypeInfo { | ||
type Storage = (); | ||
|
||
#[inline] | ||
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut gobject_ffi::GTypeInfo, Self> { | ||
StashMut(self.as_ptr(), ()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*mut gobject_ffi::GTypeInfo> for TypeInfo { | ||
unsafe fn from_glib_none(ptr: *mut gobject_ffi::GTypeInfo) -> Self { | ||
debug_assert!(!ptr.is_null()); | ||
Self(*ptr) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*const gobject_ffi::GTypeInfo> for TypeInfo { | ||
unsafe fn from_glib_none(ptr: *const gobject_ffi::GTypeInfo) -> Self { | ||
<Self as FromGlibPtrNone<_>>::from_glib_none(ptr as *mut gobject_ffi::GTypeInfo) | ||
} | ||
} | ||
pub struct TypeInfo(pub gobject_ffi::GTypeInfo); |
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 |
---|---|---|
@@ -1,84 +1,6 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
use crate::translate::{ | ||
FromGlib, FromGlibPtrNone, IntoGlib, Stash, StashMut, ToGlibPtr, ToGlibPtrMut, | ||
}; | ||
|
||
#[derive(Debug)] | ||
#[doc(alias = "GTypeValueTable")] | ||
#[repr(transparent)] | ||
pub struct TypeValueTable(gobject_ffi::GTypeValueTable); | ||
|
||
impl TypeValueTable { | ||
#[inline] | ||
pub fn as_ptr(&self) -> *mut gobject_ffi::GTypeValueTable { | ||
&self.0 as *const gobject_ffi::GTypeValueTable as *mut _ | ||
} | ||
|
||
#[doc = "Borrows the underlying C value."] | ||
#[inline] | ||
pub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const gobject_ffi::GTypeValueTable) -> &'a Self { | ||
&*(ptr as *const Self) | ||
} | ||
|
||
#[doc = "Borrows the underlying C value mutably."] | ||
#[inline] | ||
pub unsafe fn from_glib_ptr_borrow_mut<'a>( | ||
ptr: *mut gobject_ffi::GTypeValueTable, | ||
) -> &'a mut Self { | ||
&mut *(ptr as *mut Self) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl IntoGlib for TypeValueTable { | ||
type GlibType = gobject_ffi::GTypeValueTable; | ||
|
||
#[inline] | ||
fn into_glib(self) -> Self::GlibType { | ||
self.0 | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlib<gobject_ffi::GTypeValueTable> for TypeValueTable { | ||
#[inline] | ||
unsafe fn from_glib(val: gobject_ffi::GTypeValueTable) -> Self { | ||
Self(val) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtr<'a, *const gobject_ffi::GTypeValueTable> for TypeValueTable { | ||
type Storage = (); | ||
|
||
#[inline] | ||
fn to_glib_none(&'a self) -> Stash<'a, *const gobject_ffi::GTypeValueTable, Self> { | ||
Stash(self.as_ptr() as *const _, ()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtrMut<'a, *mut gobject_ffi::GTypeValueTable> for TypeValueTable { | ||
type Storage = (); | ||
|
||
#[inline] | ||
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut gobject_ffi::GTypeValueTable, Self> { | ||
StashMut(self.as_ptr(), ()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*mut gobject_ffi::GTypeValueTable> for TypeValueTable { | ||
unsafe fn from_glib_none(ptr: *mut gobject_ffi::GTypeValueTable) -> Self { | ||
debug_assert!(!ptr.is_null()); | ||
Self(*ptr) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*const gobject_ffi::GTypeValueTable> for TypeValueTable { | ||
unsafe fn from_glib_none(ptr: *const gobject_ffi::GTypeValueTable) -> Self { | ||
<Self as FromGlibPtrNone<_>>::from_glib_none(ptr as *mut gobject_ffi::GTypeValueTable) | ||
} | ||
} | ||
pub struct TypeValueTable(pub gobject_ffi::GTypeValueTable); |
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
Oops, something went wrong.