-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update 19.5 to demonstrate using impl Trait to
return closures in addition to boxed trait objects
- Loading branch information
1 parent
d94e03a
commit f700d0a
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
listings/ch19-advanced-features/no-listing-23-returns-closure-impl-trait/Cargo.lock
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
listings/ch19-advanced-features/no-listing-23-returns-closure-impl-trait/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "functions-example" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
3 changes: 3 additions & 0 deletions
3
listings/ch19-advanced-features/no-listing-23-returns-closure-impl-trait/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn returns_closure() -> impl Fn(i32) -> i32 { | ||
|x| x + 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters