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