ssheldon / rust-block Goto Github PK
View Code? Open in Web Editor NEWRust interface for Apple's C language extension of blocks.
Home Page: https://crates.io/crates/block
Rust interface for Apple's C language extension of blocks.
Home Page: https://crates.io/crates/block
It looks like you may have moved on to other things, would you consider accepting additional maintainers? I'd like to see the open PRs make progress. Thanks!
For example:
/Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs:210:25: 210:39 warning: `unsafe extern "C" fn(*mut ConcreteBlock<(), isize, isize>) -> isize {X.IntoConcreteBlock<()>::into_concrete_block::concrete_block_invoke_args0::<isize, isize>}` is now zero-sized and has to be cast to a pointer before transmuting to `unsafe extern "C" fn(*mut ConcreteBlock<(), isize, isize>, ...) -> isize`, #[warn(transmute_from_fn_item_types)] on by default
/Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs:210 mem::transmute($f::<$($t,)* R, X>), self)
^~~~~~~~~~~~~~
/Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs:192:9: 192:35 note: in this expansion of concrete_block_impl! (defined in /Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs)
/Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs:217:1: 217:51 note: in this expansion of concrete_block_impl! (defined in /Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs)
/Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs:210:25: 210:39 warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
/Users/servo/.cargo/registry/src/github.com-88ac128001ac3a9a/block-0.1.4/src/lib.rs:210:25: 210:39 note: for more information, see issue #19925 <https://github.com/rust-lang/rust/issues/19925>
It is important to copy your block to the heap (with the copy method) before passing it to Objective-C; this is because our ConcreteBlock is only meant to be copied once, and we can enforce this in Rust, but if Objective-C code were to copy it twice we could have a double free.
This is really unfortunate and error prone. It would be great to leverage the type system to do this automatically for us or at least enforce safety at compile time.
I tried using the alpha 6 of block2
, which lead me to objc2_encode
which asked me to implement Encode
and RefEncode
libc
, e.g. stat
, I either have to stop and not implement the traits or I have to go deep to find if there are pointers/members to other structs where I have to do the same until I reach only base types. In the case of pointers I don't even know how I would do it ? A mimic struct defined locally which implements Encode
?I don't know if there is a good solution to 2. sadly, because adding a dep in libc on objc2_encode
is certainly not going to work.
For packaging of downstream packages it would be nice to have a dedicated license which is used to gather all licenses of all depencies and repackage these license files.
Examples would be really nice.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.