diff --git a/boolean.rs b/boolean.rs index 24774ee..356903d 100644 --- a/boolean.rs +++ b/boolean.rs @@ -14,24 +14,24 @@ pub struct CFBoolean { } } -pub mod CFBoolean { - pub fn wrap(obj: CFBooleanRef) -> CFBoolean { +pub impl CFBoolean { + static fn wrap(obj: CFBooleanRef) -> CFBoolean { CFBoolean { obj: obj } } - pub fn true_value() -> CFBoolean { + static fn true_value() -> CFBoolean { unsafe { let obj = kCFBooleanTrue; CFRetain(reinterpret_cast(&obj)); - return wrap(obj); + return CFBoolean::wrap(obj); } } - pub fn false_value() -> CFBoolean { + static fn false_value() -> CFBoolean { unsafe { let obj = kCFBooleanFalse; CFRetain(reinterpret_cast(&obj)); - return wrap(obj); + return CFBoolean::wrap(obj); } } } diff --git a/dictionary.rs b/dictionary.rs index 46e98f5..bd40c06 100644 --- a/dictionary.rs +++ b/dictionary.rs @@ -41,12 +41,12 @@ struct CFDictionary { } } -pub mod CFDictionary { - pub fn wrap(obj: CFDictionaryRef) -> CFDictionary { +pub impl CFDictionary { + static fn wrap(obj: CFDictionaryRef) -> CFDictionary { CFDictionary { obj: obj } } - pub fn new_dictionary(pairs: &[(K,V)]) -> CFDictionary { + static fn new_dictionary(pairs: &[(K,V)]) -> CFDictionary { let (keys, values) = (DVec(), DVec()); for pairs.each |pair| { // FIXME: "let" would be much nicer here, but that doesn't work yet. @@ -72,7 +72,7 @@ pub mod CFDictionary { to_unsafe_ptr(&kCFTypeDictionaryValueCallBacks)); } - return wrap(dictionary_ref); + return CFDictionary::wrap(dictionary_ref); } } diff --git a/number.rs b/number.rs index ff79098..8ef3d56 100644 --- a/number.rs +++ b/number.rs @@ -17,12 +17,12 @@ pub struct CFNumber { } } -pub mod CFNumber { - pub fn wrap(obj: CFNumberRef) -> CFNumber { +pub impl CFNumber { + static fn wrap(obj: CFNumberRef) -> CFNumber { CFNumber { obj: obj } } - pub fn new_number(n: T) -> CFNumber { + static fn new_number(n: T) -> CFNumber { unsafe { CFNumber { obj: CFNumberCreate(kCFAllocatorDefault, n.cf_number_type(), reinterpret_cast(& &n)) diff --git a/string.rs b/string.rs index 7dcc4b5..9f1b453 100644 --- a/string.rs +++ b/string.rs @@ -22,12 +22,12 @@ pub struct CFString { } } -pub mod CFString { - pub fn wrap(obj: CFStringRef) -> CFString { +pub impl CFString { + static fn wrap(obj: CFStringRef) -> CFString { CFString { obj: obj } } - pub fn new_static(string: &static/str) -> CFString { + static fn new_static(string: &static/str) -> CFString { let string_ref = do str::as_buf(string) |bytes, len| { CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, bytes, @@ -36,7 +36,7 @@ pub mod CFString { false as Boolean, kCFAllocatorNull) }; - wrap(string_ref) + CFString::wrap(string_ref) } }