Skip to content

Releases: moonbitlang/async

v0.8.0

26 Sep 07:17
Compare
Choose a tag to compare
  • [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
  • [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

24 Sep 08:22
Compare
Choose a tag to compare
  • Replace Bytes with String in various places, all String` are encoded with UTF8:
    • file name in @fs, including parameters to open, remove etc. and result of readdir 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
  • 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 manual flush call may be necessary
    • HTTP headers are now represented using Map[String, String] instead of Array[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 of Bytes for sending/receiving request/response body. While sending, both Bytes, String and Json implements trait 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 and Json are all considered UTF8-encoded.
    • @http.Client::read_all and @http.ServerConnection::read_all now also return &Body instead of Bytes
    • @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

22 Sep 08:18
Compare
Choose a tag to compare
  • add @process.collect_output_merged, which run a process then merge and collect stdout and stderr of it
  • fix bug

v0.6.4

22 Sep 02:16
Compare
Choose a tag to compare
  • add @fs.read_text_file and @fs.write_text_file for reading/writing text file to String 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 both stdout and stderr of the same @process.run. This allows merging stdout and stderr of a process
  • add @fs.realpath for obtaining the real path (without ., .. and symlink) of a filesystem location
  • internal: migrate to async fn main and async test

v0.6.3

18 Sep 02:31
Compare
Choose a tag to compare
  • async test & async fn main support
  • add write_string method to @io.Writer

v0.6.2

16 Sep 07:45
Compare
Choose a tag to compare
  • add try_get method to @async.Queue

v0.6.1

15 Sep 08:55
Compare
Choose a tag to compare
  • [breaking] @io.BufferedReader::op_as_view now returns a @bytes.View instead of Bytes. 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 and examples/http_server_benchmark

v0.5.4

10 Sep 08:49
Compare
Choose a tag to compare
  • add @fs.read_file and @fs.write_file for reading/writing a filesystem path directly

  • @fs.rmdir now accepts an optional argument recursive? : Bool = false. If recursive=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

  • some bug fix & performance improvement

v0.5.3

08 Sep 06:02
Compare
Choose a tag to compare
  • fix a bug in open: the flags create and truncate are wrongly swapped
  • add @fs.mkdir and @fs.rmdir

v0.5.2

05 Sep 03:12
Compare
Choose a tag to compare
  • 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