Skip to main content

photon_ring/channel/
errors.rs

1// Copyright 2026 Photon Ring Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4/// Error from [`Subscriber::try_recv`].
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub enum TryRecvError {
7    /// No new messages available.
8    Empty,
9    /// Consumer fell behind the ring. `skipped` messages were lost.
10    Lagged { skipped: u64 },
11}
12
13/// Error returned by [`Publisher::try_publish`] when the ring is full
14/// and backpressure is enabled.
15#[derive(Debug, Clone, PartialEq, Eq)]
16pub enum PublishError<T> {
17    /// The slowest consumer is within the backpressure watermark.
18    /// Contains the value that was not published.
19    Full(T),
20}