Overview

Pyrite - Rust and Python

Ready for production? No. Use it anyway!

See the examples for how to write an extension module in Rust. It's very similar to writing in C. Every example should produce an extension module called hello with a function my_function which takes no arguments and returns 3.

See the great blog post here. It's about Ruby, but the advice applies to any embedding of Rust: http://brson.github.io/2013/03/10/embedding-rust-in-ruby/

Remember to write your functions as extern, and #[no_mangle].

Caveats:

  • Can't use @ or anything that uses @
    • (Can't use core::io!)
  • Can't use fail!
  • Can't use tasks

Acknowledgements

This work would not have been possible without the wonderful Rust developers, who hang out in #rust and answer my stupid questions.

A very special thank you goes to James Miller (aatch in #rust), who has been a huge help for some of my hardest problems. I also owe thanks to Luqman, without whom this project would have failed very early on.

Also, the name of this package comes from an HN user named phaemon. Thanks dude!