Rollup merge of #103680 - RalfJung:cstr-links, r=JohnTitor

CStr: add some doc links
This commit is contained in:
Matthias Krüger 2022-11-04 12:18:00 +01:00 committed by GitHub
commit 428dd011ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,9 +13,9 @@
/// array of bytes. It can be constructed safely from a <code>&[[u8]]</code>
/// slice, or unsafely from a raw `*const c_char`. It can then be
/// converted to a Rust <code>&[str]</code> by performing UTF-8 validation, or
/// into an owned `CString`.
/// into an owned [`CString`].
///
/// `&CStr` is to `CString` as <code>&[str]</code> is to `String`: the former
/// `&CStr` is to [`CString`] as <code>&[str]</code> is to [`String`]: the former
/// in each pair are borrowed references; the latter are owned
/// strings.
///
@ -24,6 +24,9 @@
/// functions may leverage the unsafe [`CStr::from_ptr`] constructor to provide
/// a safe interface to other consumers.
///
/// [`CString`]: ../../std/ffi/struct.CString.html
/// [`String`]: ../../std/string/struct.String.html
///
/// # Examples
///
/// Inspecting a foreign C string: