Rust README to new format
This commit is contained in:
parent
32e266cfb4
commit
13a9e00fff
1 changed files with 44 additions and 35 deletions
|
@ -1,51 +1,60 @@
|
||||||
#+TITLE: :lang rust
|
#+TITLE: lang/rust
|
||||||
|
#+DATE: June 5, 2019
|
||||||
|
#+SINCE: {replace with next tagged release version}
|
||||||
|
#+STARTUP: inlineimages
|
||||||
|
|
||||||
#+begin_quote
|
* Table of Contents :TOC_3:noexport:
|
||||||
This module is a work in progress.
|
- [[#description][Description]]
|
||||||
#+end_quote
|
- [[#module-flags][Module Flags]]
|
||||||
|
- [[#plugins][Plugins]]
|
||||||
|
- [[#prerequisites][Prerequisites]]
|
||||||
|
- [[#features][Features]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
- [[#racer-installation-problems][Racer installation problems]]
|
||||||
|
|
||||||
This module adds [[https://www.rust-lang.org][Rust]] support to Emacs.
|
* Description
|
||||||
|
Add support to Rust-lang and cargo.
|
||||||
|
|
||||||
|
** Module Flags
|
||||||
|
+ ~+lsp~ to add support Language server protocol.
|
||||||
|
|
||||||
|
** Plugins
|
||||||
+ Code completion (~racer~)
|
+ Code completion (~racer~)
|
||||||
+ Syntax checking (~flycheck~)
|
+ Syntax checking (~flycheck~)
|
||||||
+ Eldoc support (~go-eldoc~)
|
+ Snippets
|
||||||
+ [[https://github.com/hlissner/emacs-snippets/tree/master/rust-mode][Snippets]]
|
|
||||||
|
|
||||||
#+begin_quote
|
* Prerequisites
|
||||||
...
|
|
||||||
#+end_quote
|
|
||||||
|
|
||||||
* Table of Contents :TOC:
|
|
||||||
- [[#install][Install]]
|
|
||||||
- [[#rust][Rust]]
|
|
||||||
- [[#dependencies][Dependencies]]
|
|
||||||
|
|
||||||
* Install
|
|
||||||
** Rust
|
|
||||||
To get started with Rust, you can either use =rustup= and install rust with:
|
To get started with Rust, you can either use =rustup= and install rust with:
|
||||||
|
|
||||||
~curl https://sh.rustup.rs -sSf | sh~
|
~curl https://sh.rustup.rs -sSf | sh~
|
||||||
|
|
||||||
Or through your package manager (which is my preference):
|
Package manager is not recommended to install Nightly version of Rust what is
|
||||||
|
required for ~racer~ from [[https://github.com/racer-rust/racer#installation][version 2.1]] (more info in [[Troubleshooting][Troubleshooting]])
|
||||||
|
|
||||||
*** MacOS
|
* Features
|
||||||
#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes")
|
This module also supports LSP, it requires installation of Rust Language Server
|
||||||
brew install rust
|
[[https://github.com/rust-lang/rls][~RLS~]]. To enable this you need to enable ~lsp~ in ~:tools~ section in ~init.el~ file.
|
||||||
cargo install racer
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*** Arch Linux
|
Keybindings
|
||||||
#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes")
|
|
||||||
sudo pacman --needed --noconfirm -S rust rust-racer
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Dependencies
|
| Binding | Description |
|
||||||
This module requires ~racer~ for code completion, which also requires access to Rust's source code.
|
|---------------------+---------------|
|
||||||
|
| ~<localleader> b b~ | ~cargo build~ |
|
||||||
|
| ~<localleader> b c~ | ~cargo check~ |
|
||||||
|
| ~<localleader> b r~ | ~cargo run~ |
|
||||||
|
| ~<localleader> b t~ | ~cargo test~ |
|
||||||
|
|
||||||
|
* TODO Configuration
|
||||||
|
How to configure this module, including common problems and how to address them.
|
||||||
|
|
||||||
|
* Troubleshooting
|
||||||
|
** Racer installation problems
|
||||||
|
Racer need now ([[https://github.com/racer-rust/racer#installation][From 2.1 version]]) nightly version of Rust
|
||||||
|
|
||||||
|
If you installed trough rustup
|
||||||
#+BEGIN_SRC sh
|
#+BEGIN_SRC sh
|
||||||
cargo install racer
|
rustup toolchain add nightly
|
||||||
git clone https://github.com/rust-lang/rust $RUST_SRC_PATH
|
|
||||||
|
cargo +nightly install racer
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Either set ~$RUST_SRC_PATH~ in your shell (so that it's available in Emacs), or adjust ~+rust-src-dir~ to point at the correct directory.
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue