README

Nanaloveyuki/sync/channel does not have a README file

#
SyncError

#
OwnedBytesReceiver

pub struct OwnedBytesReceiver {
// private fields
}

A single-consumer endpoint for an owned-bytes channel.

Received values are newly allocated on the receiving thread. They do not alias the Bytes value supplied by the sender.

#
OwnedBytesReceiver::capacity

fn OwnedBytesReceiver::capacity(self : OwnedBytesReceiver) -> Int

Returns the fixed message capacity.

#
OwnedBytesReceiver::close

Idempotently closes the channel and wakes blocked endpoints.

#
OwnedBytesReceiver::length

Returns the number of copied messages waiting to be received.

#
OwnedBytesReceiver::recv

Blocks for a copied message, returning None after closure and queue drain.

#
OwnedBytesReceiver::try_recv

Attempts to receive without blocking.

#
OwnedBytesSendResult

pub(all) enum OwnedBytesSendResult {
Sent
MessageTooLarge(Int, Int)
Closed
} derive(Eq,
Debug
)

The result of a blocking owned-bytes send.

#
OwnedBytesSender

pub struct OwnedBytesSender {
// private fields
}

A producer endpoint for an owned-bytes channel.

send copies the bytes into native-owned storage before it returns. The channel never retains a MoonBit heap object from the sending thread.

#
OwnedBytesSender::close

Idempotently closes the channel and wakes blocked endpoints.

#
OwnedBytesSender::send

fn OwnedBytesSender::send(self : OwnedBytesSender, message : Bytes) -> Bool raise
SyncError

Blocks until bytes are copied into the queue or the channel closes.

Returns false when the channel closes or rejects an oversized message. Use send_checked when the caller must distinguish these outcomes.

#
OwnedBytesSender::send_checked

Blocks until bytes are copied into the queue, the channel closes, or the message exceeds its configured byte limit.

#
OwnedBytesSender::share

Creates an independent producer wrapper for a different OS thread.

#
OwnedBytesSender::try_send

Attempts to copy and enqueue bytes without blocking.

#
OwnedBytesTryRecvResult

pub(all) enum OwnedBytesTryRecvResult {
Received(Bytes)
Empty
Closed
} derive(Eq,
Debug
)

The result of a non-blocking owned-bytes receive.

#
OwnedBytesTrySendResult

pub(all) enum OwnedBytesTrySendResult {
Sent
Full
QueueByteLimitReached(Int, Int)
MessageTooLarge(Int, Int)
Closed
} derive(Eq,
Debug
)

The result of a non-blocking owned-bytes send.

#
owned_bytes_bounded

fn owned_bytes_bounded(capacity : Int) -> (OwnedBytesSender, OwnedBytesReceiver) raise
SyncError

Creates a bounded channel with a 4 MiB per-message and 16 MiB total queue byte limit. Capacity must be greater than zero.

#
owned_bytes_bounded_with_limits

fn owned_bytes_bounded_with_limits(capacity : Int, max_message_bytes~ : Int, max_queued_bytes~ : Int) -> (OwnedBytesSender, OwnedBytesReceiver) raise
SyncError

Creates a bounded channel with explicit byte limits.

max_message_bytes rejects oversized messages before copying. The channel accepts at most max_queued_bytes of copied payloads at once, in addition to its message-count capacity.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io