Skip to content

Commit 3dbfc3d

Browse files
sarskojorajeevbkragl
authored
Add shuttle-tokio (#238)
* Add shuttle-tokio Co-authored-by: Rajeev Joshi <jorajeev@amazon.com> Co-authored-by: Bernhard Kragl <kraglb@amazon.com> * Comment cleanup * Make blog and rate_limiter tests compile * Remove blog and rate limiter tests * Clippies * Address comments --------- Co-authored-by: Rajeev Joshi <jorajeev@amazon.com> Co-authored-by: Bernhard Kragl <kraglb@amazon.com>
1 parent 09cae00 commit 3dbfc3d

File tree

127 files changed

+18976
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+18976
-0
lines changed

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ members = [
44
"wrappers/shuttle_rand_0.8",
55
"wrappers/shuttle_sync",
66
"wrappers/lazy_static",
7+
"wrappers/tokio/impls/tokio",
8+
"wrappers/tokio/impls/tokio-macros",
9+
"wrappers/tokio/impls/tokio-stream",
10+
"wrappers/tokio/impls/tokio-test",
11+
"wrappers/tokio/impls/tokio-util",
12+
"wrappers/tokio/wrappers/shuttle-tokio",
13+
"wrappers/tokio/wrappers/shuttle-tokio-stream",
714
]
815

916
resolver = "2"

wrappers/tokio/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Shuttle support for `tokio`
2+
3+
This folder contains the implementation and wrapper that enables testing of [tokio](https://crates.io/crates/tokio) applications with Shuttle.
4+
5+
## How to use
6+
7+
To use it, add the following in your Cargo.toml:
8+
9+
```
10+
[features]
11+
shuttle = [
12+
"tokio/shuttle",
13+
]
14+
15+
[dependencies]
16+
tokio = { package = "shuttle-tokio", version = "VERSION_NUMBER" }
17+
```
18+
19+
The code will then behave as before when the `shuttle` feature flag is not provided, and will run with Shuttle-compatible primitives when the `shuttle` feature flag is provided.
20+
21+
## Limitations
22+
23+
Shuttle's tokio support does not currently model all tokio functionality. Some parts of tokio have not been implemented or may not be modeled faithfully. Keep this in mind when using Shuttle with tokio, as you may encounter missing functionality that needs to be added. If you encounter missing features, please file an issue or, better yet, open a PR to contribute the functionality.
24+
25+
The list of constructs not supported by Shuttle are in [Issue 241](https://github.com/awslabs/shuttle/issues/241)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "shuttle-tokio-macros-impl"
3+
version = "0.1.0" # Forked from "2.2.0"
4+
edition = "2021"
5+
6+
[lib]
7+
proc-macro = true
8+
9+
[features]
10+
11+
[dependencies]
12+
proc-macro2 = "1.0.60"
13+
quote = "1"
14+
syn = { version = "2.0", features = ["full"] }
15+
shuttle = { path = "../../../../shuttle" }
16+
proc-macro-crate = "3.1.0"
17+
18+
[dev-dependencies]
19+
shuttle-tokio = { package = "shuttle-tokio-impl", path = "../tokio", version = "*" }
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Copyright (c) 2023 Tokio Contributors
2+
3+
Permission is hereby granted, free of charge, to any
4+
person obtaining a copy of this software and associated
5+
documentation files (the "Software"), to deal in the
6+
Software without restriction, including without
7+
limitation the rights to use, copy, modify, merge,
8+
publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software
10+
is furnished to do so, subject to the following
11+
conditions:
12+
13+
The above copyright notice and this permission notice
14+
shall be included in all copies or substantial portions
15+
of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25+
DEALINGS IN THE SOFTWARE.
26+
27+
The MIT License (MIT)
28+
29+
Copyright (c) 2019 Yoshua Wuyts
30+
31+
Permission is hereby granted, free of charge, to any person obtaining a copy
32+
of this software and associated documentation files (the "Software"), to deal
33+
in the Software without restriction, including without limitation the rights
34+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35+
copies of the Software, and to permit persons to whom the Software is
36+
furnished to do so, subject to the following conditions:
37+
38+
The above copyright notice and this permission notice shall be included in all
39+
copies or substantial portions of the Software.
40+
41+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47+
SOFTWARE.

0 commit comments

Comments
 (0)