README

moonbitlang/async/raw_fd does not have a README file

#
RawFd

pub struct RawFd {
fd : Int
// private fields
}

A wrapper around a raw file descriptor that can be used to perform asynchronous IO on the raw file descriptor. This is useful for binding special file descriptors that are not natively supported by moonbitlang/async.

#
RawFd::RawFd

#alias(new, deprecated="`new` is deprecated, use `RawFd` instead")
async fn RawFd::RawFd(fd : Int) -> RawFd

Create a new RawFd object from the underlying file descriptor. The ownership of the file descriptor will be transferred to this function, so the file descriptor must not be used or closed directly later, even if creation of RawFd object failed.

#
RawFd::close

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

#
RawFd::read

async fn RawFd::read(self : RawFd, buf : FixedArray[Byte], offset? : Int, max_len? : Int) -> Int

Perform a single read/ReadFile system call asynchronously on a raw file descriptor object. Data will be read into buf[offset:offset+max_len]. The number of bytes actually read will be returned, note that the number may be smaller than max_len. A zero return value indicates EOF.

#
RawFd::write

async fn RawFd::write(self : RawFd, buf : Bytes, offset? : Int, len? : Int) -> Int

Perform a single write/WriteFile system call asynchronously on a raw file descriptor object. Data to write come from buf[offset:offset+len]. The number of bytes actually written will be returned, note that the number may be smaller than len.

#
RawFdStream

pub struct RawFdStream {
fd : Int
// private fields
}

A wrapper around a raw file descriptor that can be used to perform asynchronous stream-based IO on the raw file descriptor via the @io.Reader/@io.Writer interface. This is useful for binding special file descriptors that are not natively supported by moonbitlang/async.

#
RawFdStream::RawFdStream

async fn RawFdStream::RawFdStream(fd : Int) -> RawFdStream

Create a new RawFdStream object from the underlying file descriptor. The ownership of the file descriptor will be transferred to this function, so the file descriptor must not be used or closed directly later, even if creation of RawFdStream object failed.

#
RawFdStream::close

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

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io