Skip to main content

photon_ring/channel/
errors.rs

1// Copyright 2026 Photon Ring Contributors
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4/// Error from [`Subscriber::try_recv`](super::subscriber::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
14/// [`Publisher::try_publish`](super::publisher::Publisher::try_publish)
15/// when the ring is full
16/// and backpressure is enabled.
17#[derive(Debug, Clone, PartialEq, Eq)]
18pub enum PublishError<T> {
19    /// The slowest consumer is within the backpressure watermark.
20    /// Contains the value that was not published.
21    Full(T),
22}