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
objcmodule:-
Ivaropaque type. -
TypeEncodingthin C string for ObjC@encode(type).
-
- [breaking]
Method::type_encodingusesTypeEncodingoverCStr. - [breaking]
Method::as_c_strtoMethod::as_cstr. - [breaking]
Sel::nametoSel::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::ClassTypeusing the given class name. -
objc_subclass!callssubclass!andobjc_class_type!. -
objc_object_wrapper!callsobject_wrapper!and implements theobjc::ObjectTypetrait. -
ns_string_wrapper!callsobjc_object_wrapper!withfoundation::NSStringand implements theDebugandDisplaytraits.
-
-
objc::ClassTypetrait for types whose classes are statically available. -
Improvements to
ns_string!macro:-
Can take
const X: &stras 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_msgSendand associating arguments with the appropriate selector part.- Also
_msg_send_cached!that internally caches the selector in a global atomic pointer.
- Also
-
Created private
commonmodule for types exposed in multiple public modules:NSDirectionalEdgeInsets
-
Created
coremodule for core types and traits are not specific to any wrapped library:-
ObjectTypetrait to generalize retain/release. -
Arctype to handle automatic reference counting. Built on top of the methods inObjectType.-
Implements
Default:-
Arc<T>where&TimplementsDefaultby retaining the value. -
Arc<NSObject>from[[NSObject alloc] init]. -
Arc<NSMutableString>from[[NSMutableString alloc] init].
-
-
-
OSErrandOSStatusnon-zero structs for error codes. -
FourCharCodestruct for four-character codes. -
OSTypealias forFourCharCode.
-
-
Created
core_graphicsmodule for Core Graphics framework:-
Geometry types:
CGFloat,CGPoint,CGSize,CGRect,CGRectEdge,CGVector, andCGAffineTransform.These are aliased in
foundationas:NSPoint,NSSize,NSRect, andNSRectEdge.
-
-
Created
app_kitmodule for AppKit framework.NSAppKitVersiontype and version constants through 10.15.
-
Created
dispatchmodule for Dispatch library:-
sysmodule for raw unsafe C functions exposed by libdispatch. -
Types:
DispatchObject,DispatchQueueBuilder,DispatchQueuePriority,DispatchQueueAttributes,DispatchTime,DispatchQos,DispatchQosClass,DispatchAutoreleaseFrequency,DispatchSource,DispatchSourceType. -
DispatchQueue-
current_queue_label_ownedas safe owned alternative tocurrent_queue_label. -
with_current_queue_labelas safe scoped alternative tocurrent_queue_label.
-
-
-
Created
core_servicesmodule for Core Services framework.-
apple_eventsmodule for low level Apple Events API inAE.framework:-
AEDescType,AEEventClass, andAEEventIDnewtype structs overFourCharCode. -
AEReturnIDnewtype struct overi16. -
AETransactionIDandAESendModenewtype structs overi32. -
AEDataStorageandAEDataStorageTypepointer type aliases.
-
-
-
Created
core_animationmodule for Core Animation framework. -
Created
core_imagemodule for Core Image framework. -
Created
core_videomodule for Core Video framework. -
Created
core_audiomodule for Core Audio framework. -
Created
core_textmodule for Core Text framework. -
Created
system_configurationmodule for System Configuration framework. -
Created
cf_networkmodule for CFNetwork framework. -
Created
io_kitmodule for IOKit framework. -
Added APIs to
foundationmodule:-
Constants:
NSNotFound. -
Types:
NSNumber,NSEdgeInsets,NSRange,NSValue,NSNull,NSException,NSExceptionName,NSError,NSErrorDomain,NSErrorUserInfoKey,NSErrorRecoveryAttempting,NSTimeInterval. -
NSErrorerror 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_strand 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_countfor number of available encodings. This callsavailable_encodings_slice().len().
-
-
Methods for
NSStringEncoding:-
name. -
Methods for getting all available
NSStringEncodings.
-
-
-
Added APIs to
core_foundationmodule:-
Constants:
kCFNotFound. -
Types:
CFType,CFTypeRef,CFTypeID,CFOptionFlags,CFIndex,CFHashCode,CFComparisonResult,CFAllocator,CFAllocatorContext,CFNumber,CFNumberType,CFBoolean. -
Callback function type aliases for
CFAllocator.
-
-
Added APIs to
objcmodule:-
Pointer methods for
Sel. -
Implemented
PartialEqforNSObject. -
autoreleasepoolfunction equivalent to@autoreleasepoolthat drains on panic. -
BOOL::NOandBOOL::YESassociated constants as alternatives to the freestanding constants. These should be preferred.
-
-
[breaking]
NSStringto&strconversion now uses the correct length in spite of interior nulls. Previously the C string length was used. -
Correct dispatching of the appropriate
objc_msgSendbased on return type. -
[breaking] The safety of
DispatchQueue::current_queue_label_ownedby marking it asunsafe. It is unspecified whether the label may outlive the current queue. -
The signed-ness of
BOOLon platforms where it is asigned char. -
[breaking] The memory representation of
BOOLon 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.
&NSStringin 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
classon Objective-C objects from static toself. -
[breaking] Renamed
SELtoSel. -
[breaking] Renamed
get_classtoclassfor Objective-C objects. -
[breaking] Renamed
nsstring!macro tons_string!. -
[breaking] Renamed constants in
NSStringEncodingto be simpler and use UPPER_SNAKE_CASE. -
[breaking] Changed
BOOLfrom 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.
foundationtransitively enablesobjc.
-
[breaking] Removed the
linkcargo 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.