Update to newest Rust

This commit is contained in:
Patrick Walton
2012-10-18 17:03:47 -07:00
parent 1104c30097
commit 6ef2001b3c
4 changed files with 17 additions and 17 deletions
+6 -6
View File
@@ -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);
}
}
}
+4 -4
View File
@@ -41,12 +41,12 @@ struct CFDictionary<K:AbstractCFType,V:AbstractCFType> {
}
}
pub mod CFDictionary {
pub fn wrap<K:AbstractCFType,V:AbstractCFType>(obj: CFDictionaryRef) -> CFDictionary<K,V> {
pub impl<K:AbstractCFType,V:AbstractCFType> CFDictionary<K,V> {
static fn wrap(obj: CFDictionaryRef) -> CFDictionary<K,V> {
CFDictionary { obj: obj }
}
pub fn new_dictionary<K:AbstractCFType,V:AbstractCFType>(pairs: &[(K,V)]) -> CFDictionary<K,V> {
static fn new_dictionary(pairs: &[(K,V)]) -> CFDictionary<K,V> {
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);
}
}
+3 -3
View File
@@ -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<T:Copy ConvertibleToCFNumber>(n: T) -> CFNumber {
static fn new_number<T:Copy ConvertibleToCFNumber>(n: T) -> CFNumber {
unsafe {
CFNumber {
obj: CFNumberCreate(kCFAllocatorDefault, n.cf_number_type(), reinterpret_cast(& &n))
+4 -4
View File
@@ -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)
}
}