nim-chronos
所属分类:工具库
开发工具:Nim
文件大小:0KB
下载次数:0
上传日期:2023-07-13 13:49:56
上 传 者:
sh-1993
说明: Chronos-一个高效的异步编程库,
(Chronos - An efficient library for asynchronous programming,)
文件列表:
LICENSE-APACHEv2 (11372, 2023-12-08)
LICENSE-MIT (1109, 2023-12-08)
chronos.nim (523, 2023-12-08)
chronos.nimble (2173, 2023-12-08)
chronos/ (0, 2023-12-08)
chronos/apps.nim (339, 2023-12-08)
chronos/apps/ (0, 2023-12-08)
chronos/apps/http/ (0, 2023-12-08)
chronos/apps/http/httpagent.nim (898, 2023-12-08)
chronos/apps/http/httpbodyrw.nim (3616, 2023-12-08)
chronos/apps/http/httpclient.nim (60793, 2023-12-08)
chronos/apps/http/httpcommon.nim (12176, 2023-12-08)
chronos/apps/http/httpdebug.nim (3916, 2023-12-08)
chronos/apps/http/httpserver.nim (60330, 2023-12-08)
chronos/apps/http/httptable.nim (6494, 2023-12-08)
chronos/apps/http/multipart.nim (25846, 2023-12-08)
chronos/apps/http/shttpserver.nim (6884, 2023-12-08)
chronos/asyncloop.nim (478, 2023-12-08)
chronos/asyncproc.nim (47807, 2023-12-08)
chronos/asyncsync.nim (21403, 2023-12-08)
chronos/config.nim (5740, 2023-12-08)
chronos/debugutils.nim (2428, 2023-12-08)
chronos/futures.nim (7949, 2023-12-08)
chronos/handles.nim (11077, 2023-12-08)
chronos/internal/ (0, 2023-12-08)
chronos/internal/asyncengine.nim (47104, 2023-12-08)
chronos/internal/asyncfutures.nim (58009, 2023-12-08)
chronos/internal/asyncmacro.nim (20148, 2023-12-08)
chronos/internal/errors.nim (309, 2023-12-08)
chronos/internal/raisesfutures.nim (6557, 2023-12-08)
chronos/ioselects/ (0, 2023-12-08)
chronos/ioselects/ioselectors_epoll.nim (25402, 2023-12-08)
chronos/ioselects/ioselectors_kqueue.nim (23455, 2023-12-08)
chronos/ioselects/ioselectors_poll.nim (10163, 2023-12-08)
... ...
# Chronos - An efficient library for asynchronous programming
[![Github action](https://github.com/status-im/nim-chronos/workflows/CI/badge.svg)](https://github.com/status-im/nim-chronos/actions/workflows/ci.yml)
[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)
## Introduction
Chronos is an efficient [async/await](https://en.wikipedia.org/wiki/Async/await) framework for Nim. Features include:
* Asynchronous socket and process I/O
* HTTP server with SSL/TLS support out of the box (no OpenSSL needed)
* Synchronization primitivies like queues, events and locks
* Cancellation
* Efficient dispatch pipeline with excellent multi-platform support
* Exceptional error handling features, including `raises` tracking
## Getting started
Install `chronos` using `nimble`:
```text
nimble install chronos
```
or add a dependency to your `.nimble` file:
```text
requires "chronos"
```
and start using it:
```nim
import chronos/apps/http/httpclient
proc retrievePage(uri: string): Future[string] {.async.} =
# Create a new HTTP session
let httpSession = HttpSessionRef.new()
try:
# Fetch page contents
let resp = await httpSession.fetch(parseUri(uri))
# Convert response to a string, assuming its encoding matches the terminal!
bytesToString(resp.data)
finally: # Close the session
await noCancel(httpSession.closeWait())
echo waitFor retrievePage(
"https://raw.githubusercontent.com/status-im/nim-chronos/master/README.md")
```
## Documentation
See the [user guide](https://status-im.github.io/nim-chronos/).
## Projects using `chronos`
* [libp2p](https://github.com/status-im/nim-libp2p) - Peer-to-Peer networking stack implemented in many languages
* [presto](https://github.com/status-im/nim-presto) - REST API framework
* [Scorper](https://github.com/bung87/scorper) - Web framework
* [2DeFi](https://github.com/gogolxdong/2DeFi) - Decentralised file system
* [websock](https://github.com/status-im/nim-websock/) - WebSocket library with lots of features
`chronos` is available in the [Nim Playground](https://play.nim-lang.org/#ix=2TpS)
Submit a PR to add yours!
## TODO
* Multithreading Stream/Datagram servers
## Contributing
When submitting pull requests, please add test cases for any new features or fixes and make sure `nimble test` is still able to execute the entire test suite successfully.
`chronos` follows the [Status Nim Style Guide](https://status-im.github.io/nim-style-guide/).
## License
Licensed and distributed under either of
* MIT license: [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT
or
* Apache License, Version 2.0, ([LICENSE-APACHEv2](LICENSE-APACHEv2) or http://www.apache.org/licenses/LICENSE-2.0)
at your option. These files may not be copied, modified, or distributed except according to those terms.
近期下载者:
相关文件:
收藏者: