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