Releases: moonbitlang/async
v0.8.0
- [breaking] improve
@os_error.OSError
:- its
Show
implementation now output a text message instead of raw error number OSError
now includes an extra context parameter, indicating the direct source of the error
- its
- [breaking] modify
@io
API, introduces@io.Data
, which replaces@http.Body
. Now@io.Reader::read_all
,@io.Writer::write
etc. return/accept&@io.Data
instead of raw binary. Related functions such as@process.collect_output
and@fs.read_text_file
also receive a similar change.
v0.7.0
- Replace
Bytes
withString in various places, all
String` are encoded with UTF8:- file name in
@fs
, including parameters toopen
,remove
etc. and result ofreaddir
etc. - process name, command line arguments passed to process, and environment variables passed to process in
@process
- network host name in
@socket
,@tls
and@http
- URL and header key/value in
@http
- file name in
- large refactor on the API of
@http
:@http.Client
and@http.ServerConnection
now implements@io.Writer
, and request/response body should be sent using@io.Writer
API. See the README of@http
for more details and examples. Note that@http.Client
and@http.ServerConnection
are buffered when writing request/response body, so manualflush
call may be necessary- HTTP headers are now represented using
Map[String, String]
instead ofArray[Header]
. Duplicated headers in incoming request/response will be joined with,
, as specified by the HTTP protocol @http.get
,@http.put
,@http.Client::get
etc. now uses an abstract type&Body
instead ofBytes
for sending/receiving request/response body. While sending, bothBytes
,String
andJson
implementstrait Body
, and can be directed passed to@http.put
etc., so this is a non-breaking change. On the receiving side, the returned body can be converted to desired format using.binary()
/.text()
/.json()
.String
andJson
are all considered UTF8-encoded.@http.Client::read_all
and@http.ServerConnection::read_all
now also return&Body
instead ofBytes
@http.Reader
is made private
@async.with_timeout
now raises@async.TimeoutError
instead of silently return on timeout. In return,@async.with_timeout
can now return result of arbitrary type on success- remove some previously deprecated API (
@http.request
,@http.Client::shutdown
)
v0.6.5
v0.6.4
- add
@fs.read_text_file
and@fs.write_text_file
for reading/writing text file toString
directly - add
@process.collect_stdout
,@process.collect_stderr
and@process.collect_output
. These functions are similar to@process.run
, but automatically collect and return the content of process stdout/stderr - result of
@process.read_from_process
can now be passed to bothstdout
andstderr
of the same@process.run
. This allows mergingstdout
andstderr
of a process - add
@fs.realpath
for obtaining the real path (without.
,..
and symlink) of a filesystem location - internal: migrate to
async fn main
andasync test
v0.6.3
v0.6.2
v0.6.1
- [breaking]
@io.BufferedReader::op_as_view
now returns a@bytes.View
instead ofBytes
. This avoids unnecessary data copy, but the returned bytes view will become invalid once any data is consumed from the reader. So users should refactor their code, insert manual copy if necessary - add
@http.ServerConnection
, which represents a HTTP connection at the server side. This type provides helpers for writing HTTP server, and provides better performance (by sharing some resource for the whole connection) - a lot of performance improvements
- [internal] added benchmarks for the library in
examples/tcp_server_benchmark
andexamples/http_server_benchmark
v0.5.4
-
add
@fs.read_file
and@fs.write_file
for reading/writing a filesystem path directly -
@fs.rmdir
now accepts an optional argumentrecursive? : Bool = false
. Ifrecursive=true
, the content of the directory will be removed recursively -
add
@fs.readdir
for reading the content of a directory path directly -
@process.run
can now redirect output to a shared pipe or a file. Previously usage remain valid, but will result in resource leak. The migration scheme is as follows:- if your intention is to read the output of a process or write to its input, replace
@pipe.pipe
with@process.read_from_process
or@process.write_to_process
passing a pipe directly is still allowed, but now have a different meaning. The pipe will not get closed by
@process.run
, this allows redirection to a shared pipe such as@pipe.stderr
. In addition, you can now use@process.redirect_{from,to}_file
, which can redirect output of process to a file via path, or vice versa - if your intention is to read the output of a process or write to its input, replace
-
some bug fix & performance improvement
v0.5.3
v0.5.2
- add utils
@fs.kind
,@fs.exists
,@fs.can_read
, etc. for getting information of a path directly - fix a race condition of
@process.run
on MacOS - no longer perform TLS shutdown for
@http
, because it is not necessary and often cause trouble for non-compliant server