- From what I can tell, it only supports 3 kinds of data: Bytes, String and Json where String and Json are used most. It was introduced to allow some overloading so that
@http.post("url", data)
@http.post("url", { "xx" : "json"})
but this does not work in practice so that we have to write @http.post("url", ({"xx" : "json"} : Json)) which is not better than
@http.post_json("url", {"x" : "data"}) when it could be more efficient or more redable.
it looks to me that either
@http.post("url", String("..."))
@http.post("url", Bytes("..."))
@http.post("url", Json("..."))
or
@http.post("url","...")
@http.post_bytes("url","...")
@http.post_json("url", "...")
they are both more readable and can be more efficient than the current interface
2.
pub(open) trait Writer {
async write_once(Self, Bytes, offset~ : Int, len~ : Int) -> Int // --> async write_once(Self, BytesView) -> Int
async write(Self, &Data) -> Unit = _
async write_reader(Self, &Reader) -> Unit = _
#deprecated("use write instead", skip_current_package=true)
async write_string(Self, StringView, encoding~ : Encoding) -> Unit = _
}
but this does not work in practice so that we have to write
@http.post("url", ({"xx" : "json"} : Json))which is not better than@http.post_json("url", {"x" : "data"})when it could be more efficient or more redable.it looks to me that either
or
they are both more readable and can be more efficient than the current interface
2.
pub(open) trait Writer {
async write_once(Self, Bytes, offset~ : Int, len~ : Int) -> Int // --> async write_once(Self, BytesView) -> Int
async write(Self, &Data) -> Unit = _
async write_reader(Self, &Reader) -> Unit = _
#deprecated("use
writeinstead", skip_current_package=true)async write_string(Self, StringView, encoding~ : Encoding) -> Unit = _
}