From 3a388b98a9aa6a14b1c7f7dc909c109cf9837800 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 00:59:54 +0900 Subject: refactor: narrow pub(crate) items to private Porting mapped every PHP `protected` member onto `pub(crate)`, which is wider than nearly all of them need. Each item demoted here is reached only from the module that defines it, so the crate-wide visibility conveyed nothing. Every `pub(crate)` that survives has at least one reader in another module of the same crate. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-shim/src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/shirabe-php-shim/src/lib.rs') diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 63e4226e..b9613053 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -402,7 +402,7 @@ impl PhpResource { /// Returns the underlying OS file descriptor backing this resource, when it has one. /// Used by `stream_set_blocking`/`stream_select` to drive `fcntl(2)`/`select(2)`. In-memory /// streams (`php://memory`/`php://temp`) and process handles have no fd and return `None`. - pub(crate) fn raw_fd(&self) -> Option { + fn raw_fd(&self) -> Option { use std::os::unix::io::AsRawFd; match self { PhpResource::Stdin => Some(std::io::stdin().as_raw_fd()), @@ -442,7 +442,7 @@ pub enum StreamBacking { } impl StreamBacking { - pub(crate) fn as_rws(&mut self) -> &mut dyn ReadWriteSeek { + fn as_rws(&mut self) -> &mut dyn ReadWriteSeek { match self { StreamBacking::File(f) => f, StreamBacking::Memory(c) => c, @@ -515,23 +515,23 @@ impl std::os::unix::io::AsRawFd for ChildPipe { #[derive(Debug)] pub struct StreamState { - pub(crate) backing: StreamBacking, + backing: StreamBacking, /// Whether the mode opened the stream for reading. - pub(crate) readable: bool, + readable: bool, /// Whether the mode opened the stream for writing. - pub(crate) writable: bool, + writable: bool, /// Set once a read attempt sees end-of-stream, mirroring PHP's `feof()` which /// only reports true after a read has hit the end; cleared by a seek. - pub(crate) eof: bool, - pub(crate) closed: bool, + eof: bool, + closed: bool, /// The mode string passed to `fopen`, reported back by `stream_get_meta_data`. - pub(crate) mode: String, + mode: String, /// The path/URI the stream was opened from, reported back by `stream_get_meta_data`. - pub(crate) uri: String, + uri: String, } impl StreamState { - pub(crate) fn new( + fn new( backing: StreamBacking, readable: bool, writable: bool, -- cgit v1.3.1-4-g156e