proxima_primitives/pipe/endpoint.rs
1//! Endpoint metadata value types destined for `proxima-pipe`.
2//!
3//! Lifted from `stream.rs` during Phase 1.5 of the decomposition (see
4//! `docs/decomposition/discipline.md`). `BindAddr` and `PeerInfo` are
5//! referenced in `StreamListener::local_addr()` and
6//! `StreamConnection::peer()` trait signatures AND in `Request` /
7//! `Response`'s `RequestContext`. Keeping them in `stream.rs` would
8//! force `proxima-pipe` to depend on `proxima-stream` (cycle); putting
9//! them in `proxima-net` would force `proxima-stream` to depend on
10//! `proxima-net` (reverses planned DAG). Resolution: they live in
11//! `proxima-pipe` as small std-only enums. Stream traits and pipe
12//! Request both pull `proxima-pipe` for them.
13//!
14//! On Phase 2 (proxima-pipe extraction) this file's contents move to
15//! the new `proxima-pipe` crate.
16
17#![cfg(feature = "alloc")]
18
19use alloc::string::String;
20
21#[cfg(feature = "std")]
22use std::net::SocketAddr;
23#[cfg(feature = "std")]
24use std::path::PathBuf;
25
26#[derive(Debug, Clone)]
27pub enum BindAddr {
28 #[cfg(feature = "std")]
29 Tcp(SocketAddr),
30 #[cfg(feature = "std")]
31 Unix(PathBuf),
32 /// Backends whose bind concept doesn't fit the common shapes
33 /// (e.g. DPDK device + queue), or the fallback for no_std builds.
34 Other(String),
35}
36
37#[derive(Debug, Clone)]
38pub enum PeerInfo {
39 #[cfg(feature = "std")]
40 Tcp(SocketAddr),
41 #[cfg(feature = "std")]
42 Unix(Option<PathBuf>),
43 /// `None` is valid for multiplexed transports (e.g. one QUIC
44 /// connection carrying many streams), or the fallback for no_std builds.
45 Other(String),
46}