diff options
| author | tinaun <tinagma@gmail.com> | 2017-10-10 04:42:59 -0400 |
|---|---|---|
| committer | tinaun <tinagma@gmail.com> | 2017-10-10 04:42:59 -0400 |
| commit | 364148dbf9d7a3e4a8e0c766ae3395f63fcb5a01 (patch) | |
| tree | 172b74ec02991799815290859f672ca816045223 | |
| parent | 7735f59e8084a69361224da2b1bc7337214c2c85 (diff) | |
| download | rust-364148dbf9d7a3e4a8e0c766ae3395f63fcb5a01.tar.gz rust-364148dbf9d7a3e4a8e0c766ae3395f63fcb5a01.zip | |
unstable book: unboxed_closures
| -rw-r--r-- | src/doc/unstable-book/src/language-features/unboxed-closures.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/unboxed-closures.md b/src/doc/unstable-book/src/language-features/unboxed-closures.md new file mode 100644 index 00000000000..5146fcd8739 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/unboxed-closures.md @@ -0,0 +1,25 @@ +# `unboxed_closures` + +The tracking issue for this feature is [#29625] + +See Also: [`fn_traits`](library-features/fn-traits.md) + +[#29625]: https://github.com/rust-lang/rust/issues/29625 + +---- + +The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI, +required for implmenting the [`Fn*`] family of traits. `"rust-call"` functions must have +exactly one (non self) argument, a tuple representing the argument list. + +[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html + +```rust +#![feature(unboxed_closures)] + +extern "rust-call" fn add_args(args: (u32, u32)) { + args.0 + args.1 +} + +fn main() {} +``` |
