def writer.write.mode
bend-kit-http@0.38.2.0 · http.bend:6815
import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-http@0.38.2.0/completion.bend as Completion
import bend-kit-time@0.3.0.0/time.bend as Time
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
6815def writer.write.mode(s: Socket, mode: WriterMode, b: Bytes.Bytes, until: Time.Duration) -> IO(Writer):
6816 match mode:
6817 case WriteNone{}:
6818 IO.pure(Writer, Writer{Some{s}, WriteNone{}, until, Completion.HostAccepted{}})
6819 case WriteKnown{+left}:
6820 Bytes.Bytes{+len, buf} = b
6821 writer.known(U32.is_le(len, left), s, left, len, Bytes.Bytes{len, buf}, until)
6822 case WriteChunk{}:
6823 Bytes.Bytes{+len, buf} = b
6824 writer.chunk.go(U32.is_zero(len), s, Bytes.Bytes{len, buf}, len, until)