Skip to content

Commit ade071b

Browse files
committed
Use unit structs for stateless stdio
This seems to be the pattern for newer pal stdio types.
1 parent 5bc3123 commit ade071b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

library/std/src/sys/stdio/sgx.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use fortanix_sgx_abi as abi;
33
use crate::io;
44
use crate::sys::fd::FileDesc;
55

6-
pub struct Stdin(());
7-
pub struct Stdout(());
8-
pub struct Stderr(());
6+
pub struct Stdin;
7+
pub struct Stdout;
8+
pub struct Stderr;
99

1010
fn with_std_fd<F: FnOnce(&FileDesc) -> R, R>(fd: abi::Fd, f: F) -> R {
1111
let fd = FileDesc::new(fd);
@@ -16,7 +16,7 @@ fn with_std_fd<F: FnOnce(&FileDesc) -> R, R>(fd: abi::Fd, f: F) -> R {
1616

1717
impl Stdin {
1818
pub const fn new() -> Stdin {
19-
Stdin(())
19+
Stdin
2020
}
2121
}
2222

@@ -28,7 +28,7 @@ impl io::Read for Stdin {
2828

2929
impl Stdout {
3030
pub const fn new() -> Stdout {
31-
Stdout(())
31+
Stdout
3232
}
3333
}
3434

@@ -44,7 +44,7 @@ impl io::Write for Stdout {
4444

4545
impl Stderr {
4646
pub const fn new() -> Stderr {
47-
Stderr(())
47+
Stderr
4848
}
4949
}
5050

library/std/src/sys/stdio/unix_like.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ use crate::os::hermit::io::FromRawFd;
1111
use crate::os::unix::io::FromRawFd;
1212
use crate::sys::fd::FileDesc;
1313

14-
pub struct Stdin(());
15-
pub struct Stdout(());
16-
pub struct Stderr(());
14+
pub struct Stdin;
15+
pub struct Stdout;
16+
pub struct Stderr;
1717

1818
impl Stdin {
1919
pub const fn new() -> Stdin {
20-
Stdin(())
20+
Stdin
2121
}
2222
}
2323

@@ -42,7 +42,7 @@ impl io::Read for Stdin {
4242

4343
impl Stdout {
4444
pub const fn new() -> Stdout {
45-
Stdout(())
45+
Stdout
4646
}
4747
}
4848

@@ -68,7 +68,7 @@ impl io::Write for Stdout {
6868

6969
impl Stderr {
7070
pub const fn new() -> Stderr {
71-
Stderr(())
71+
Stderr
7272
}
7373
}
7474

0 commit comments

Comments
 (0)