Skip to main content

announce_std/
io.rs

1//! announce mocks of `io` traits. Generated from newer-type-std's copies.
2
3#[allow(unused_imports)]
4use announce::announce;
5
6/// announce mock of [`::std::io::Read`]: invoke `Read!` to receive its definition.
7///
8/// The real trait is re-exported under the same path.
9#[announce(mock = ::std::io::Read)]
10pub trait Read {
11    fn read(
12        &mut self,
13        buf: &mut [::core::primitive::u8],
14    ) -> ::std::io::Result<::core::primitive::usize>;
15}
16
17#[doc(no_inline)]
18pub use ::std::io::Read;
19
20/// announce mock of [`::std::io::Write`]: invoke `Write!` to receive its definition.
21///
22/// The real trait is re-exported under the same path.
23#[announce(mock = ::std::io::Write)]
24pub trait Write {
25    fn write(
26        &mut self,
27        buf: &[::core::primitive::u8],
28    ) -> ::std::io::Result<::core::primitive::usize>;
29    fn flush(&mut self) -> ::std::io::Result<()>;
30    fn write_all(&mut self, buf: &[::core::primitive::u8]) -> ::std::io::Result<()> {
31        ::core::unimplemented!()
32    }
33}
34
35#[doc(no_inline)]
36pub use ::std::io::Write;
37
38/// announce mock of [`::std::io::BufRead`]: invoke `BufRead!` to receive its definition.
39///
40/// The real trait is re-exported under the same path.
41#[announce(mock = ::std::io::BufRead)]
42pub trait BufRead: ::std::io::Read {
43    fn fill_buf(&mut self) -> ::std::io::Result<&[::core::primitive::u8]>;
44    fn consume(&mut self, amt: ::core::primitive::usize);
45}
46
47#[doc(no_inline)]
48pub use ::std::io::BufRead;
49
50#[cfg(announce_std_rust_1_80)]
51/// announce mock of [`::std::io::Seek`]: invoke `Seek!` to receive its definition.
52///
53/// The real trait is re-exported under the same path.
54#[announce(mock = ::std::io::Seek)]
55pub trait Seek {
56    fn seek(&mut self, pos: ::std::io::SeekFrom) -> ::std::io::Result<::core::primitive::u64>;
57    fn rewind(&mut self) -> ::std::io::Result<()> {
58        ::core::unimplemented!()
59    }
60    fn stream_position(&mut self) -> ::std::io::Result<::core::primitive::u64> {
61        ::core::unimplemented!()
62    }
63    fn seek_relative(&mut self, offset: ::core::primitive::i64) -> ::std::io::Result<()> {
64        ::core::unimplemented!()
65    }
66}
67
68#[cfg(announce_std_rust_1_80)]
69#[doc(no_inline)]
70pub use ::std::io::Seek;
71
72#[cfg(not(announce_std_rust_1_80))]
73/// announce mock of [`::std::io::Seek`]: invoke `Seek!` to receive its definition.
74///
75/// The real trait is re-exported under the same path.
76#[announce(mock = ::std::io::Seek)]
77pub trait Seek {
78    fn seek(&mut self, pos: ::std::io::SeekFrom) -> ::std::io::Result<::core::primitive::u64>;
79    fn rewind(&mut self) -> ::std::io::Result<()> {
80        ::core::unimplemented!()
81    }
82    fn stream_position(&mut self) -> ::std::io::Result<::core::primitive::u64> {
83        ::core::unimplemented!()
84    }
85}
86
87#[cfg(not(announce_std_rust_1_80))]
88#[doc(no_inline)]
89pub use ::std::io::Seek;