ref.rust - jgrey4296/jgrey4296.github.io GitHub Wiki

Rust

Packages

Reference

Syntax

Mutability

Ownership

Borrowing

Unsafe Rust

Testing

rustc

https://doc.rust-lang.org/rustc/index.html

rustc --help

View generated code from procedural macros

https://pyo3.rs/v0.22.6/debugging

cargo rustc --profile=check -- -Z unstable-options --pretty=expanded > expanded.rs; rustfmt expanded.rs

rustup

https://rust-lang.github.io/rustup/index.html https://rustup.rs/

rustup --help

Cargo

Project creation, bin for program, nothing for lib:

cargo new hello_cargo --bin

Creates a toml file for config:

[package]
name    = "test"
version = "0.1.0"
authors = ["John Grey <mail>"]

[dependencies]

Run with cargo build, cargo run With optimizations: cargo build –release

CLI Usage

cargo --help

Add Dependencies

cargo add {dep}

Cargo-Doc

https://doc.rust-lang.org/rustdoc/index.html

Maturin

https://www.maturin.rs/ https://docs.python.org/3/c-api/index.html

see ..env/include/python{version}/Python.h

maturin --help

Emacs

http://diobla.info/blog-archive/modules-tut.html https://docs.rs/emacs/latest/emacs/ https://phst.eu/emacs-modules.html https://ryanfaulhaber.com/posts/first-emacs-module-rust/

See emacs-src/emacs-module.h

Emacs needs a {name}.so file, not lib{name}.so

[lib]
name = "testlib"
crate-type = ["cdylib"]
(module-load (expand-file-name "..build/debug/libtestlib.so"))

;; Function are prefixed with module name
(testlib-say-hello "blah")

Sphinx-Rust

https://sphinx-rust.readthedocs.io/en/latest/index.html

Specifics

Bare Metal

https://docs.rust-embedded.org/book/

Emacs

http://diobla.info/blog-archive/modules-tut.html

https://docs.rs/emacs/latest/emacs/

https://github.com/Wilfred/remacs

https://github.com/jkitchin/emacs-modules

https://github.com/ubolonton/emacs-module-rs

https://phst.eu/emacs-modules.html

https://ryanfaulhaber.com/posts/first-emacs-module-rust/

Python

Py03

https://github.com/PyO3/pyo3

Elixir

https://fly.io/phoenix-files/elixir-and-rust-is-a-good-mix/ https://hambly.dev/rust-nifs-in-elixir

Examples

Hello world

fn main(){
    //a print macro, denoted by !
    println!("Hello world");
}

Links

https://paandahl.github.io/rust-interop/c-intro.html https://jakegoulding.com/rust-ffi-omnibus/

http://cantrip.org/rust-vs-c++.html

http://diobla.info/blog-archive/modules-tut.html

http://www.garin.io/rust-vs-c-pitfalls

https://anexen.github.io/pyxirr/

https://bevyengine.org/

https://blog.logrocket.com/debugging-rust-apps-with-gdb/

https://blog.m-ou.se/super-let/

https://codeburst.io/how-to-use-rust-to-extend-python-360174ee5819?gi=f1a56fa91873

https://crates.io/crates/cargo-make#installation

https://dev.to/xs/setting-up-rust-on-macos-in-a-clean-way-13d1

https://doc.rust-lang.org/book/

https://doc.rust-lang.org/cargo/

https://doc.rust-lang.org/rust-by-example/index.html

https://doc.rust-lang.org/stable/rust-by-example/index.html

https://docs.python.org/3/extending/building.html#building

https://docs.rs/emacs/latest/emacs/

https://docs.rs/rustler/latest/rustler/

https://docs.rust-embedded.org/book/interoperability/c-with-rust.html

https://faultlore.com/blah/rust-layouts-and-abis/

https://faultlore.com/blah/swift-abi/

https://faultlore.com/cargo-mommy/

https://federicoterzi.com/blog/12-rust-tips-and-tricks-you-might-not-know-yet/

https://firefox-source-docs.mozilla.org/writing-rust-code/cpp-interop.html

https://fly.io/phoenix-files/elixir-and-rust-is-a-good-mix/

https://github.com/EbTech/rust-algorithms

https://github.com/Geal/nom

https://github.com/PyO3/pyo3

https://github.com/PyO3/setuptools-rust

https://github.com/Wilfred/remacs

https://github.com/andelf/rust-erlang-driver

https://github.com/chevyray/rust-gamedev

https://github.com/citybound/citybound

https://github.com/garkimasera/rusted-ruins

https://github.com/godot-rust/godot-rust

https://github.com/icedland/iced?tab=readme-ov-file

https://github.com/jkitchin/emacs-modules

https://github.com/rust-lang/rust/issues/33062

https://github.com/rust-unofficial/awesome-rust

https://github.com/rust-unofficial/patterns

https://github.com/sagiegurari/cargo-make

https://github.com/sile/erl_dist

https://github.com/typst/typst

https://github.com/ubolonton/emacs-module-rs

https://godot-rust.github.io/book/getting-started.html

https://godot-rust.github.io/book/index.html

https://hambly.dev/rust-nifs-in-elixir

https://hermanradtke.com/2016/08/08/introduction-to-nom-rust-parsing-combinator-framework.html/

https://immunant.com/blog/2019/12/header_merging/

https://just.systems/man/en/chapter_1.html

https://jvns.ca/

https://jvns.ca/blog/2022/12/02/a-couple-of-rust-error-messages/

https://lucumr.pocoo.org/2015/5/27/rust-for-pythonistas/

https://medium.com/@still-key6292/21-rust-questions-in-21-days-cac1e1fd6a2b

https://nnethercote.github.io/perf-book/title-page.html

https://pascalhertleif.de/artikel/good-practices-for-writing-rust-libraries/

https://phst.eu/emacs-modules.html

https://pola.rs/

https://riptutorial.com/rust/example/5933/passing-lambdas-around

https://rust-lang.github.io/mdBook/

https://rust-lang.github.io/rustup/index.html

https://rust.godbolt.org/

https://rustc-dev-guide.rust-lang.org/about-this-guide.html

https://ryanfaulhaber.com/posts/first-emacs-module-rust/

https://stackoverflow.com/questions/24664994/debugging-rust-with-gdb

https://stackoverflow.com/questions/37586216/step-by-step-interactive-debugger-for-rust

https://thephd.dev/

https://without.boats/blog/poll-next/

https://www.areweguiyet.com/

https://www.jntrnr.com/why-i-left-rust/

https://www.maturin.rs/

https://www.ncameron.org/blog/how-the-rls-works/

https://www.rust-lang.org/en-US/

https://zsiciarz.github.io/24daysofrust/index.html

⚠️ **GitHub.com Fallback** ⚠️