30
30
//! [`OsString`] is the Rust wrapper for owned strings in the
31
31
//! preferred representation of the operating system. On Windows,
32
32
//! 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
34
34
//! lets you create an [`OsString`] from a `&[u16]` slice; presumably
35
35
//! you get such a slice out of a `WCHAR` Windows API.
36
36
//!
37
37
//! Similarly, [`OsStr`] is the Rust wrapper for borrowed strings from
38
38
//! 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
40
40
//! outputs an [`EncodeWide`] iterator. You can [`collect`] this
41
41
//! iterator, for example, to obtain a `Vec<u16>`; you can later get a
42
42
//! pointer to this vector's contents and feed it to Windows APIs.
47
47
//! ill-formed UTF-16.
48
48
//!
49
49
//! [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
59
52
60
53
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
61
54
@@ -68,14 +61,12 @@ use crate::sys_common::{AsInner, FromInner};
68
61
pub use crate :: sys_common:: wtf8:: EncodeWide ;
69
62
70
63
/// Windows-specific extensions to [`OsString`].
71
- ///
72
- /// [`OsString`]: ../../../../std/ffi/struct.OsString.html
73
64
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
74
65
pub trait OsStringExt {
75
66
/// Creates an `OsString` from a potentially ill-formed UTF-16 slice of
76
67
/// 16-bit code units.
77
68
///
78
- /// This is lossless: calling [`encode_wide`] on the resulting string
69
+ /// This is lossless: calling [`OsStrExt:: encode_wide`] on the resulting string
79
70
/// will always return the original code units.
80
71
///
81
72
/// # Examples
@@ -89,8 +80,6 @@ pub trait OsStringExt {
89
80
///
90
81
/// let string = OsString::from_wide(&source[..]);
91
82
/// ```
92
- ///
93
- /// [`encode_wide`]: ./trait.OsStrExt.html#tymethod.encode_wide
94
83
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
95
84
fn from_wide ( wide : & [ u16 ] ) -> Self ;
96
85
}
@@ -103,14 +92,12 @@ impl OsStringExt for OsString {
103
92
}
104
93
105
94
/// Windows-specific extensions to [`OsStr`].
106
- ///
107
- /// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html
108
95
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
109
96
pub trait OsStrExt {
110
97
/// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially
111
98
/// ill-formed UTF-16.
112
99
///
113
- /// This is lossless: calling [`OsString ::from_wide`] and then
100
+ /// This is lossless: calling [`OsStringExt ::from_wide`] and then
114
101
/// `encode_wide` on the result will yield the original code units.
115
102
/// Note that the encoding does not add a final null terminator.
116
103
///
@@ -128,8 +115,6 @@ pub trait OsStrExt {
128
115
/// let result: Vec<u16> = string.encode_wide().collect();
129
116
/// assert_eq!(&source[..], &result[..]);
130
117
/// ```
131
- ///
132
- /// [`OsString::from_wide`]: ./trait.OsStringExt.html#tymethod.from_wide
133
118
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
134
119
fn encode_wide ( & self ) -> EncodeWide < ' _ > ;
135
120
}
0 commit comments