Skip to content

Commit 46e3e46

Browse files
committed
Use unit structs for stateless stdio
This seems to be the pattern for newer pal stdio types.
1 parent 15d8363 commit 46e3e46

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.rs

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

16-
pub struct Stdin(());
17-
pub struct Stdout(());
18-
pub struct Stderr(());
16+
pub struct Stdin;
17+
pub struct Stdout;
18+
pub struct Stderr;
1919

2020
impl Stdin {
2121
pub const fn new() -> Stdin {
22-
Stdin(())
22+
Stdin
2323
}
2424
}
2525

@@ -45,7 +45,7 @@ impl io::Read for Stdin {
4545

4646
impl Stdout {
4747
pub const fn new() -> Stdout {
48-
Stdout(())
48+
Stdout
4949
}
5050
}
5151

@@ -71,7 +71,7 @@ impl io::Write for Stdout {
7171

7272
impl Stderr {
7373
pub const fn new() -> Stderr {
74-
Stderr(())
74+
Stderr
7575
}
7676
}
7777

0 commit comments

Comments
 (0)