Skip to content

Commit 3e2d427

Browse files
authored
Rollup merge of rust-lang#56731 - GuillaumeGomez:ffi-doc-urls, r=Centril
Add missing urls in ffi module docs r? @QuietMisdreavus
2 parents 7e8c317 + b96186b commit 3e2d427

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/libstd/ffi/mod.rs

+15-13
Original file line numberDiff line numberDiff line change
@@ -72,40 +72,40 @@
7272
//!
7373
//! * **From Rust to C:** [`CString`] represents an owned, C-friendly
7474
//! string: it is nul-terminated, and has no internal nul characters.
75-
//! Rust code can create a `CString` out of a normal string (provided
75+
//! Rust code can create a [`CString`] out of a normal string (provided
7676
//! that the string doesn't have nul characters in the middle), and
77-
//! then use a variety of methods to obtain a raw `*mut u8` that can
77+
//! then use a variety of methods to obtain a raw `*mut `[`u8`] that can
7878
//! then be passed as an argument to functions which use the C
7979
//! conventions for strings.
8080
//!
8181
//! * **From C to Rust:** [`CStr`] represents a borrowed C string; it
82-
//! is what you would use to wrap a raw `*const u8` that you got from
83-
//! a C function. A `CStr` is guaranteed to be a nul-terminated array
84-
//! of bytes. Once you have a `CStr`, you can convert it to a Rust
85-
//! `&str` if it's valid UTF-8, or lossily convert it by adding
82+
//! is what you would use to wrap a raw `*const `[`u8`] that you got from
83+
//! a C function. A [`CStr`] is guaranteed to be a nul-terminated array
84+
//! of bytes. Once you have a [`CStr`], you can convert it to a Rust
85+
//! [`&str`][`str`] if it's valid UTF-8, or lossily convert it by adding
8686
//! replacement characters.
8787
//!
8888
//! [`OsString`] and [`OsStr`] are useful when you need to transfer
8989
//! strings to and from the operating system itself, or when capturing
90-
//! the output of external commands. Conversions between `OsString`,
91-
//! `OsStr` and Rust strings work similarly to those for [`CString`]
90+
//! the output of external commands. Conversions between [`OsString`],
91+
//! [`OsStr`] and Rust strings work similarly to those for [`CString`]
9292
//! and [`CStr`].
9393
//!
9494
//! * [`OsString`] represents an owned string in whatever
9595
//! representation the operating system prefers. In the Rust standard
9696
//! library, various APIs that transfer strings to/from the operating
97-
//! system use `OsString` instead of plain strings. For example,
97+
//! system use [`OsString`] instead of plain strings. For example,
9898
//! [`env::var_os()`] is used to query environment variables; it
99-
//! returns an `Option<OsString>`. If the environment variable exists
100-
//! you will get a `Some(os_string)`, which you can *then* try to
99+
//! returns an [`Option`]`<`[`OsString`]`>`. If the environment variable
100+
//! exists you will get a [`Some`]`(os_string)`, which you can *then* try to
101101
//! convert to a Rust string. This yields a [`Result<>`], so that
102102
//! your code can detect errors in case the environment variable did
103103
//! not in fact contain valid Unicode data.
104104
//!
105105
//! * [`OsStr`] represents a borrowed reference to a string in a
106106
//! format that can be passed to the operating system. It can be
107107
//! converted into an UTF-8 Rust string slice in a similar way to
108-
//! `OsString`.
108+
//! [`OsString`].
109109
//!
110110
//! # Conversions
111111
//!
@@ -131,7 +131,7 @@
131131
//! Additionally, on Windows [`OsString`] implements the
132132
//! `std::os::windows:ffi::`[`OsStringExt`][windows.OsStringExt]
133133
//! trait, which provides a [`from_wide`] method. The result of this
134-
//! method is an `OsString` which can be round-tripped to a Windows
134+
//! method is an [`OsString`] which can be round-tripped to a Windows
135135
//! string losslessly.
136136
//!
137137
//! [`String`]: ../string/struct.String.html
@@ -160,6 +160,8 @@
160160
//! [`collect`]: ../iter/trait.Iterator.html#method.collect
161161
//! [windows.OsStringExt]: ../os/windows/ffi/trait.OsStringExt.html
162162
//! [`from_wide`]: ../os/windows/ffi/trait.OsStringExt.html#tymethod.from_wide
163+
//! [`Option`]: ../option/enum.Option.html
164+
//! [`Some`]: ../option/enum.Option.html#variant.Some
163165
164166
#![stable(feature = "rust1", since = "1.0.0")]
165167

0 commit comments

Comments
 (0)