ChannelState
Transfers unpublished synchronization owners.
Module std.sync
import std.sync;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
pub init(mut Queue: Mutex<ChannelBuffer<T>>, mut FreeSlots: Semaphore, mut ReadyItems: Semaphore, Capacity: usize)
pub init(mut Queue: Mutex<ChannelBuffer<T>>, mut FreeSlots: Semaphore, mut ReadyItems: Semaphore, Capacity: usize)Transfers unpublished synchronization owners. Queue: Pre-reserved FIFO. FreeSlots: Capacity gate. ReadyItems: Initially empty item gate. Capacity: Logical bound.
pub init(Source: readonly Self&) = delete;
pub init(Source: readonly Self&) = delete;Rejects duplicate synchronization authority. Source: Existing state.
pub init(Source: mut Self&&)
pub init(Source: mut Self&&)Transfers unpublished state without duplicating payloads. Source: State left without synchronization owners.
Slots
pub readonly fn Slots() -> readonly Semaphore&Borrows slot gate while retained state is live. Return: Readonly semaphore reference bounded by this retained state lifetime.
Items
pub readonly fn Items() -> readonly Semaphore&Borrows item gate while retained state is live. Return: Readonly semaphore reference bounded by this retained state lifetime.
pub Capacity: usize
pub Capacity: usizeObserves fixed logical capacity.
WaitError
pub static fn WaitError(Error: SemaphoreError) -> ChannelErrorTranslates pending-wait failures without leaking native status. Error: Exact semaphore error. Return: Portable channel reason.
TrySend
pub readonly fn TrySend(mut Value: T) -> Result<void, ChannelSendError<T>>Attempts slot reservation and FIFO commit without capacity waiting. Value: Owned payload, returned on every pre-commit error. Return: Ok or exact owning failure; may briefly contend on queue mutex.
SendReserved
pub readonly fn SendReserved(mut Value: T) -> Result<void, ChannelSendError<T>>Commits an item after an asynchronous slot reservation. Value: Owned payload; close may still win before insertion. Return: Ok or exact owning error with rollback before commit.
TryReceive
pub readonly fn TryReceive() -> Result<ChannelReceive<T>, ChannelError>Attempts one owned receive without waiting for payload arrival. Return: Item, open Empty, closed/drained Closed, or exact lock/permit error.
ReceiveReserved
pub readonly fn ReceiveReserved(Reserved: bool) -> Result<T?, ChannelError>Transfers after an item reservation or drains after a closed wait. Reserved: True if a successful wait consumed one item permit. Return: Owned FIFO value, closed EOF, or lock failure restoring a reservation.
Close
pub readonly fn Close() -> Result<void, ChannelError>Serializes close against all payload commits and wakes pending waits. Return: Idempotent Ok, or portable acquisition error without changing state.