All notable changes to this project are documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
-
Added APIs to
objc
module:-
Ivar
opaque type. -
TypeEncoding
thin C string for ObjC@encode(type)
.
-
- [breaking]
Method::type_encoding
usesTypeEncoding
overCStr
. - [breaking]
Method::as_c_str
toMethod::as_cstr
. - [breaking]
Sel::name
toSel::as_cstr
.
-
Internal macros to simplify creating class types and wrappers:
-
subclass!
performs all the wrapping and trait impls (e.g.obj::Object
,Deref
) to make a new subclass easy to declare. This macro is runtime-agnostic. -
object_wrapper!
for thin wrappers over object types. Unlikesubclass!
, this is not meant for creating a new class type. -
objc_class_type!
implementsobjc::ClassType
using the given class name. -
objc_subclass!
callssubclass!
andobjc_class_type!
. -
objc_object_wrapper!
callsobject_wrapper!
and implements theobjc::ObjectType
trait. -
ns_string_wrapper!
callsobjc_object_wrapper!
withfoundation::NSString
and implements theDebug
andDisplay
traits.
-
-
objc::ClassType
trait for types whose classes are statically available. -
Improvements to
ns_string!
macro:-
Can take
const X: &str
as input, not just string literals. -
Allows interior null bytes, transcoding the string to UTF-16.
-
Allows trailing null bytes and uses the constant as-is.
This makes it possible for input data to not get emitted in the binary twice. The compiler currently does not coalesce string prefixes and instead emits the same prefix data twice.
-
-
Internal convenience
_msg_send!
macro for dispatchingobjc_msgSend
and associating arguments with the appropriate selector part.- Also
_msg_send_cached!
that internally caches the selector in a global atomic pointer.
- Also
-
Created private
common
module for types exposed in multiple public modules:NSDirectionalEdgeInsets
-
Created
core
module for core types and traits are not specific to any wrapped library:-
ObjectType
trait to generalize retain/release. -
Arc
type to handle automatic reference counting. Built on top of the methods inObjectType
.-
Implements
Default
:-
Arc<T>
where&T
implementsDefault
by retaining the value. -
Arc<NSObject>
from[[NSObject alloc] init]
. -
Arc<NSMutableString>
from[[NSMutableString alloc] init]
.
-
-
-
OSErr
andOSStatus
non-zero structs for error codes. -
FourCharCode
struct for four-character codes. -
OSType
alias forFourCharCode
.
-
-
Created
core_graphics
module for Core Graphics framework:-
Geometry types:
CGFloat
,CGPoint
,CGSize
,CGRect
,CGRectEdge
,CGVector
, andCGAffineTransform
.These are aliased in
foundation
as:NSPoint
,NSSize
,NSRect
, andNSRectEdge
.
-
-
Created
app_kit
module for AppKit framework.NSAppKitVersion
type and version constants through 10.15.
-
Created
dispatch
module for Dispatch library:-
sys
module for raw unsafe C functions exposed by libdispatch. -
Types:
DispatchObject
,DispatchQueueBuilder
,DispatchQueuePriority
,DispatchQueueAttributes
,DispatchTime
,DispatchQos
,DispatchQosClass
,DispatchAutoreleaseFrequency
,DispatchSource
,DispatchSourceType
. -
DispatchQueue
-
current_queue_label_owned
as safe owned alternative tocurrent_queue_label
. -
with_current_queue_label
as safe scoped alternative tocurrent_queue_label
.
-
-
-
Created
core_services
module for Core Services framework.-
apple_events
module for low level Apple Events API inAE.framework
:-
AEDescType
,AEEventClass
, andAEEventID
newtype structs overFourCharCode
. -
AEReturnID
newtype struct overi16
. -
AETransactionID
andAESendMode
newtype structs overi32
. -
AEDataStorage
andAEDataStorageType
pointer type aliases.
-
-
-
Created
core_animation
module for Core Animation framework. -
Created
core_image
module for Core Image framework. -
Created
core_video
module for Core Video framework. -
Created
core_audio
module for Core Audio framework. -
Created
core_text
module for Core Text framework. -
Created
system_configuration
module for System Configuration framework. -
Created
cf_network
module for CFNetwork framework. -
Created
io_kit
module for IOKit framework. -
Added APIs to
foundation
module:-
Constants:
NSNotFound
. -
Types:
NSNumber
,NSEdgeInsets
,NSRange
,NSValue
,NSNull
,NSException
,NSExceptionName
,NSError
,NSErrorDomain
,NSErrorUserInfoKey
,NSErrorRecoveryAttempting
,NSTimeInterval
. -
NSError
error codes. -
Methods for
NSString
:-
length
-
Efficiently getting an
Option<&str>
if it's UTF-8 or anOption<&[u16]>
if it's UTF-16.Unlike
to_str
and friends, these do not allocate and transcode to a new string if the original string does not represent the encoding. -
Efficiently comparing against
&str
. -
Getting all available encodings:
available_encodings_slice
,available_encodings_iter
,available_encodings_ptr
. -
available_encodings_count
for number of available encodings. This callsavailable_encodings_slice().len()
.
-
-
Methods for
NSStringEncoding
:-
name
. -
Methods for getting all available
NSStringEncoding
s.
-
-
-
Added APIs to
core_foundation
module:-
Constants:
kCFNotFound
. -
Types:
CFType
,CFTypeRef
,CFTypeID
,CFOptionFlags
,CFIndex
,CFHashCode
,CFComparisonResult
,CFAllocator
,CFAllocatorContext
,CFNumber
,CFNumberType
,CFBoolean
. -
Callback function type aliases for
CFAllocator
.
-
-
Added APIs to
objc
module:-
Pointer methods for
Sel
. -
Implemented
PartialEq
forNSObject
. -
autoreleasepool
function equivalent to@autoreleasepool
that drains on panic. -
BOOL::NO
andBOOL::YES
associated constants as alternatives to the freestanding constants. These should be preferred.
-
-
[breaking]
NSString
to&str
conversion now uses the correct length in spite of interior nulls. Previously the C string length was used. -
Correct dispatching of the appropriate
objc_msgSend
based on return type. -
[breaking] The safety of
DispatchQueue::current_queue_label_owned
by marking it asunsafe
. It is unspecified whether the label may outlive the current queue. -
The signed-ness of
BOOL
on platforms where it is asigned char
. -
[breaking] The memory representation of
BOOL
on platforms where it is a C/C++Bool
. -
The
ns_string!
macro now transcodes non-ASCII strings to UTF-16, instead of allowing UTF-8 data where only ASCII data is expected (see issue #3).Transcoding was implemented by @thomcc. Iterator technique was provided by @rodrimati1992.
-
[breaking] Objects now are closer to how they are in Objective-C.
&NSString
in Rust is likeNSString *
in Objective-C. The newArc<T>
type handles releasing the reference onDrop
.As a result, constructors now return
Arc<Self>
. -
[breaking] Shortened lifetime of
class
on Objective-C objects from static toself
. -
[breaking] Renamed
SEL
toSel
. -
[breaking] Renamed
get_class
toclass
for Objective-C objects. -
[breaking] Renamed
nsstring!
macro tons_string!
. -
[breaking] Renamed constants in
NSStringEncoding
to be simpler and use UPPER_SNAKE_CASE. -
[breaking] Changed
BOOL
from a type alias to a newtype. -
[breaking] Increased crate
#[cfg]
strictness from any 32/64 bit to only target x86 and ARM.
- Pointer conversion methods on object types. These are now handled through the
new
Arc<T>
object wrapper type.
0.2.0 - 2020-09-11
- [breaking] Placed each library/framework module behind a feature flag.
foundation
transitively enablesobjc
.
-
[breaking] Removed the
link
cargo feature.At this point, it's unclear what benefit this feature provides. Further investigation will be done before this crate is 1.0 to determine if disabling linking is worthwhile to have. See issue #1.
Initial release.