hexilee / async-io-demo Goto Github PK
View Code? Open in Web Editor NEWdemo for rust asynchronous io: from mio to stackless coroutine
License: MIT License
demo for rust asynchronous io: from mio to stackless coroutine
License: MIT License
I have only tested this on windows. async-echo example
thread 'main' panicked at 'already borrowed: BorrowMutError', src\libcore\result.rs:997:5
stack backtrace:
0: std::sys::windows::backtrace::set_frames
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\sys\windows\backtrace\mod.rs:94
1: std::sys::windows::backtrace::unwind_backtrace
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\sys\windows\backtrace\mod.rs:81
2: std::sys_common::backtrace::_print
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\sys_common\backtrace.rs:70
3: std::sys_common::backtrace::print
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\sys_common\backtrace.rs:58
4: std::panicking::default_hook::{{closure}}
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:200
5: std::panicking::default_hook
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:215
6: std::panicking::rust_panic_with_hook
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:478
7: std::panicking::continue_panic_fmt
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:385
8: std::panicking::rust_begin_panic
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:312
9: core::panicking::panic_fmt
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libcore\panicking.rs:85
10: core::result::unwrap_failed<core::cell::BorrowMutError>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libcore\macros.rs:16
11: core::result::Result<core::cell::RefMut<slab::Slab<asyncio::executor::Task>>, core::cell::BorrowMutError>::expect<core::cell::RefMut<slab::Slab<asyncio::executor::Task>>,core::cell::BorrowMutError>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libcore\result.rs:825
12: core::cell::RefCell<slab::Slab<asyncio::executor::Task>>::borrow_mut<slab::Slab<asyncio::executor::Task>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libcore\cell.rs:876
13: asyncio::executor::spawn::{{closure}}<std::future::GenFuture<generator>>
at .\src\executor.rs:239
14: std::thread::local::LocalKey<asyncio::executor::Executor>::try_with<asyncio::executor::Executor,closure,core::result::Result<(), failure::error::Error>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\thread\local.rs:299
15: std::thread::local::LocalKey<asyncio::executor::Executor>::with<asyncio::executor::Executor,closure,core::result::Result<(), failure::error::Error>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\thread\local.rs:245
16: asyncio::executor::spawn<std::future::GenFuture<generator>>
at .\src\executor.rs:224
17: async_echo::main::{{closure}}
at .\examples\async-echo.rs:18
18: std::future::{{impl}}::poll::{{closure}}<generator>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\future.rs:36
19: std::future::set_task_waker<closure,core::task::poll::Poll<core::result::Result<(), failure::error::Error>>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\future.rs:67
20: std::future::{{impl}}::poll<generator>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\future.rs:36
21: asyncio::executor::block_on::{{closure}}<core::result::Result<(), failure::error::Error>,std::future::GenFuture<generator>>
at .\src\executor.rs:177
22: std::thread::local::LocalKey<asyncio::executor::Executor>::try_with<asyncio::executor::Executor,closure,core::result::Result<core::result::Result<(), failure::error::Error>, failure::error::Error>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\thread\local.rs:299
23: std::thread::local::LocalKey<asyncio::executor::Executor>::with<asyncio::executor::Executor,closure,core::result::Result<core::result::Result<(), failure::error::Error>, failure::error::Error>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\thread\local.rs:245
24: asyncio::executor::block_on<core::result::Result<(), failure::error::Error>,std::future::GenFuture<generator>>
at .\src\executor.rs:156
25: async_echo::main
at .\examples\async-echo.rs:12
26: std::rt::lang_start::{{closure}}<core::result::Result<(), failure::error::Error>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\rt.rs:64
27: std::rt::lang_start_internal::{{closure}}
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\rt.rs:49
28: std::panicking::try::do_call<closure,i32>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:297
29: panic_unwind::__rust_maybe_catch_panic
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libpanic_unwind\lib.rs:92
30: std::panicking::try
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panicking.rs:276
31: std::panic::catch_unwind
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\panic.rs:388
32: std::rt::lang_start_internal
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\/src\libstd\rt.rs:48
33: std::rt::lang_start<core::result::Result<(), failure::error::Error>>
at /rustc/e2f221c75932de7a29845c8d6f1f73536ad00c41\src\libstd\rt.rs:64
34: main
35: invoke_main
at d:\agent\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
36: __scrt_common_main_seh
at d:\agent\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
37: BaseThreadInitThunk
38: RtlUserThreadStart
error: process didn't exit successfully: `target\debug\examples\async-echo.exe` (exit code: 101)
OS: centos7
[weiby@login async_server]$ cargo --version
cargo 1.34.0-nightly (b33ce7fc9 2019-02-19)
[weiby@login async_server]$ rustc --version
rustc 1.34.0-nightly (e1c6d0057 2019-02-22)
[weiby@login async-io-demo]$ cargo run --example async-echo
Compiling asyncio v0.1.0 (/share/home/weiby/code/rust/async-io-demo)
error[E0432]: unresolved imports `std::task::LocalWaker`, `std::task::UnsafeWake`
--> src/executor.rs:12:23
|
12 | use std::task::{self, LocalWaker, UnsafeWake, Waker};
| ^^^^^^^^^^ ^^^^^^^^^^ no `UnsafeWake` in `task`
| |
| no `LocalWaker` in `task`
error[E0432]: unresolved import `std::task::LocalWaker`
--> src/fs_future.rs:10:23
|
10 | use std::task::{self, LocalWaker};
| ^^^^^^^^^^ no `LocalWaker` in `task`
warning: unused import: `Cell`
--> src/executor.rs:5:17
|
5 | use std::cell::{Cell, RefCell};
| ^^^^
|
= note: #[warn(unused_imports)] on by default
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0432`.
error: Could not compile `asyncio`.
To learn more, run the command again with --verbose.
在社交媒体上分享:
Facebook:
在 Facebook 上分享
Twitter:
在 Twitter 上分享
Instagram:
在 Reddit 上分享
连接您的钱包:
验证资格:
在分享和连接您的钱包后,等待 24 小时以验证您的资格。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.