objc2-encode
Objective-C type-encoding in Rust.
The Objective-C directive @encode encodes types as strings for usage in
various places in the runtime.
This crate provides the Encoding type to describe and compare these
type-encodings without memory allocation.
Additionally it provides traits for annotating types that has a corresponding
Objective-C encoding, respectively Encode for structs and RefEncode for
references (and EncodeArguments for function arguments).
These types are exported under the objc2 crate as well, so usually you would
just use that.
Examples
Implementing Encode and RefEncode:
use ;
unsafe
assert_eq!;
unsafe
assert_eq!;
An Encoding can be compared with an encoding string from the Objective-C
runtime:
use Encode;
assert!;
Encoding implements Display as its string representation. This can be
generated conveniently through the to_string method:
use Encode;
assert_eq!;
See the examples folder for more complex usage.