diff options
| -rw-r--r-- | .vscode/settings.json | 3 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | examples/tcp_async.rs (renamed from examples/echo.rs) | 2 | ||||
| -rw-r--r-- | examples/udp_sync.rs | 3 | ||||
| -rw-r--r-- | src/executor.rs | 2 | ||||
| -rw-r--r-- | src/lib.rs | 3 | ||||
| -rw-r--r-- | src/net/mod.rs | 2 | ||||
| -rw-r--r-- | src/net/tcp.rs (renamed from src/tcp.rs) | 0 | ||||
| -rw-r--r-- | src/net/udp.rs (renamed from src/udp.rs) | 0 |
10 files changed, 15 insertions, 9 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 12052b8..f728a93 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,9 @@ "**/target": true }, "lldb.verboseLogging": true, + "rust-analyzer.linkedProjects": [ + "./Cargo.toml" + ], // "rust-analyzer.linkedProjects": [ // "./timer_future/Cargo.toml" // ] @@ -1,5 +1,4 @@ [package] -authors = ["ihciah <[email protected]>"] edition = "2021" name = "mini-rust-runtime" version = "0.1.0" @@ -1,7 +1,7 @@ # Mini Rust Runtime -To show how a runtime works. +实验性质 rust runtime 功能接口不断变更中. -The related post: [Rust Runtime 设计与实现-科普篇](https://www.ihcblog.com/rust-runtime-design-1/) - -Ref: https://github.com/fujita/greeter
\ No newline at end of file +fork 自 [mini-rust-runtime](https://github.com/ihciah/mini-rust-runtime) +- [Rust Runtime 设计与实现-科普篇](https://www.ihcblog.com/rust-runtime-design-1/) +- Ref: https://github.com/fujita/greeter diff --git a/examples/echo.rs b/examples/tcp_async.rs index 11429e2..50c5ed6 100644 --- a/examples/echo.rs +++ b/examples/tcp_async.rs @@ -3,7 +3,7 @@ use futures::StreamExt; use mini_rust_runtime::executor::Executor; -use mini_rust_runtime::tcp::TcpListener; +use mini_rust_runtime::net::tcp::TcpListener; use tokio::io::{AsyncReadExt, AsyncWriteExt}; fn main() { diff --git a/examples/udp_sync.rs b/examples/udp_sync.rs index b33ec35..8187ac0 100644 --- a/examples/udp_sync.rs +++ b/examples/udp_sync.rs @@ -1,3 +1,6 @@ +//! Echo example. +//! Use `nc -u 127.0.0.1 30000` to connect. + use std::net::UdpSocket; fn main() -> std::io::Result<()> { diff --git a/src/executor.rs b/src/executor.rs index 9832d88..5d9e201 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -78,7 +78,7 @@ impl Executor { while let Some(t) = self.local_queue.pop() { let future = t.future.borrow_mut(); let w = waker(t.clone()); // Waker 实例 - let mut context = Context::from_waker(&w); // Context 实例 + let mut context: Context<'_> = Context::from_waker(&w); // Context 实例 let _ = Pin::new(future).as_mut().poll(&mut context); // poll } @@ -1,7 +1,6 @@ #![allow(unused)] pub mod executor; -pub mod tcp; -pub mod udp; +pub mod net; mod reactor; diff --git a/src/net/mod.rs b/src/net/mod.rs new file mode 100644 index 0000000..a6f6844 --- /dev/null +++ b/src/net/mod.rs @@ -0,0 +1,2 @@ +pub mod tcp; +pub mod udp;
\ No newline at end of file diff --git a/src/tcp.rs b/src/net/tcp.rs index 94b876a..94b876a 100644 --- a/src/tcp.rs +++ b/src/net/tcp.rs diff --git a/src/udp.rs b/src/net/udp.rs index 0a6a391..0a6a391 100644 --- a/src/udp.rs +++ b/src/net/udp.rs |
