Skip to main content

core/io/
mod.rs

1//! Traits, helpers, and type definitions for core I/O functionality.
2
3mod borrowed_buf;
4mod cursor;
5mod error;
6mod impls;
7mod io_slice;
8mod seek;
9mod size_hint;
10mod util;
11
12#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
13pub use self::borrowed_buf::{BorrowedBuf, BorrowedCursor};
14#[unstable(feature = "raw_os_error_ty", issue = "107792")]
15pub use self::error::RawOsError;
16#[unstable(feature = "io_const_error_internals", issue = "none")]
17pub use self::error::SimpleMessage;
18#[unstable(feature = "io_const_error", issue = "133448")]
19pub use self::error::const_error;
20#[unstable(feature = "core_io", issue = "154046")]
21pub use self::{
22    cursor::Cursor,
23    error::{Error, ErrorKind, Result},
24    io_slice::{IoSlice, IoSliceMut},
25    seek::{Seek, SeekFrom},
26    util::{Chain, Empty, Repeat, Sink, Take, empty, repeat, sink},
27};
28#[doc(hidden)]
29#[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")]
30pub use self::{
31    error::{Custom, CustomOwner, OsFunctions},
32    seek::stream_len_default,
33    size_hint::SizeHint,
34    util::{chain, take},
35};
36
37/// Marks that a type `T` can have IO traits such as [`Seek`], [`Write`], etc. automatically
38/// implemented for handle types like [`Arc`][arc] as well.
39///
40/// This trait should only be implemented for types where `<&T as Trait>::method(&mut &value, ..)`
41/// would be identical to `<T as Trait>::method(&mut value, ..)`.
42///
43/// [`File`][file] passes this test, as operations on `&File` and `File` both affect
44/// the same underlying file.
45/// `[u8]` fails, because any modification to `&mut &[u8]` would only affect a temporary
46/// and be lost after the method has been called.
47///
48// FIXME(#74481): Hard-links required to link from `core` to `std`
49/// [file]: ../../std/fs/struct.File.html
50/// [arc]: ../../alloc/sync/struct.Arc.html
51/// [`Write`]: ../../std/io/trait.Write.html
52/// [`Seek`]: crate::io::Seek
53#[doc(hidden)]
54#[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")]
55pub trait IoHandle {}