3030//! [`OsString`] is the Rust wrapper for owned strings in the
3131//! preferred representation of the operating system. On Windows,
3232//! this struct gets augmented with an implementation of the
33- //! [`OsStringExt`] trait, which has a [`from_wide`] method. This
33+ //! [`OsStringExt`] trait, which has a [`OsStringExt:: from_wide`] method. This
3434//! lets you create an [`OsString`] from a `&[u16]` slice; presumably
3535//! you get such a slice out of a `WCHAR` Windows API.
3636//!
3737//! Similarly, [`OsStr`] is the Rust wrapper for borrowed strings from
3838//! preferred representation of the operating system. On Windows, the
39- //! [`OsStrExt`] trait provides the [`encode_wide`] method, which
39+ //! [`OsStrExt`] trait provides the [`OsStrExt:: encode_wide`] method, which
4040//! outputs an [`EncodeWide`] iterator. You can [`collect`] this
4141//! iterator, for example, to obtain a `Vec<u16>`; you can later get a
4242//! pointer to this vector's contents and feed it to Windows APIs.
4747//! ill-formed UTF-16.
4848//!
4949//! [ill-formed-utf-16]: https://simonsapin.github.io/wtf-8/#ill-formed-utf-16
50- //! [`OsString`]: ../../../ffi/struct.OsString.html
51- //! [`OsStr`]: ../../../ffi/struct.OsStr.html
52- //! [`OsStringExt`]: trait.OsStringExt.html
53- //! [`OsStrExt`]: trait.OsStrExt.html
54- //! [`EncodeWide`]: struct.EncodeWide.html
55- //! [`from_wide`]: trait.OsStringExt.html#tymethod.from_wide
56- //! [`encode_wide`]: trait.OsStrExt.html#tymethod.encode_wide
57- //! [`collect`]: ../../../iter/trait.Iterator.html#method.collect
58- //! [U+FFFD]: ../../../char/constant.REPLACEMENT_CHARACTER.html
50+ //! [`collect`]: crate::iter::Iterator::collect
51+ //! [U+FFFD]: crate::char::REPLACEMENT_CHARACTER
5952
6053#![ stable( feature = "rust1" , since = "1.0.0" ) ]
6154
@@ -68,14 +61,12 @@ use crate::sys_common::{AsInner, FromInner};
6861pub use crate :: sys_common:: wtf8:: EncodeWide ;
6962
7063/// Windows-specific extensions to [`OsString`].
71- ///
72- /// [`OsString`]: ../../../../std/ffi/struct.OsString.html
7364#[ stable( feature = "rust1" , since = "1.0.0" ) ]
7465pub trait OsStringExt {
7566 /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of
7667 /// 16-bit code units.
7768 ///
78- /// This is lossless: calling [`encode_wide`] on the resulting string
69+ /// This is lossless: calling [`OsStrExt:: encode_wide`] on the resulting string
7970 /// will always return the original code units.
8071 ///
8172 /// # Examples
@@ -89,8 +80,6 @@ pub trait OsStringExt {
8980 ///
9081 /// let string = OsString::from_wide(&source[..]);
9182 /// ```
92- ///
93- /// [`encode_wide`]: ./trait.OsStrExt.html#tymethod.encode_wide
9483 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
9584 fn from_wide ( wide : & [ u16 ] ) -> Self ;
9685}
@@ -103,14 +92,12 @@ impl OsStringExt for OsString {
10392}
10493
10594/// Windows-specific extensions to [`OsStr`].
106- ///
107- /// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html
10895#[ stable( feature = "rust1" , since = "1.0.0" ) ]
10996pub trait OsStrExt {
11097 /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially
11198 /// ill-formed UTF-16.
11299 ///
113- /// This is lossless: calling [`OsString ::from_wide`] and then
100+ /// This is lossless: calling [`OsStringExt ::from_wide`] and then
114101 /// `encode_wide` on the result will yield the original code units.
115102 /// Note that the encoding does not add a final null terminator.
116103 ///
@@ -128,8 +115,6 @@ pub trait OsStrExt {
128115 /// let result: Vec<u16> = string.encode_wide().collect();
129116 /// assert_eq!(&source[..], &result[..]);
130117 /// ```
131- ///
132- /// [`OsString::from_wide`]: ./trait.OsStringExt.html#tymethod.from_wide
133118 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
134119 fn encode_wide ( & self ) -> EncodeWide < ' _ > ;
135120}
0 commit comments