@@ -8,7 +8,7 @@ use std::fmt;
8
8
use std:: os:: raw:: { c_char, c_int, c_uint, c_void} ;
9
9
use std:: ptr;
10
10
use std:: str;
11
- use malloc_buf:: MallocBuffer ;
11
+ use malloc_buf:: Malloc ;
12
12
13
13
use encode;
14
14
use { Encode , Encoding } ;
@@ -284,11 +284,11 @@ impl Class {
284
284
}
285
285
286
286
/// Obtains the list of registered class definitions.
287
- pub fn classes ( ) -> MallocBuffer < & ' static Class > {
287
+ pub fn classes ( ) -> Malloc < [ & ' static Class ] > {
288
288
unsafe {
289
289
let mut count: c_uint = 0 ;
290
290
let classes = objc_copyClassList ( & mut count) ;
291
- MallocBuffer :: new ( classes as * mut _ , count as usize ) . unwrap ( )
291
+ Malloc :: from_array ( classes as * mut _ , count as usize )
292
292
}
293
293
}
294
294
@@ -351,11 +351,11 @@ impl Class {
351
351
}
352
352
353
353
/// Describes the instance methods implemented by self.
354
- pub fn instance_methods ( & self ) -> MallocBuffer < & Method > {
354
+ pub fn instance_methods ( & self ) -> Malloc < [ & Method ] > {
355
355
unsafe {
356
356
let mut count: c_uint = 0 ;
357
357
let methods = class_copyMethodList ( self , & mut count) ;
358
- MallocBuffer :: new ( methods as * mut _ , count as usize ) . unwrap ( )
358
+ Malloc :: from_array ( methods as * mut _ , count as usize )
359
359
}
360
360
361
361
}
@@ -366,20 +366,20 @@ impl Class {
366
366
}
367
367
368
368
/// Get a list of the protocols to which this class conforms.
369
- pub fn adopted_protocols ( & self ) -> MallocBuffer < & Protocol > {
369
+ pub fn adopted_protocols ( & self ) -> Malloc < [ & Protocol ] > {
370
370
unsafe {
371
371
let mut count: c_uint = 0 ;
372
372
let protos = class_copyProtocolList ( self , & mut count) ;
373
- MallocBuffer :: new ( protos as * mut _ , count as usize ) . unwrap ( )
373
+ Malloc :: from_array ( protos as * mut _ , count as usize )
374
374
}
375
375
}
376
376
377
377
/// Describes the instance variables declared by self.
378
- pub fn instance_variables ( & self ) -> MallocBuffer < & Ivar > {
378
+ pub fn instance_variables ( & self ) -> Malloc < [ & Ivar ] > {
379
379
unsafe {
380
380
let mut count: c_uint = 0 ;
381
381
let ivars = class_copyIvarList ( self , & mut count) ;
382
- MallocBuffer :: new ( ivars as * mut _ , count as usize ) . unwrap ( )
382
+ Malloc :: from_array ( ivars as * mut _ , count as usize )
383
383
}
384
384
}
385
385
}
@@ -412,20 +412,20 @@ impl Protocol {
412
412
}
413
413
414
414
/// Obtains the list of registered protocol definitions.
415
- pub fn protocols ( ) -> MallocBuffer < & ' static Protocol > {
415
+ pub fn protocols ( ) -> Malloc < [ & ' static Protocol ] > {
416
416
unsafe {
417
417
let mut count: c_uint = 0 ;
418
418
let protocols = objc_copyProtocolList ( & mut count) ;
419
- MallocBuffer :: new ( protocols as * mut _ , count as usize ) . unwrap ( )
419
+ Malloc :: from_array ( protocols as * mut _ , count as usize )
420
420
}
421
421
}
422
422
423
423
/// Get a list of the protocols to which this protocol conforms.
424
- pub fn adopted_protocols ( & self ) -> MallocBuffer < & Protocol > {
424
+ pub fn adopted_protocols ( & self ) -> Malloc < [ & Protocol ] > {
425
425
unsafe {
426
426
let mut count: c_uint = 0 ;
427
427
let protocols = protocol_copyProtocolList ( self , & mut count) ;
428
- MallocBuffer :: new ( protocols as * mut _ , count as usize ) . unwrap ( )
428
+ Malloc :: from_array ( protocols as * mut _ , count as usize )
429
429
}
430
430
}
431
431
0 commit comments