Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #400 from sdroege/boxed-macro-rename
Browse files Browse the repository at this point in the history
Rename glib_boxed_get_type! to glib_boxed_type! for consistency
  • Loading branch information
GuillaumeGomez committed Nov 28, 2018
2 parents cf3b7b7 + 605ac7a commit d70335f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/subclass/boxed.rs
Expand Up @@ -28,20 +28,20 @@ pub trait BoxedType: Clone + Sized + 'static {

/// Returns the type ID.
///
/// This is usually defined via the [`glib_boxed_get_type!`] macro.
/// This is usually defined via the [`glib_boxed_type!`] macro.
///
/// [`glib_boxed_get_type!`]: ../../macro.glib_boxed_get_type.html
/// [`glib_boxed_type!`]: ../../macro.glib_boxed_type.html
fn get_type() -> ::Type;
}

/// Register a boxed `glib::Type` ID for `T`.
///
/// This must be called only once and will panic on a second call.
///
/// See [`glib_boxed_get_type!`] for defining a function that ensures that
/// See [`glib_boxed_type!`] for defining a function that ensures that
/// this is only called once and returns the type id.
///
/// [`glib_boxed_get_type!`]: ../../macro.glib_boxed_get_type.html
/// [`glib_boxed_type!`]: ../../macro.glib_boxed_type.html
pub fn register_boxed_type<T: BoxedType>() -> ::Type {
unsafe {
use std::ffi::CString;
Expand Down Expand Up @@ -79,7 +79,7 @@ unsafe extern "C" fn boxed_free<T: BoxedType>(v: ffi::gpointer) {
/// the first time it is called.
///
/// [`register_boxed_type`]: subclass/boxed/fn.register_boxed_type.html
macro_rules! glib_boxed_get_type {
macro_rules! glib_boxed_type {
() => {
fn get_type() -> $crate::Type {
static mut TYPE_: $crate::Type = $crate::Type::Invalid;
Expand Down Expand Up @@ -212,7 +212,7 @@ mod test {
impl BoxedType for MyBoxed {
const NAME: &'static str = "MyBoxed";

glib_boxed_get_type!();
glib_boxed_type!();
}

glib_boxed_derive_traits!(MyBoxed);
Expand Down
2 changes: 1 addition & 1 deletion src/subclass/mod.rs
Expand Up @@ -149,7 +149,7 @@
//! // This macro defines a
//! // fn get_type() -> glib::Type
//! // function
//! glib_boxed_get_type!();
//! glib_boxed_type!();
//! }
//!
//! // This macro derives some traits on the struct
Expand Down

0 comments on commit d70335f

Please sign in to comment.