base on A small and fast async runtime for Rust # smol [![Build](https://github.com/smol-rs/smol/actions/workflows/ci.yml/badge.svg)]( https://github.com/smol-rs/smol/actions) [![License](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue.svg)]( https://github.com/smol-rs/smol) [![Cargo](https://img.shields.io/crates/v/smol.svg)]( https://crates.io/crates/smol) [![Documentation](https://docs.rs/smol/badge.svg)]( https://docs.rs/smol) [![Chat](https://img.shields.io/matrix/smol-rs%3Amatrix.org)]( https://matrix.to/#/#smol-rs:matrix.org) <img src="https://raw.githubusercontent.com/smol-rs/smol/master/assets/images/logo_fullsize_transparent.png" alt="kitty" width="100px" style="float: left;" /> 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. See the [`smol-macros`] crate if you want a no proc-macro, fast compiling, easy-to-use async main and/or multi-threaded Executor setup out of the box. ## Examples Connect to an HTTP website, make a GET request, and pipe the response to the standard output: ```rust,no_run 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. [`async-compat`]: https://docs.rs/async-compat/latest/async_compat/ [`smol-macros`]: https://docs.rs/smol-macros/latest/smol_macros/ [examples]: https://github.com/smol-rs/smol/tree/master/examples ## Subcrates - [async-channel] - Multi-producer multi-consumer channels - [async-executor] - Composable async executors - [async-fs] - Async filesystem primitives - [async-io] - Async adapter for I/O types, also timers - [async-lock] - Async locks (barrier, mutex, reader-writer lock, semaphore) - [async-net] - Async networking primitives (TCP/UDP/Unix) - [async-process] - Async interface for working with processes - [async-task] - Task abstraction for building executors - [blocking] - A thread pool for blocking I/O - [futures-lite] - A lighter fork of [futures] - [polling] - Portable interface to epoll, kqueue, event ports, and wepoll [async-io]: https://github.com/smol-rs/async-io [polling]: https://github.com/smol-rs/polling [nb-connect]: https://github.com/smol-rs/nb-connect [async-executor]: https://github.com/smol-rs/async-executor [async-task]: https://github.com/smol-rs/async-task [blocking]: https://github.com/smol-rs/blocking [futures-lite]: https://github.com/smol-rs/futures-lite [smol]: https://github.com/smol-rs/smol [async-net]: https://github.com/smol-rs/async-net [async-process]: https://github.com/smol-rs/async-process [async-fs]: https://github.com/smol-rs/async-fs [async-channel]: https://github.com/smol-rs/async-channel [concurrent-queue]: https://github.com/smol-rs/concurrent-queue [event-listener]: https://github.com/smol-rs/event-listener [async-lock]: https://github.com/smol-rs/async-lock [fastrand]: https://github.com/smol-rs/fastrand [futures]: https://github.com/rust-lang/futures-rs ## 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](https://github.com/jsha/minica) and [openssl](https://www.openssl.org/): ```text 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]. [mkcert]: https://github.com/FiloSottile/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](https://packages.debian.org/stable/rust/rustc). 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 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 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. ", Assign "at most 3 tags" to the expected json: {"id":"13187","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"