Go to file
dependabot[bot] 641326b54f Update http requirement from 0.2 to 1.1
Updates the requirements on [http](https://github.com/hyperium/http) to permit the latest version.
- [Release notes](https://github.com/hyperium/http/releases)
- [Changelog](https://github.com/hyperium/http/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/http/compare/v0.2.0...v1.1.0)

---
updated-dependencies:
- dependency-name: http
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 07:30:05 -07:00
.github Update actions/checkout action to v4 2023-09-10 18:28:30 +09:00
assets/images docs: Use the new smol logo in docs and README 2023-07-16 07:22:16 -07:00
examples ex: Use smol-hyper in hyper-server example 2024-01-15 17:54:46 -08:00
src Run the process driver on the executor thread 2023-11-02 06:38:41 -07:00
.gitignore Lots of changes 2020-04-21 17:51:24 +02:00
CHANGELOG.md v2.0.0 2023-12-31 10:42:28 -08:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md 2020-05-16 22:34:11 +02:00
Cargo.toml Update http requirement from 0.2 to 1.1 2024-03-11 07:30:05 -07:00
LICENSE-APACHE Add readme and licenses 2020-02-04 11:32:22 +01:00
LICENSE-MIT Add readme and licenses 2020-02-04 11:32:22 +01:00
README.md docs: Add link to Matrix chat to README 2024-01-15 17:40:30 -08:00

README.md

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.