rust-objc
rust-objc copied to clipboard
Consider making objc no_std compatible
This crate is mainly just a wrapper around the objc runtime dylib, so it shouldn't need much else. If we can make it no_std then it might be usable in more places, perhaps even in the rust compiler itself.
The current std dependencies that aren't part of libcore are:
- Nul-terminating
&strviaCStringin the runtime module and the declare module - Reading the length of a C string via
CStrin the runtime module and forEncoding - Using a
StringinEncodingto store dynamically-sized, runtime defined type encodings - Allocating a buffer via
Stringwhen declaring methods to represent their type encodings in the declare module - Using a
Stringin the representation ofMessageError - Implementing the
Errortrait forMessageError - Using the
std::os::rawtypes instead of thelibctypes in the runtime module and for implementing theEncodetrait
Current thoughts on how this could be possible:
- [ ] #54: create a new string abstraction so nul-terminated strings can be passed to the runtime without us having to modify them and allocate new memory
- [x] #53: overhaul encoding, maybe make it generic so that it can sometimes be declared without any allocations
- [ ] break the declare module into a separate crate
- [ ] convert
MessageErrorinto an enum rather than backing it with aStringand remove theErrorconformance (rust-lang/rust#32500) - [ ] switch back to using
libcinstead ofstd::os::raw😕