Sign in

    shiyukonghui/kingbase-client/sys does not have a README file

    IOError

    pub struct IOError(String)

    A socket-layer failure, carrying the message the caller should show.

    IOError::message

    fn IOError::message(self : IOError) -> String

    This is how a caller renders one. derive(Show) became deprecated in the toolchain this module is built with, and the promoted dot-methods of the other derived traits were never part of the published interface, so the error text is read through an explicit accessor instead.

    Message

    pub struct Message {
    tag : Byte
    body : Bytes
    }

    A protocol message: tag plus payload.

    Message::len

    fn Message::len(self : Message) -> Int

    Message::text_from

    fn Message::text_from(self : Message, offset : Int) -> String

    UTF-8-decodes payload bytes from offset up to the next NUL byte.

    Socket

    pub struct Socket(Int64)

    Socket::close

    fn Socket::close(self : Socket) -> Unit

    Socket::read_byte

    fn Socket::read_byte(self : Socket) -> Result[Byte, IOError]

    Socket::read_exact

    fn Socket::read_exact(self : Socket, n : Int) -> Result[Bytes, IOError]

    Reads exactly n bytes into a fresh buffer.

    Socket::read_int32_be

    fn Socket::read_int32_be(self : Socket) -> Result[Int, IOError]

    Socket::read_message

    fn Socket::read_message(self : Socket) -> Result[Message, IOError]

    itself), then length - 4 bytes of payload.

    Socket::set_nodelay

    fn Socket::set_nodelay(self : Socket, on : Bool) -> Unit

    Socket::set_send_buffer

    fn Socket::set_send_buffer(self : Socket, bytes : Int) -> Unit

    Socket::write

    fn Socket::write(self : Socket, data : Bytes) -> Result[Unit, IOError]

    Socket::write_slice

    fn Socket::write_slice(self : Socket, data : Bytes, offset : Int, len : Int) -> Result[Unit, IOError]

    Lets a 5-byte message header and a large payload go out as two writes.

    be16

    fn be16(b : Bytes, off : Int) -> Int

    be32

    fn be32(b : Bytes, off : Int) -> Int

    be64

    fn be64(b : Bytes, off : Int) -> Int64

    buffer_text

    fn buffer_text(buf :
    Buffer
    ) -> String

    target, which garbles ASCII output, so decode explicitly.

    connect

    fn connect(host : String, port : Int) -> Result[Socket, IOError]

    cstr

    fn cstr(s : String) -> Bytes

    NUL-terminated C string as Bytes, since String has no stable C ABI.

    now_us

    fn now_us() -> Int64

    Monotonic clock in microseconds; the only clock used for timings.

    random_bytes

    fn random_bytes(n : Int) -> Bytes

    sleep_ms

    fn sleep_ms(ms : Int) -> Unit

    text_at

    fn text_at(b : Bytes, offset : Int) -> String

    which is how the protocol terminates strings and startup parameters.

    text_slice

    fn text_slice(b : Bytes, offset : Int, length : Int) -> String

    comes back as CJK mojibake.

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io