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