diff options
| author | Thalia Archibald <thalia@archibald.dev> | 2025-02-18 14:29:24 -0800 |
|---|---|---|
| committer | Thalia Archibald <thalia@archibald.dev> | 2025-03-22 01:21:23 -0700 |
| commit | f6e90d804a82cce1606596f6116402843794deb3 (patch) | |
| tree | 9280cac5227fa9b426d0f4fc147404476e895320 /library/std/src/sys/stdio | |
| parent | ec4beda5d2403ff13ea138c12f98857701ef5c70 (diff) | |
| download | rust-f6e90d804a82cce1606596f6116402843794deb3.tar.gz rust-f6e90d804a82cce1606596f6116402843794deb3.zip | |
Use unit structs for stateless stdio
This seems to be the pattern for newer pal stdio types.
Diffstat (limited to 'library/std/src/sys/stdio')
| -rw-r--r-- | library/std/src/sys/stdio/sgx.rs | 12 | ||||
| -rw-r--r-- | library/std/src/sys/stdio/unix.rs | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/library/std/src/sys/stdio/sgx.rs b/library/std/src/sys/stdio/sgx.rs index 03d754cb217..e45ece5ea3b 100644 --- a/library/std/src/sys/stdio/sgx.rs +++ b/library/std/src/sys/stdio/sgx.rs @@ -3,9 +3,9 @@ use fortanix_sgx_abi as abi; use crate::io; use crate::sys::fd::FileDesc; -pub struct Stdin(()); -pub struct Stdout(()); -pub struct Stderr(()); +pub struct Stdin; +pub struct Stdout; +pub struct Stderr; fn with_std_fd<F: FnOnce(&FileDesc) -> R, R>(fd: abi::Fd, f: F) -> R { let fd = FileDesc::new(fd); @@ -16,7 +16,7 @@ fn with_std_fd<F: FnOnce(&FileDesc) -> R, R>(fd: abi::Fd, f: F) -> R { impl Stdin { pub const fn new() -> Stdin { - Stdin(()) + Stdin } } @@ -28,7 +28,7 @@ impl io::Read for Stdin { impl Stdout { pub const fn new() -> Stdout { - Stdout(()) + Stdout } } @@ -44,7 +44,7 @@ impl io::Write for Stdout { impl Stderr { pub const fn new() -> Stderr { - Stderr(()) + Stderr } } diff --git a/library/std/src/sys/stdio/unix.rs b/library/std/src/sys/stdio/unix.rs index 8d133857c59..b511b8effce 100644 --- a/library/std/src/sys/stdio/unix.rs +++ b/library/std/src/sys/stdio/unix.rs @@ -13,13 +13,13 @@ use crate::os::hermit::io::FromRawFd; use crate::os::unix::io::FromRawFd; use crate::sys::fd::FileDesc; -pub struct Stdin(()); -pub struct Stdout(()); -pub struct Stderr(()); +pub struct Stdin; +pub struct Stdout; +pub struct Stderr; impl Stdin { pub const fn new() -> Stdin { - Stdin(()) + Stdin } } @@ -45,7 +45,7 @@ impl io::Read for Stdin { impl Stdout { pub const fn new() -> Stdout { - Stdout(()) + Stdout } } @@ -71,7 +71,7 @@ impl io::Write for Stdout { impl Stderr { pub const fn new() -> Stderr { - Stderr(()) + Stderr } } |
