MyGit
🚩收到GitHub仓库的更新通知

smol-rs/smol

Fork: 148 Star: 3434 (更新于 2024-05-12 09:50:44)

license: Apache-2.0

Language: Rust .

A small and fast async runtime for Rust

最后发布版本: v2.0.0 ( 2024-01-01 02:43:07)

GitHub网址

✨免费申请网站SSL证书,支持多域名和泛域名,点击查看

smol

Build License Cargo Documentation Chat

kitty

A small and fast async runtime.

This crate simply re-exports other smaller async crates (see the source).

To use tokio-based libraries with smol, apply the async-compat adapter to futures and I/O types.

Examples

Connect to an HTTP website, make a GET request, and pipe the response to the standard output:

use smol::{io, net, prelude::*, Unblock};

fn main() -> io::Result<()> {
    smol::block_on(async {
        let mut stream = net::TcpStream::connect("example.com:80").await?;
        let req = b"GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n";
        stream.write_all(req).await?;

        let mut stdout = Unblock::new(std::io::stdout());
        io::copy(stream, &mut stdout).await?;
        Ok(())
    })
}

There's a lot more in the examples directory.

Subcrates

TLS certificate

Some code examples are using TLS for authentication. The repository contains a self-signed certificate usable for testing, but it should not be used for real-world scenarios. Browsers and tools like curl will show this certificate as insecure.

In browsers, accept the security prompt or use curl -k on the command line to bypass security warnings.

The certificate file was generated using minica and openssl:

minica --domains localhost -ip-addresses 127.0.0.1 -ca-cert certificate.pem
openssl pkcs12 -export -out identity.pfx -inkey localhost/key.pem -in localhost/cert.pem

Another useful tool for making certificates is mkcert.

MSRV Policy

The Minimum Supported Rust Version (MSRV) of this crate is 1.63. As a tentative policy, the MSRV will not advance past the current Rust version provided by Debian Stable. At the time of writing, this version of Rust is 1.63. However, the MSRV may be advanced further in the event of a major ecosystem shift or a security vulnerability.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

最近版本更新:(数据更新于 2024-05-19 19:40:35)

2024-01-01 02:43:07 v2.0.0

2022-11-29 21:47:44 v1.3.0

主题(topics):

async, concurrency, futures, networking, runtime, rust

smol-rs/smol同语言 Rust最近更新仓库

2024-05-19 19:06:52 actix/actix-web

2024-05-19 09:11:47 lapce/lapce

2024-05-18 17:46:26 extrawurst/gitui

2024-05-18 09:51:52 slawlor/ractor

2024-05-17 20:37:18 hyperium/h2

2024-05-16 01:31:34 tauri-apps/tauri