-
-
Notifications
You must be signed in to change notification settings - Fork 115
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 #895 from pbor/boxed_mut
glib: implement ToGlibPtr<*mut _> for boxed types
- Loading branch information
Showing
8 changed files
with
46 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 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
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,23 +1,21 @@ | ||
// Take a look at the license at the top of the repository in the LICENSE file. | ||
|
||
use glib::translate::*; | ||
|
||
use crate::{Analysis, Item}; | ||
|
||
impl Item { | ||
pub fn offset(&self) -> i32 { | ||
unsafe { (*self.to_glib_none().0).offset } | ||
unsafe { (*self.as_ptr()).offset } | ||
} | ||
|
||
pub fn length(&self) -> i32 { | ||
unsafe { (*self.to_glib_none().0).length } | ||
unsafe { (*self.as_ptr()).length } | ||
} | ||
|
||
pub fn num_chars(&self) -> i32 { | ||
unsafe { (*self.to_glib_none().0).num_chars } | ||
unsafe { (*self.as_ptr()).num_chars } | ||
} | ||
|
||
pub fn analysis(&self) -> &Analysis { | ||
unsafe { &*(&((*self.to_glib_none().0).analysis) as *const _ as *const Analysis) } | ||
unsafe { &*(&((*self.as_ptr()).analysis) as *const _ as *const Analysis) } | ||
} | ||
} |