summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-01-22 15:50:48 +0100
committerMatthias Beyer <mail@beyermatthias.de>2017-01-22 15:50:48 +0100
commita06fce06e56b3f0643f34b23c27736432709b48b (patch)
treed42d73d68bd69bdb0908681836d835fd4bdb17f2
parentce23114f2ccf7f1ded673026baeabca3d5b1a4e3 (diff)
downloadimag-a06fce06e56b3f0643f34b23c27736432709b48b.zip
imag-a06fce06e56b3f0643f34b23c27736432709b48b.tar.gz
Beautify wrapper helper macros
-rw-r--r--libimagruby/src/entry.rs14
-rw-r--r--libimagruby/src/store.rs4
-rw-r--r--libimagruby/src/storeid.rs4
-rw-r--r--libimagruby/src/util.rs4
4 files changed, 13 insertions, 13 deletions
diff --git a/libimagruby/src/entry.rs b/libimagruby/src/entry.rs
index 0e544d2..83ae868 100644
--- a/libimagruby/src/entry.rs
+++ b/libimagruby/src/entry.rs
@@ -56,8 +56,8 @@ impl FileLockEntryHandle {
wrappable_struct!(FileLockEntryHandle, FileLockEntryWrapper, FLE_WRAPPER);
class!(RFileLockEntryHandle);
-impl_wrap!(FileLockEntryHandle, FLE_WRAPPER);
-impl_unwrap!(RFileLockEntryHandle, FileLockEntryHandle, FLE_WRAPPER);
+impl_wrap!(FileLockEntryHandle => FLE_WRAPPER);
+impl_unwrap!(RFileLockEntryHandle => FileLockEntryHandle => FLE_WRAPPER);
impl_verified_object!(RFileLockEntryHandle);
/// Helper macro for operating on RUBY_STORE_CACHE object
@@ -184,8 +184,8 @@ methods!(
wrappable_struct!(EntryHeader, EntryHeaderWrapper, ENTRY_HEADER_WRAPPER);
class!(REntryHeader);
-impl_wrap!(EntryHeader, ENTRY_HEADER_WRAPPER);
-impl_unwrap!(REntryHeader, EntryHeader, ENTRY_HEADER_WRAPPER);
+impl_wrap!(EntryHeader => ENTRY_HEADER_WRAPPER);
+impl_unwrap!(REntryHeader => EntryHeader => ENTRY_HEADER_WRAPPER);
impl_verified_object!(REntryHeader);
methods!(
@@ -244,12 +244,12 @@ methods!(
wrappable_struct!(EntryContent, EntryContentWrapper, ENTRY_CONTENT_WRAPPER);
class!(REntryContent);
-impl_wrap!(EntryContent, ENTRY_CONTENT_WRAPPER);
-impl_unwrap!(REntryContent, EntryContent, ENTRY_CONTENT_WRAPPER);
+impl_wrap!(EntryContent => ENTRY_CONTENT_WRAPPER);
+impl_unwrap!(REntryContent => EntryContent => ENTRY_CONTENT_WRAPPER);
wrappable_struct!(Entry, EntryWrapper, ENTRY_WRAPPER);
class!(REntry);
-impl_unwrap!(REntry, Entry, ENTRY_WRAPPER);
+impl_unwrap!(REntry => Entry => ENTRY_WRAPPER);
pub fn setup_filelockentry() -> Class {
let mut class = Class::new("RFileLockEntryHandle", None);
diff --git a/libimagruby/src/store.rs b/libimagruby/src/store.rs
index e1d16a1..4c3a49a 100644
--- a/libimagruby/src/store.rs
+++ b/libimagruby/src/store.rs
@@ -36,8 +36,8 @@ use cache::StoreHandle;
wrappable_struct!(StoreHandle, StoreWrapper, STORE_WRAPPER);
class!(RStoreHandle);
-impl_wrap!(StoreHandle, STORE_WRAPPER);
-impl_unwrap!(RStoreHandle, StoreHandle, STORE_WRAPPER);
+impl_wrap!(StoreHandle => STORE_WRAPPER);
+impl_unwrap!(RStoreHandle => StoreHandle => STORE_WRAPPER);
impl_verified_object!(RStoreHandle);
macro_rules! call_on_store_by_handle {
diff --git a/libimagruby/src/storeid.rs b/libimagruby/src/storeid.rs
index 330c980..a820064 100644
--- a/libimagruby/src/storeid.rs
+++ b/libimagruby/src/storeid.rs
@@ -27,8 +27,8 @@ use util::Wrap;
wrappable_struct!(StoreId, StoreIdWrapper, STOREID_WRAPPER);
class!(RStoreId);
-impl_wrap!(StoreId, STOREID_WRAPPER);
-impl_unwrap!(RStoreId, StoreId, STOREID_WRAPPER);
+impl_wrap!(StoreId => STOREID_WRAPPER);
+impl_unwrap!(RStoreId => StoreId => STOREID_WRAPPER);
impl_verified_object!(RStoreId);
diff --git a/libimagruby/src/util.rs b/libimagruby/src/util.rs
index e94e1b4..85813f2 100644
--- a/libimagruby/src/util.rs
+++ b/libimagruby/src/util.rs
@@ -24,7 +24,7 @@ pub trait Wrap {
#[macro_export]
macro_rules! impl_wrap {
- ($target: ty, $wrapper: path) => {
+ ($target:ty => $wrapper:path) => {
impl Wrap for $target {
fn wrap(self) -> AnyObject {
Class::from_existing(concat!("R", stringify!($target)))
@@ -41,7 +41,7 @@ pub trait Unwrap {
#[macro_export]
macro_rules! impl_unwrap {
- ($from: ty, $to: ty, $wrapper: path) => {
+ ($from:ty => $to:ty => $wrapper:path) => {
impl Unwrap for $from {
type Target = $to;
fn unwrap<'a>(&'a self) -> &'a mut $to {