1pub mod error;
5pub mod prelude;
6
7#[cfg(any(not(feature = "std"), test))]
8pub mod cursor;
9
10#[cfg(any(not(feature = "std"), test))]
11mod no_std;
12
13#[cfg(not(feature = "std"))]
14pub use no_std::*;
15
16#[cfg(feature = "std")]
17pub use std::io::{Bytes, Cursor, Error, ErrorKind, Read, Result, Seek, SeekFrom};
18
19pub trait StreamPosition {
20 fn stream_pos(&mut self) -> Result<u64>;
21}
22
23impl<T: Seek> StreamPosition for T {
24 #[rustversion::before(1.51)]
25 #[cfg(feature = "std")]
26 fn stream_pos(&mut self) -> Result<u64> {
27 self.seek(SeekFrom::Current(0))
28 }
29
30 #[rustversion::since(1.51)]
33 #[cfg(feature = "std")]
34 fn stream_pos(&mut self) -> Result<u64> {
35 self.stream_position()
36 }
37
38 #[cfg(not(feature = "std"))]
39 fn stream_pos(&mut self) -> Result<u64> {
40 self.stream_position()
41 }
42}