Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs, primitive_docs.rs & poison.rs
This commit is contained in:
parent
6ead62235a
commit
a712fbd50b
4 changed files with 75 additions and 168 deletions
|
@ -20,10 +20,9 @@
|
||||||
/// assert!(!bool_val);
|
/// assert!(!bool_val);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`assert!`]: macro.assert.html
|
/// [`BitAnd`]: ops::BitAnd
|
||||||
/// [`BitAnd`]: ops/trait.BitAnd.html
|
/// [`BitOr`]: ops::BitOr
|
||||||
/// [`BitOr`]: ops/trait.BitOr.html
|
/// [`Not`]: ops::Not
|
||||||
/// [`Not`]: ops/trait.Not.html
|
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -46,7 +45,7 @@
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// Also, since `bool` implements the [`Copy`](marker/trait.Copy.html) trait, we don't
|
/// Also, since `bool` implements the [`Copy`] trait, we don't
|
||||||
/// have to worry about the move semantics (just like the integer and float primitives).
|
/// have to worry about the move semantics (just like the integer and float primitives).
|
||||||
///
|
///
|
||||||
/// Now an example of `bool` cast to integer type:
|
/// Now an example of `bool` cast to integer type:
|
||||||
|
@ -100,8 +99,7 @@ mod prim_bool {}
|
||||||
/// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another
|
/// at all we know it can never produce a value which isn't a [`u32`]. This illustrates another
|
||||||
/// behaviour of the `!` type - expressions with type `!` will coerce into any other type.
|
/// behaviour of the `!` type - expressions with type `!` will coerce into any other type.
|
||||||
///
|
///
|
||||||
/// [`u32`]: primitive.str.html
|
/// [`exit`]: crate::process::exit
|
||||||
/// [`exit`]: process/fn.exit.html
|
|
||||||
///
|
///
|
||||||
/// # `!` and generics
|
/// # `!` and generics
|
||||||
///
|
///
|
||||||
|
@ -185,14 +183,12 @@ mod prim_bool {}
|
||||||
/// ever stops, it means that an error occurred. We don't even have to wrap the loop in an `Ok`
|
/// ever stops, it means that an error occurred. We don't even have to wrap the loop in an `Ok`
|
||||||
/// because `!` coerces to `Result<!, ConnectionError>` automatically.
|
/// because `!` coerces to `Result<!, ConnectionError>` automatically.
|
||||||
///
|
///
|
||||||
/// [`String::from_str`]: str/trait.FromStr.html#tymethod.from_str
|
/// [`String::from_str`]: str::FromStr::from_str
|
||||||
/// [`Result<String, !>`]: result/enum.Result.html
|
/// [`Result<String, !>`]: Result
|
||||||
/// [`Result<T, !>`]: result/enum.Result.html
|
/// [`Result<T, !>`]: Result
|
||||||
/// [`Result<!, E>`]: result/enum.Result.html
|
/// [`Result<!, E>`]: Result
|
||||||
/// [`Ok`]: result/enum.Result.html#variant.Ok
|
/// [`String`]: string::String
|
||||||
/// [`String`]: string/struct.String.html
|
/// [`FromStr`]: str::FromStr
|
||||||
/// [`Err`]: result/enum.Result.html#variant.Err
|
|
||||||
/// [`FromStr`]: str/trait.FromStr.html
|
|
||||||
///
|
///
|
||||||
/// # `!` and traits
|
/// # `!` and traits
|
||||||
///
|
///
|
||||||
|
@ -233,11 +229,9 @@ mod prim_bool {}
|
||||||
/// `impl` for this which simply panics, but the same is true for any type (we could `impl
|
/// `impl` for this which simply panics, but the same is true for any type (we could `impl
|
||||||
/// Default` for (eg.) [`File`] by just making [`default()`] panic.)
|
/// Default` for (eg.) [`File`] by just making [`default()`] panic.)
|
||||||
///
|
///
|
||||||
/// [`fmt::Result`]: fmt/type.Result.html
|
/// [`File`]: fs::File
|
||||||
/// [`File`]: fs/struct.File.html
|
/// [`Debug`]: fmt::Debug
|
||||||
/// [`Debug`]: fmt/trait.Debug.html
|
/// [`default()`]: Default::default
|
||||||
/// [`Default`]: default/trait.Default.html
|
|
||||||
/// [`default()`]: default/trait.Default.html#tymethod.default
|
|
||||||
///
|
///
|
||||||
#[unstable(feature = "never_type", issue = "35121")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
mod prim_never {}
|
mod prim_never {}
|
||||||
|
@ -360,7 +354,7 @@ mod prim_unit {}
|
||||||
//
|
//
|
||||||
/// Raw, unsafe pointers, `*const T`, and `*mut T`.
|
/// Raw, unsafe pointers, `*const T`, and `*mut T`.
|
||||||
///
|
///
|
||||||
/// *[See also the `std::ptr` module](ptr/index.html).*
|
/// *[See also the `std::ptr` module][`crate::ptr`].*
|
||||||
///
|
///
|
||||||
/// Working with raw pointers in Rust is uncommon, typically limited to a few patterns.
|
/// Working with raw pointers in Rust is uncommon, typically limited to a few patterns.
|
||||||
/// Raw pointers can be unaligned or [`null`]. However, when a raw pointer is
|
/// Raw pointers can be unaligned or [`null`]. However, when a raw pointer is
|
||||||
|
@ -439,13 +433,13 @@ mod prim_unit {}
|
||||||
/// but C APIs hand out a lot of pointers generally, so are a common source
|
/// but C APIs hand out a lot of pointers generally, so are a common source
|
||||||
/// of raw pointers in Rust.
|
/// of raw pointers in Rust.
|
||||||
///
|
///
|
||||||
/// [`null`]: ../std/ptr/fn.null.html
|
/// [`null`]: ptr::null
|
||||||
/// [`null_mut`]: ../std/ptr/fn.null_mut.html
|
/// [`null_mut`]: ptr::null_mut
|
||||||
/// [`is_null`]: ../std/primitive.pointer.html#method.is_null
|
/// [`is_null`]: ../std/primitive.pointer.html#method.is_null
|
||||||
/// [`offset`]: ../std/primitive.pointer.html#method.offset
|
/// [`offset`]: ../std/primitive.pointer.html#method.offset
|
||||||
/// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw
|
/// [`into_raw`]: Box::into_raw
|
||||||
/// [`drop`]: ../std/mem/fn.drop.html
|
/// [`drop`]: mem::drop
|
||||||
/// [`write`]: ../std/ptr/fn.write.html
|
/// [`write`]: ptr::write
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_pointer {}
|
mod prim_pointer {}
|
||||||
|
|
||||||
|
@ -458,24 +452,24 @@ mod prim_pointer {}
|
||||||
///
|
///
|
||||||
/// * A list with each element, i.e., `[x, y, z]`.
|
/// * A list with each element, i.e., `[x, y, z]`.
|
||||||
/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
|
/// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
|
||||||
/// The type of `x` must be [`Copy`][copy].
|
/// The type of `x` must be [`Copy`].
|
||||||
///
|
///
|
||||||
/// Arrays of *any* size implement the following traits if the element type allows it:
|
/// Arrays of *any* size implement the following traits if the element type allows it:
|
||||||
///
|
///
|
||||||
/// - [`Debug`][debug]
|
/// - [`Debug`]
|
||||||
/// - [`IntoIterator`][intoiterator] (implemented for `&[T; N]` and `&mut [T; N]`)
|
/// - [`IntoIterator`] (implemented for `&[T; N]` and `&mut [T; N]`)
|
||||||
/// - [`PartialEq`][partialeq], [`PartialOrd`][partialord], [`Eq`][eq], [`Ord`][ord]
|
/// - [`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`]
|
||||||
/// - [`Hash`][hash]
|
/// - [`Hash`]
|
||||||
/// - [`AsRef`][asref], [`AsMut`][asmut]
|
/// - [`AsRef`], [`AsMut`]
|
||||||
/// - [`Borrow`][borrow], [`BorrowMut`][borrowmut]
|
/// - [`Borrow`], [`BorrowMut`]
|
||||||
///
|
///
|
||||||
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`][default] trait
|
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
|
||||||
/// if the element type allows it. As a stopgap, trait implementations are
|
/// if the element type allows it. As a stopgap, trait implementations are
|
||||||
/// statically generated up to size 32.
|
/// statically generated up to size 32.
|
||||||
///
|
///
|
||||||
/// Arrays of *any* size are [`Copy`][copy] if the element type is [`Copy`][copy]
|
/// Arrays of *any* size are [`Copy`] if the element type is [`Copy`]
|
||||||
/// and [`Clone`][clone] if the element type is [`Clone`][clone]. This works
|
/// and [`Clone`] if the element type is [`Clone`]. This works
|
||||||
/// because [`Copy`][copy] and [`Clone`][clone] traits are specially known
|
/// because [`Copy`] and [`Clone`] traits are specially known
|
||||||
/// to the compiler.
|
/// to the compiler.
|
||||||
///
|
///
|
||||||
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
/// Arrays coerce to [slices (`[T]`)][slice], so a slice method may be called on
|
||||||
|
@ -483,7 +477,7 @@ mod prim_pointer {}
|
||||||
/// Slices have a dynamic size and do not coerce to arrays.
|
/// Slices have a dynamic size and do not coerce to arrays.
|
||||||
///
|
///
|
||||||
/// You can move elements out of an array with a slice pattern. If you want
|
/// You can move elements out of an array with a slice pattern. If you want
|
||||||
/// one element, see [`mem::replace`][replace].
|
/// one element, see [`mem::replace`].
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
|
@ -535,22 +529,10 @@ mod prim_pointer {}
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [slice]: primitive.slice.html
|
/// [slice]: primitive.slice.html
|
||||||
/// [copy]: marker/trait.Copy.html
|
/// [`Debug`]: fmt::Debug
|
||||||
/// [clone]: clone/trait.Clone.html
|
/// [`Hash`]: hash::Hash
|
||||||
/// [debug]: fmt/trait.Debug.html
|
/// [`Borrow`]: borrow::Borrow
|
||||||
/// [intoiterator]: iter/trait.IntoIterator.html
|
/// [`BorrowMut`]: borrow::BorrowMut
|
||||||
/// [partialeq]: cmp/trait.PartialEq.html
|
|
||||||
/// [partialord]: cmp/trait.PartialOrd.html
|
|
||||||
/// [eq]: cmp/trait.Eq.html
|
|
||||||
/// [ord]: cmp/trait.Ord.html
|
|
||||||
/// [hash]: hash/trait.Hash.html
|
|
||||||
/// [asref]: convert/trait.AsRef.html
|
|
||||||
/// [asmut]: convert/trait.AsMut.html
|
|
||||||
/// [borrow]: borrow/trait.Borrow.html
|
|
||||||
/// [borrowmut]: borrow/trait.BorrowMut.html
|
|
||||||
/// [default]: default/trait.Default.html
|
|
||||||
/// [replace]: mem/fn.replace.html
|
|
||||||
/// [`IntoIterator`]: iter/trait.IntoIterator.html
|
|
||||||
///
|
///
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_array {}
|
mod prim_array {}
|
||||||
|
@ -563,7 +545,7 @@ mod prim_array {}
|
||||||
/// means that elements are laid out so that every element is the same
|
/// means that elements are laid out so that every element is the same
|
||||||
/// distance from its neighbors.
|
/// distance from its neighbors.
|
||||||
///
|
///
|
||||||
/// *[See also the `std::slice` module](slice/index.html).*
|
/// *[See also the `std::slice` module][`crate::slice`].*
|
||||||
///
|
///
|
||||||
/// Slices are a view into a block of memory represented as a pointer and a
|
/// Slices are a view into a block of memory represented as a pointer and a
|
||||||
/// length.
|
/// length.
|
||||||
|
@ -608,7 +590,7 @@ mod prim_slice {}
|
||||||
//
|
//
|
||||||
/// String slices.
|
/// String slices.
|
||||||
///
|
///
|
||||||
/// *[See also the `std::str` module](str/index.html).*
|
/// *[See also the `std::str` module][`crate::str`].*
|
||||||
///
|
///
|
||||||
/// The `str` type, also called a 'string slice', is the most primitive string
|
/// The `str` type, also called a 'string slice', is the most primitive string
|
||||||
/// type. It is usually seen in its borrowed form, `&str`. It is also the type
|
/// type. It is usually seen in its borrowed form, `&str`. It is also the type
|
||||||
|
@ -729,15 +711,8 @@ mod prim_str {}
|
||||||
/// * [`Default`]
|
/// * [`Default`]
|
||||||
/// * [`Hash`]
|
/// * [`Hash`]
|
||||||
///
|
///
|
||||||
/// [`Clone`]: clone/trait.Clone.html
|
/// [`Debug`]: fmt::Debug
|
||||||
/// [`Copy`]: marker/trait.Copy.html
|
/// [`Hash`]: hash::Hash
|
||||||
/// [`PartialEq`]: cmp/trait.PartialEq.html
|
|
||||||
/// [`Eq`]: cmp/trait.Eq.html
|
|
||||||
/// [`PartialOrd`]: cmp/trait.PartialOrd.html
|
|
||||||
/// [`Ord`]: cmp/trait.Ord.html
|
|
||||||
/// [`Debug`]: fmt/trait.Debug.html
|
|
||||||
/// [`Default`]: default/trait.Default.html
|
|
||||||
/// [`Hash`]: hash/trait.Hash.html
|
|
||||||
///
|
///
|
||||||
/// Due to a temporary restriction in Rust's type system, these traits are only
|
/// Due to a temporary restriction in Rust's type system, these traits are only
|
||||||
/// implemented on tuples of arity 12 or less. In the future, this may change.
|
/// implemented on tuples of arity 12 or less. In the future, this may change.
|
||||||
|
@ -810,7 +785,7 @@ mod prim_tuple {}
|
||||||
///
|
///
|
||||||
/// For more information on floating point numbers, see [Wikipedia][wikipedia].
|
/// For more information on floating point numbers, see [Wikipedia][wikipedia].
|
||||||
///
|
///
|
||||||
/// *[See also the `std::f32::consts` module](f32/consts/index.html).*
|
/// *[See also the `std::f32::consts` module][`crate::f32::consts`].*
|
||||||
///
|
///
|
||||||
/// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
|
/// [wikipedia]: https://en.wikipedia.org/wiki/Single-precision_floating-point_format
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
@ -819,12 +794,12 @@ mod prim_f32 {}
|
||||||
#[doc(primitive = "f64")]
|
#[doc(primitive = "f64")]
|
||||||
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
|
/// A 64-bit floating point type (specifically, the "binary64" type defined in IEEE 754-2008).
|
||||||
///
|
///
|
||||||
/// This type is very similar to [`f32`](primitive.f32.html), but has increased
|
/// This type is very similar to [`f32`], but has increased
|
||||||
/// precision by using twice as many bits. Please see [the documentation for
|
/// precision by using twice as many bits. Please see [the documentation for
|
||||||
/// `f32`](primitive.f32.html) or [Wikipedia on double precision
|
/// `f32`] or [Wikipedia on double precision
|
||||||
/// values][wikipedia] for more information.
|
/// values][wikipedia] for more information.
|
||||||
///
|
///
|
||||||
/// *[See also the `std::f64::consts` module](f64/consts/index.html).*
|
/// *[See also the `std::f64::consts` module][`crate::f64::consts`].*
|
||||||
///
|
///
|
||||||
/// [wikipedia]: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
|
/// [wikipedia]: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
@ -945,9 +920,6 @@ mod prim_usize {}
|
||||||
/// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while
|
/// implicit reference-pointer coercion and raw pointer equality via [`ptr::eq`], while
|
||||||
/// [`PartialEq`] compares values.
|
/// [`PartialEq`] compares values.
|
||||||
///
|
///
|
||||||
/// [`ptr::eq`]: ptr/fn.eq.html
|
|
||||||
/// [`PartialEq`]: cmp/trait.PartialEq.html
|
|
||||||
///
|
|
||||||
/// ```
|
/// ```
|
||||||
/// use std::ptr;
|
/// use std::ptr;
|
||||||
///
|
///
|
||||||
|
@ -979,11 +951,9 @@ mod prim_usize {}
|
||||||
/// * [`Borrow`]
|
/// * [`Borrow`]
|
||||||
/// * [`Pointer`]
|
/// * [`Pointer`]
|
||||||
///
|
///
|
||||||
/// [`Copy`]: marker/trait.Copy.html
|
/// [`Deref`]: ops::Deref
|
||||||
/// [`Clone`]: clone/trait.Clone.html
|
/// [`Borrow`]: borrow::Borrow
|
||||||
/// [`Deref`]: ops/trait.Deref.html
|
/// [`Pointer`]: fmt::Pointer
|
||||||
/// [`Borrow`]: borrow/trait.Borrow.html
|
|
||||||
/// [`Pointer`]: fmt/trait.Pointer.html
|
|
||||||
///
|
///
|
||||||
/// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating
|
/// `&mut T` references get all of the above except `Copy` and `Clone` (to prevent creating
|
||||||
/// multiple simultaneous mutable borrows), plus the following, regardless of the type of its
|
/// multiple simultaneous mutable borrows), plus the following, regardless of the type of its
|
||||||
|
@ -992,8 +962,8 @@ mod prim_usize {}
|
||||||
/// * [`DerefMut`]
|
/// * [`DerefMut`]
|
||||||
/// * [`BorrowMut`]
|
/// * [`BorrowMut`]
|
||||||
///
|
///
|
||||||
/// [`DerefMut`]: ops/trait.DerefMut.html
|
/// [`DerefMut`]: ops::DerefMut
|
||||||
/// [`BorrowMut`]: borrow/trait.BorrowMut.html
|
/// [`BorrowMut`]: borrow::BorrowMut
|
||||||
///
|
///
|
||||||
/// The following traits are implemented on `&T` references if the underlying `T` also implements
|
/// The following traits are implemented on `&T` references if the underlying `T` also implements
|
||||||
/// that trait:
|
/// that trait:
|
||||||
|
@ -1008,18 +978,10 @@ mod prim_usize {}
|
||||||
/// * [`Hash`]
|
/// * [`Hash`]
|
||||||
/// * [`ToSocketAddrs`]
|
/// * [`ToSocketAddrs`]
|
||||||
///
|
///
|
||||||
/// [`std::fmt`]: fmt/index.html
|
/// [`std::fmt`]: fmt
|
||||||
/// [`fmt::Write`]: fmt/trait.Write.html
|
/// ['Pointer`]: fmt::Pointer
|
||||||
/// [`PartialOrd`]: cmp/trait.PartialOrd.html
|
/// [`Hash`]: hash::Hash
|
||||||
/// [`Ord`]: cmp/trait.Ord.html
|
/// [`ToSocketAddrs`]: net::ToSocketAddrs
|
||||||
/// [`PartialEq`]: cmp/trait.PartialEq.html
|
|
||||||
/// [`Eq`]: cmp/trait.Eq.html
|
|
||||||
/// [`AsRef`]: convert/trait.AsRef.html
|
|
||||||
/// [`Fn`]: ops/trait.Fn.html
|
|
||||||
/// [`FnMut`]: ops/trait.FnMut.html
|
|
||||||
/// [`FnOnce`]: ops/trait.FnOnce.html
|
|
||||||
/// [`Hash`]: hash/trait.Hash.html
|
|
||||||
/// [`ToSocketAddrs`]: net/trait.ToSocketAddrs.html
|
|
||||||
///
|
///
|
||||||
/// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T`
|
/// `&mut T` references get all of the above except `ToSocketAddrs`, plus the following, if `T`
|
||||||
/// implements that trait:
|
/// implements that trait:
|
||||||
|
@ -1038,17 +1000,11 @@ mod prim_usize {}
|
||||||
/// * [`Seek`]
|
/// * [`Seek`]
|
||||||
/// * [`BufRead`]
|
/// * [`BufRead`]
|
||||||
///
|
///
|
||||||
/// [`AsMut`]: convert/trait.AsMut.html
|
/// [`FusedIterator`]: iter::FusedIterator
|
||||||
/// [`Iterator`]: iter/trait.Iterator.html
|
/// [`TrustedLen`]: iter::TrustedLen
|
||||||
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
|
/// [`Seek`]: io::Seek
|
||||||
/// [`ExactSizeIterator`]: iter/trait.ExactSizeIterator.html
|
/// [`BufRead`]: io::BufRead
|
||||||
/// [`FusedIterator`]: iter/trait.FusedIterator.html
|
/// [`Read`]: io::Read
|
||||||
/// [`TrustedLen`]: iter/trait.TrustedLen.html
|
|
||||||
/// [`Send`]: marker/trait.Send.html
|
|
||||||
/// [`io::Write`]: io/trait.Write.html
|
|
||||||
/// [`Read`]: io/trait.Read.html
|
|
||||||
/// [`Seek`]: io/trait.Seek.html
|
|
||||||
/// [`BufRead`]: io/trait.BufRead.html
|
|
||||||
///
|
///
|
||||||
/// Note that due to method call deref coercion, simply calling a trait method will act like they
|
/// Note that due to method call deref coercion, simply calling a trait method will act like they
|
||||||
/// work on references as well as they do on owned values! The implementations described here are
|
/// work on references as well as they do on owned values! The implementations described here are
|
||||||
|
@ -1063,9 +1019,9 @@ mod prim_ref {}
|
||||||
///
|
///
|
||||||
/// *See also the traits [`Fn`], [`FnMut`], and [`FnOnce`].*
|
/// *See also the traits [`Fn`], [`FnMut`], and [`FnOnce`].*
|
||||||
///
|
///
|
||||||
/// [`Fn`]: ops/trait.Fn.html
|
/// [`Fn`]: ops::Fn
|
||||||
/// [`FnMut`]: ops/trait.FnMut.html
|
/// [`FnMut`]: ops::FnMut
|
||||||
/// [`FnOnce`]: ops/trait.FnOnce.html
|
/// [`FnOnce`]: ops::FnOnce
|
||||||
///
|
///
|
||||||
/// Function pointers are pointers that point to *code*, not data. They can be called
|
/// Function pointers are pointers that point to *code*, not data. They can be called
|
||||||
/// just like functions. Like references, function pointers are, among other things, assumed to
|
/// just like functions. Like references, function pointers are, among other things, assumed to
|
||||||
|
@ -1177,14 +1133,8 @@ mod prim_ref {}
|
||||||
/// * [`Pointer`]
|
/// * [`Pointer`]
|
||||||
/// * [`Debug`]
|
/// * [`Debug`]
|
||||||
///
|
///
|
||||||
/// [`Clone`]: clone/trait.Clone.html
|
/// [`Hash`]: hash::Hash
|
||||||
/// [`PartialEq`]: cmp/trait.PartialEq.html
|
/// [`Pointer`]: fmt::Pointer
|
||||||
/// [`Eq`]: cmp/trait.Eq.html
|
|
||||||
/// [`PartialOrd`]: cmp/trait.PartialOrd.html
|
|
||||||
/// [`Ord`]: cmp/trait.Ord.html
|
|
||||||
/// [`Hash`]: hash/trait.Hash.html
|
|
||||||
/// [`Pointer`]: fmt/trait.Pointer.html
|
|
||||||
/// [`Debug`]: fmt/trait.Debug.html
|
|
||||||
///
|
///
|
||||||
/// Due to a temporary restriction in Rust's type system, these traits are only implemented on
|
/// Due to a temporary restriction in Rust's type system, these traits are only implemented on
|
||||||
/// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this
|
/// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this
|
||||||
|
@ -1193,7 +1143,5 @@ mod prim_ref {}
|
||||||
/// In addition, function pointers of *any* signature, ABI, or safety are [`Copy`], and all *safe*
|
/// In addition, function pointers of *any* signature, ABI, or safety are [`Copy`], and all *safe*
|
||||||
/// function pointers implement [`Fn`], [`FnMut`], and [`FnOnce`]. This works because these traits
|
/// function pointers implement [`Fn`], [`FnMut`], and [`FnOnce`]. This works because these traits
|
||||||
/// are specially known to the compiler.
|
/// are specially known to the compiler.
|
||||||
///
|
|
||||||
/// [`Copy`]: marker/trait.Copy.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
mod prim_fn {}
|
mod prim_fn {}
|
||||||
|
|
|
@ -9,8 +9,6 @@ use crate::sys::fs::osstr2str;
|
||||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner};
|
use crate::sys_common::{AsInner, AsInnerMut, FromInner};
|
||||||
|
|
||||||
/// WASI-specific extensions to [`File`].
|
/// WASI-specific extensions to [`File`].
|
||||||
///
|
|
||||||
/// [`File`]: ../../../../std/fs/struct.File.html
|
|
||||||
pub trait FileExt {
|
pub trait FileExt {
|
||||||
/// Reads a number of bytes starting from a given offset.
|
/// Reads a number of bytes starting from a given offset.
|
||||||
///
|
///
|
||||||
|
@ -23,8 +21,6 @@ pub trait FileExt {
|
||||||
///
|
///
|
||||||
/// Note that similar to [`File::read`], it is not an error to return with a
|
/// Note that similar to [`File::read`], it is not an error to return with a
|
||||||
/// short read.
|
/// short read.
|
||||||
///
|
|
||||||
/// [`File::read`]: ../../../../std/fs/struct.File.html#method.read
|
|
||||||
fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
||||||
let bufs = &mut [IoSliceMut::new(buf)];
|
let bufs = &mut [IoSliceMut::new(buf)];
|
||||||
self.read_vectored_at(bufs, offset)
|
self.read_vectored_at(bufs, offset)
|
||||||
|
@ -41,8 +37,6 @@ pub trait FileExt {
|
||||||
///
|
///
|
||||||
/// Note that similar to [`File::read_vectored`], it is not an error to
|
/// Note that similar to [`File::read_vectored`], it is not an error to
|
||||||
/// return with a short read.
|
/// return with a short read.
|
||||||
///
|
|
||||||
/// [`File::read`]: ../../../../std/fs/struct.File.html#method.read_vectored
|
|
||||||
fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize>;
|
fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize>;
|
||||||
|
|
||||||
/// Reads the exact number of byte required to fill `buf` from the given offset.
|
/// Reads the exact number of byte required to fill `buf` from the given offset.
|
||||||
|
@ -54,8 +48,7 @@ pub trait FileExt {
|
||||||
///
|
///
|
||||||
/// Similar to [`Read::read_exact`] but uses [`read_at`] instead of `read`.
|
/// Similar to [`Read::read_exact`] but uses [`read_at`] instead of `read`.
|
||||||
///
|
///
|
||||||
/// [`Read::read_exact`]: ../../../../std/io/trait.Read.html#method.read_exact
|
/// [`read_at`]: FileExt::read_at
|
||||||
/// [`read_at`]: #tymethod.read_at
|
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
|
@ -73,9 +66,6 @@ pub trait FileExt {
|
||||||
/// If this function returns an error, it is unspecified how many bytes it
|
/// If this function returns an error, it is unspecified how many bytes it
|
||||||
/// has read, but it will never read more than would be necessary to
|
/// has read, but it will never read more than would be necessary to
|
||||||
/// completely fill the buffer.
|
/// completely fill the buffer.
|
||||||
///
|
|
||||||
/// [`ErrorKind::Interrupted`]: ../../../../std/io/enum.ErrorKind.html#variant.Interrupted
|
|
||||||
/// [`ErrorKind::UnexpectedEof`]: ../../../../std/io/enum.ErrorKind.html#variant.UnexpectedEof
|
|
||||||
#[stable(feature = "rw_exact_all_at", since = "1.33.0")]
|
#[stable(feature = "rw_exact_all_at", since = "1.33.0")]
|
||||||
fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> {
|
fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> {
|
||||||
while !buf.is_empty() {
|
while !buf.is_empty() {
|
||||||
|
@ -111,8 +101,6 @@ pub trait FileExt {
|
||||||
///
|
///
|
||||||
/// Note that similar to [`File::write`], it is not an error to return a
|
/// Note that similar to [`File::write`], it is not an error to return a
|
||||||
/// short write.
|
/// short write.
|
||||||
///
|
|
||||||
/// [`File::write`]: ../../../../std/fs/struct.File.html#write.v
|
|
||||||
fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
|
fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
|
||||||
let bufs = &[IoSlice::new(buf)];
|
let bufs = &[IoSlice::new(buf)];
|
||||||
self.write_vectored_at(bufs, offset)
|
self.write_vectored_at(bufs, offset)
|
||||||
|
@ -132,8 +120,6 @@ pub trait FileExt {
|
||||||
///
|
///
|
||||||
/// Note that similar to [`File::write_vectored`], it is not an error to return a
|
/// Note that similar to [`File::write_vectored`], it is not an error to return a
|
||||||
/// short write.
|
/// short write.
|
||||||
///
|
|
||||||
/// [`File::write`]: ../../../../std/fs/struct.File.html#method.write_vectored
|
|
||||||
fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize>;
|
fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize>;
|
||||||
|
|
||||||
/// Attempts to write an entire buffer starting from a given offset.
|
/// Attempts to write an entire buffer starting from a given offset.
|
||||||
|
@ -155,8 +141,7 @@ pub trait FileExt {
|
||||||
/// This function will return the first error of
|
/// This function will return the first error of
|
||||||
/// non-[`ErrorKind::Interrupted`] kind that [`write_at`] returns.
|
/// non-[`ErrorKind::Interrupted`] kind that [`write_at`] returns.
|
||||||
///
|
///
|
||||||
/// [`ErrorKind::Interrupted`]: ../../../../std/io/enum.ErrorKind.html#variant.Interrupted
|
/// [`write_at`]: FileExt::write_at
|
||||||
/// [`write_at`]: #tymethod.write_at
|
|
||||||
#[stable(feature = "rw_exact_all_at", since = "1.33.0")]
|
#[stable(feature = "rw_exact_all_at", since = "1.33.0")]
|
||||||
fn write_all_at(&self, mut buf: &[u8], mut offset: u64) -> io::Result<()> {
|
fn write_all_at(&self, mut buf: &[u8], mut offset: u64) -> io::Result<()> {
|
||||||
while !buf.is_empty() {
|
while !buf.is_empty() {
|
||||||
|
@ -289,8 +274,6 @@ impl FileExt for fs::File {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// WASI-specific extensions to [`fs::OpenOptions`].
|
/// WASI-specific extensions to [`fs::OpenOptions`].
|
||||||
///
|
|
||||||
/// [`fs::OpenOptions`]: ../../../../std/fs/struct.OpenOptions.html
|
|
||||||
pub trait OpenOptionsExt {
|
pub trait OpenOptionsExt {
|
||||||
/// Pass custom `dirflags` argument to `path_open`.
|
/// Pass custom `dirflags` argument to `path_open`.
|
||||||
///
|
///
|
||||||
|
@ -406,8 +389,6 @@ impl OpenOptionsExt for OpenOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// WASI-specific extensions to [`fs::Metadata`].
|
/// WASI-specific extensions to [`fs::Metadata`].
|
||||||
///
|
|
||||||
/// [`fs::Metadata`]: ../../../../std/fs/struct.Metadata.html
|
|
||||||
pub trait MetadataExt {
|
pub trait MetadataExt {
|
||||||
/// Returns the `st_dev` field of the internal `filestat_t`
|
/// Returns the `st_dev` field of the internal `filestat_t`
|
||||||
fn dev(&self) -> u64;
|
fn dev(&self) -> u64;
|
||||||
|
@ -448,8 +429,6 @@ impl MetadataExt for fs::Metadata {
|
||||||
///
|
///
|
||||||
/// Adds support for special WASI file types such as block/character devices,
|
/// Adds support for special WASI file types such as block/character devices,
|
||||||
/// pipes, and sockets.
|
/// pipes, and sockets.
|
||||||
///
|
|
||||||
/// [`FileType`]: ../../../../std/fs/struct.FileType.html
|
|
||||||
pub trait FileTypeExt {
|
pub trait FileTypeExt {
|
||||||
/// Returns `true` if this file type is a block device.
|
/// Returns `true` if this file type is a block device.
|
||||||
fn is_block_device(&self) -> bool;
|
fn is_block_device(&self) -> bool;
|
||||||
|
@ -477,8 +456,6 @@ impl FileTypeExt for fs::FileType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// WASI-specific extension methods for [`fs::DirEntry`].
|
/// WASI-specific extension methods for [`fs::DirEntry`].
|
||||||
///
|
|
||||||
/// [`fs::DirEntry`]: ../../../../std/fs/struct.DirEntry.html
|
|
||||||
pub trait DirEntryExt {
|
pub trait DirEntryExt {
|
||||||
/// Returns the underlying `d_ino` field of the `dirent_t`
|
/// Returns the underlying `d_ino` field of the `dirent_t`
|
||||||
fn ino(&self) -> u64;
|
fn ino(&self) -> u64;
|
||||||
|
|
|
@ -232,23 +232,17 @@ impl Slice {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Platform-specific extensions to [`OsString`].
|
/// Platform-specific extensions to [`OsString`].
|
||||||
///
|
|
||||||
/// [`OsString`]: ../../../../std/ffi/struct.OsString.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub trait OsStringExt {
|
pub trait OsStringExt {
|
||||||
/// Creates an [`OsString`] from a byte vector.
|
/// Creates an [`OsString`] from a byte vector.
|
||||||
///
|
///
|
||||||
/// See the module documentation for an example.
|
/// See the module documentation for an example.
|
||||||
///
|
|
||||||
/// [`OsString`]: ../../../ffi/struct.OsString.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn from_vec(vec: Vec<u8>) -> Self;
|
fn from_vec(vec: Vec<u8>) -> Self;
|
||||||
|
|
||||||
/// Yields the underlying byte vector of this [`OsString`].
|
/// Yields the underlying byte vector of this [`OsString`].
|
||||||
///
|
///
|
||||||
/// See the module documentation for an example.
|
/// See the module documentation for an example.
|
||||||
///
|
|
||||||
/// [`OsString`]: ../../../ffi/struct.OsString.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn into_vec(self) -> Vec<u8>;
|
fn into_vec(self) -> Vec<u8>;
|
||||||
}
|
}
|
||||||
|
@ -264,23 +258,17 @@ impl OsStringExt for OsString {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Platform-specific extensions to [`OsStr`].
|
/// Platform-specific extensions to [`OsStr`].
|
||||||
///
|
|
||||||
/// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub trait OsStrExt {
|
pub trait OsStrExt {
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
/// Creates an [`OsStr`] from a byte slice.
|
/// Creates an [`OsStr`] from a byte slice.
|
||||||
///
|
///
|
||||||
/// See the module documentation for an example.
|
/// See the module documentation for an example.
|
||||||
///
|
|
||||||
/// [`OsStr`]: ../../../ffi/struct.OsStr.html
|
|
||||||
fn from_bytes(slice: &[u8]) -> &Self;
|
fn from_bytes(slice: &[u8]) -> &Self;
|
||||||
|
|
||||||
/// Gets the underlying byte view of the [`OsStr`] slice.
|
/// Gets the underlying byte view of the [`OsStr`] slice.
|
||||||
///
|
///
|
||||||
/// See the module documentation for an example.
|
/// See the module documentation for an example.
|
||||||
///
|
|
||||||
/// [`OsStr`]: ../../../ffi/struct.OsStr.html
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn as_bytes(&self) -> &[u8];
|
fn as_bytes(&self) -> &[u8];
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ pub struct Guard {
|
||||||
/// };
|
/// };
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`Mutex`]: ../../std/sync/struct.Mutex.html
|
/// [`Mutex`]: crate::sync::Mutex
|
||||||
/// [`RwLock`]: ../../std/sync/struct.RwLock.html
|
/// [`RwLock`]: crate::sync::RwLock
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub struct PoisonError<T> {
|
pub struct PoisonError<T> {
|
||||||
guard: T,
|
guard: T,
|
||||||
|
@ -89,12 +89,11 @@ pub struct PoisonError<T> {
|
||||||
/// can occur while trying to acquire a lock, from the [`try_lock`] method on a
|
/// can occur while trying to acquire a lock, from the [`try_lock`] method on a
|
||||||
/// [`Mutex`] or the [`try_read`] and [`try_write`] methods on an [`RwLock`].
|
/// [`Mutex`] or the [`try_read`] and [`try_write`] methods on an [`RwLock`].
|
||||||
///
|
///
|
||||||
/// [`Mutex`]: struct.Mutex.html
|
/// [`Mutex`]: crate::sync::Mutex
|
||||||
/// [`RwLock`]: struct.RwLock.html
|
/// [`RwLock`]: crate::sync::RwLock
|
||||||
/// [`TryLockResult`]: type.TryLockResult.html
|
/// [`try_lock`]: crate::sync::Mutex::try_lock
|
||||||
/// [`try_lock`]: struct.Mutex.html#method.try_lock
|
/// [`try_read`]: crate::sync::RwLock::try_read
|
||||||
/// [`try_read`]: struct.RwLock.html#method.try_read
|
/// [`try_write`]: crate::sync::RwLock::try_write
|
||||||
/// [`try_write`]: struct.RwLock.html#method.try_write
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub enum TryLockError<T> {
|
pub enum TryLockError<T> {
|
||||||
/// The lock could not be acquired because another thread failed while holding
|
/// The lock could not be acquired because another thread failed while holding
|
||||||
|
@ -115,9 +114,7 @@ pub enum TryLockError<T> {
|
||||||
/// the associated guard, and it can be acquired through the [`into_inner`]
|
/// the associated guard, and it can be acquired through the [`into_inner`]
|
||||||
/// method.
|
/// method.
|
||||||
///
|
///
|
||||||
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
|
/// [`into_inner`]: PoisonError::into_inner
|
||||||
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
|
|
||||||
/// [`into_inner`]: ../../std/sync/struct.PoisonError.html#method.into_inner
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;
|
pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;
|
||||||
|
|
||||||
|
@ -126,9 +123,6 @@ pub type LockResult<Guard> = Result<Guard, PoisonError<Guard>>;
|
||||||
/// For more information, see [`LockResult`]. A `TryLockResult` doesn't
|
/// For more information, see [`LockResult`]. A `TryLockResult` doesn't
|
||||||
/// necessarily hold the associated guard in the [`Err`] type as the lock may not
|
/// necessarily hold the associated guard in the [`Err`] type as the lock may not
|
||||||
/// have been acquired for other reasons.
|
/// have been acquired for other reasons.
|
||||||
///
|
|
||||||
/// [`LockResult`]: ../../std/sync/type.LockResult.html
|
|
||||||
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
|
pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
|
||||||
|
|
||||||
|
@ -159,8 +153,8 @@ impl<T> PoisonError<T> {
|
||||||
///
|
///
|
||||||
/// This is generally created by methods like [`Mutex::lock`] or [`RwLock::read`].
|
/// This is generally created by methods like [`Mutex::lock`] or [`RwLock::read`].
|
||||||
///
|
///
|
||||||
/// [`Mutex::lock`]: ../../std/sync/struct.Mutex.html#method.lock
|
/// [`Mutex::lock`]: crate::sync::Mutex::lock
|
||||||
/// [`RwLock::read`]: ../../std/sync/struct.RwLock.html#method.read
|
/// [`RwLock::read`]: crate::sync::RwLock::read
|
||||||
#[stable(feature = "sync_poison", since = "1.2.0")]
|
#[stable(feature = "sync_poison", since = "1.2.0")]
|
||||||
pub fn new(guard: T) -> PoisonError<T> {
|
pub fn new(guard: T) -> PoisonError<T> {
|
||||||
PoisonError { guard }
|
PoisonError { guard }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue