Skip to content

Commit 4d5aecb

Browse files
committed
Fixes to Rust 1.64 blog post
1 parent 9019826 commit 4d5aecb

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

posts/2022-09-22-Rust-1.64.0.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ might come across!
3131

3232
## What's in 1.64.0 stable
3333

34-
### C-compatible ffi types in core and alloc
34+
### C-compatible FFI types in core and alloc
3535

36-
When calling or being called by C ABIs, Rust code can use types like `c_uint`
37-
or `c_ulong` to match the corresponding types from C on any target, without
38-
requiring target-specific code or conditionals.
36+
When calling or being called by C ABIs, Rust code can use type aliases like
37+
`c_uint` or `c_ulong` to match the corresponding types from C on any target,
38+
without requiring target-specific code or conditionals.
3939

40-
Previously, these types were only available in `std`, so code written for
41-
embedded targets and other scenarios that could only use `core` or `alloc`
40+
Previously, these type aliases were only available in `std`, so code written
41+
for embedded targets and other scenarios that could only use `core` or `alloc`
4242
could not use these types.
4343

44-
Rust 1.64 now provides all of the `c_*` types in
44+
Rust 1.64 now provides all of the `c_*` type aliases in
4545
[`core::ffi`](https://doc.rust-lang.org/core/ffi/index.html), as well as
4646
[`core::ffi::CStr`](https://doc.rust-lang.org/core/ffi/struct.CStr.html) for
4747
working with C strings. Rust 1.64 also provides
@@ -72,7 +72,9 @@ Such internal implementation details of the standard library are *never*
7272
considered a stable interface. Nonetheless, because multiple crates relied on
7373
this, we first worked with the authors of all of the still-maintained crates
7474
doing so to arrange for the release of new versions, and to yank the old ones,
75-
before making this change.
75+
before making this change. New releases for known affected crates have been out
76+
for typically over a year, and the vast majority of impacted users should be
77+
able to mitigate with a `cargo update` if needed."
7678

7779
See <https://github.com/rust-lang/rust/pull/78802> for more details.
7880

@@ -94,9 +96,9 @@ Rust 1.64 stabilizes the
9496
trait. `IntoFuture` is a trait similar to
9597
[`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html),
9698
but rather than supporting `for ... in ...` loops, `IntoFuture` changes how
97-
`.await` works. With `IntoFuture`, the `.await` keyword can await mor ethan
98-
just futures; it can await _anything which can be converted into a `Future` via
99-
`IntoFuture`_ - which can help make your APIs more user-friendly!
99+
`.await` works. With `IntoFuture`, the `.await` keyword can await more than
100+
just futures; it can await *anything which can be converted into a `Future` via
101+
`IntoFuture`* - which can help make your APIs more user-friendly!
100102

101103
Take for example a builder which constructs requests to some storage provider
102104
over the network:
@@ -128,6 +130,7 @@ let response = StorageRequest::new() // 1. create a new instance
128130
This is not bad, but we can do better here. Using `IntoFuture` we can combine
129131
_"construct the future"_ (line 3) and _"run the future"_ (line 4) into a single
130132
step:
133+
131134
```rust
132135
let response = StorageRequest::new() // 1. create a new instance
133136
.set_debug(true) // 2. set some option
@@ -168,6 +171,7 @@ impl IntoFuture for StorageRequest {
168171
}
169172
}
170173
```
174+
171175
This takes a bit more code to implement, but provides a simpler API for users.
172176

173177
In the future, the Rust Async WG hopes to simplify the creating new named

0 commit comments

Comments
 (0)