mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
parent
a8c992236e
commit
27c8845075
2 changed files with 9 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
These is a proposed port of fish-shell from C++ to Rust, and from CMake to cargo or related. This document is high level - see the Development Guide for more details.
|
||||
These is a proposed port of fish-shell from C++ to Rust, and from CMake to cargo or related. This document is high level - see the [Development Guide] for more details.
|
||||
|
||||
## Why Port
|
||||
|
||||
|
@ -41,7 +41,7 @@ We will not use tokio, serde, async, or other fancy Rust frameworks initially.
|
|||
|
||||
### FFI
|
||||
|
||||
Rust/C++ interop will use [autocxx](https://github.com/google/autocxx), [Cxx](https://cxx.rs), and possibly [bindgen](https://rust-lang.github.io/rust-bindgen/). I've forked these for fish (see the Development Guide). Once the port is done, we will stop using them, except perhaps bindgen for PCRE2.
|
||||
Rust/C++ interop will use [autocxx](https://github.com/google/autocxx), [Cxx](https://cxx.rs), and possibly [bindgen](https://rust-lang.github.io/rust-bindgen/). I've forked these for fish (see the [Development Guide]). Once the port is done, we will stop using them, except perhaps bindgen for PCRE2.
|
||||
|
||||
We will use [corrosion](https://github.com/corrosion-rs/corrosion) for CMake integration.
|
||||
|
||||
|
@ -60,7 +60,7 @@ So instead of `String`, fish will use its own string type, and manage encoding a
|
|||
|
||||
After the port we can consider moving to UTF-8, for memory usage reasons.
|
||||
|
||||
See the Rust Development Guide for more on strings.
|
||||
See the [Rust Development Guide][Development Guide] for more on strings.
|
||||
|
||||
### Thread Safety
|
||||
|
||||
|
@ -75,3 +75,5 @@ Handwaving, 6 months? Frankly unknown - there's 102 remaining .cpp files of vari
|
|||
## Links
|
||||
|
||||
- [Packaging Rust projects](https://wiki.archlinux.org/title/Rust_package_guidelines) from Arch Linux
|
||||
|
||||
[Development Guide]: rust-devel.md
|
||||
|
|
|
@ -12,7 +12,7 @@ Important tools used during this transition:
|
|||
2. [cxx](http://cxx.rs) for basic C++ <-> Rust interop.
|
||||
3. [autocxx](https://google.github.io/autocxx/) for using C++ types in Rust.
|
||||
|
||||
We use forks of the last two - see the FFI section below. No special action is required to obtain these packages. They're downloaded by cargo.
|
||||
We use forks of the last two - see the [FFI section](#ffi) below. No special action is required to obtain these packages. They're downloaded by cargo.
|
||||
|
||||
## Building
|
||||
|
||||
|
@ -61,7 +61,7 @@ The basic development loop for this port:
|
|||
- Utility functions may have both a Rust and C++ implementation. An example is `FLOG` where interop is too hard.
|
||||
- Major components (e.g. builtin implementations) should _not_ be duplicated; instead the Rust should call C++ or vice-versa.
|
||||
|
||||
You will likely run into limitations of [`autocxx`](https://google.github.io/autocxx/) and to a lesser extent [`cxx`](https://cxx.rs/). See the FFI sections below.
|
||||
You will likely run into limitations of [`autocxx`](https://google.github.io/autocxx/) and to a lesser extent [`cxx`](https://cxx.rs/). See the [FFI sections](#ffi) below.
|
||||
|
||||
## Type Mapping
|
||||
|
||||
|
@ -104,7 +104,7 @@ There is also a `widestrs` proc-macro which enables L as a _suffix_, to reduce t
|
|||
```rust
|
||||
use crate::wchar::{wstr, widestrs}
|
||||
|
||||
[#widestrs]
|
||||
#[widestrs]
|
||||
fn get_shell_name() -> &'static wstr {
|
||||
"fish"L // equivalent to L!("fish")
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ The [autocxx guidance](https://google.github.io/autocxx/workflow.html#how-can-i-
|
|||
|
||||
## FFI
|
||||
|
||||
The boundary between Rust and C++ is referred to as the FII.
|
||||
The boundary between Rust and C++ is referred to as the Foreign Function Interface, or FFI.
|
||||
|
||||
`autocxx` and `cxx` both are designed for long-term interop: C++ and Rust coexisting for years. To this end, both emphasize safety: requiring lots of `unsafe`, `Pin`, etc.
|
||||
|
||||
|
|
Loading…
Reference in a new issue