Skip to content

Gate UnixStream behind #[cfg(unix)] for Windows compatibility#742

Open
klod-exe wants to merge 1 commit into
rpcpool:masterfrom
klod-exe:cfg-unix-uds
Open

Gate UnixStream behind #[cfg(unix)] for Windows compatibility#742
klod-exe wants to merge 1 commit into
rpcpool:masterfrom
klod-exe:cfg-unix-uds

Conversation

@klod-exe

Copy link
Copy Markdown

Problem

yellowstone-grpc-client fails to compile on Windows targets because
tokio::net::UnixStream is not available on cfg(windows) — the type
lives at tokio::net::windows::named_pipe::* on Windows. The current
unconditional import in yellowstone-grpc-client/src/lib.rs:

tokio::net::UnixStream,

…blows up with unresolved import when building any downstream crate
that targets x86_64-pc-windows-msvc/gnu.

Fix

Gate the platform-specific bits behind #[cfg(unix)]:

  • The tokio::net::UnixStream import.
  • The std::path::PathBuf import (only used by connect_uds).
  • The connect_uds(...) method on the builder.

This leaves the TCP/TLS connect paths (.connect(), .connect_lazy(),
etc.) untouched on every target, and connect_uds() continues to work
on Linux/macOS as before. The change is purely additive gating — no
behavior change on cfg(unix).

Verification

  • cargo check -p yellowstone-grpc-client passes on Linux (Rust
    1.93.1, tonic 0.14.3) against this branch.
  • Windows compilation verified by inspection: UnixStream is the only
    non-portable item touched, gating it behind #[cfg(unix)] is sound.
    The PR author does not have a Windows host to run cargo check --target x86_64-pc-windows-msvc end-to-end against this fork.

Motivation

I'm building a cross-platform crate that subscribes to a Yellowstone
gRPC endpoint from both a Linux producer and a Windows consumer. The
consumer only ever uses TCP+TLS, never UDS — but it can't depend on
yellowstone-grpc-client at all today because of the unconditional
UnixStream import. This PR is the minimal change that unblocks
Windows consumers without changing any Linux behavior.

tokio::net::UnixStream does not exist on cfg(windows), causing
yellowstone-grpc-client to fail to compile on Windows targets.
This commit gates the UnixStream import (and the std::path::PathBuf
import used only by connect_uds) plus the connect_uds method itself
behind #[cfg(unix)], leaving Linux/macOS unchanged.

Verified: cargo check -p yellowstone-grpc-client succeeds on Linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant