about summary refs log tree commit diff
path: root/library/std/src/ffi
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-09-15 09:14:20 -0700
committerMichael Howell <michael@notriddle.com>2021-09-15 09:14:20 -0700
commitcc7929b1bd2c50c5b07442195fc6b0a13fa61d35 (patch)
treea789aceb05b21b6e2df9c4fe59dbdf8444d5c028 /library/std/src/ffi
parentef44452a83a21742d67187c0f23d96ce5a05aaff (diff)
downloadrust-cc7929b1bd2c50c5b07442195fc6b0a13fa61d35.tar.gz
rust-cc7929b1bd2c50c5b07442195fc6b0a13fa61d35.zip
docs(std): add docs for cof_from_cstr impls
CC #51430
Diffstat (limited to 'library/std/src/ffi')
-rw-r--r--library/std/src/ffi/c_str.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs
index de05c377852..3b917550308 100644
--- a/library/std/src/ffi/c_str.rs
+++ b/library/std/src/ffi/c_str.rs
@@ -915,6 +915,7 @@ impl From<CString> for Box<CStr> {
 
 #[stable(feature = "cow_from_cstr", since = "1.28.0")]
 impl<'a> From<CString> for Cow<'a, CStr> {
+    /// Converts a [`CString`] into an owned [`Cow`] without copying or allocating.
     #[inline]
     fn from(s: CString) -> Cow<'a, CStr> {
         Cow::Owned(s)
@@ -923,6 +924,7 @@ impl<'a> From<CString> for Cow<'a, CStr> {
 
 #[stable(feature = "cow_from_cstr", since = "1.28.0")]
 impl<'a> From<&'a CStr> for Cow<'a, CStr> {
+    /// Converts a [`CStr`] into a borrowed [`Cow`] without copying or allocating.
     #[inline]
     fn from(s: &'a CStr) -> Cow<'a, CStr> {
         Cow::Borrowed(s)
@@ -931,6 +933,7 @@ impl<'a> From<&'a CStr> for Cow<'a, CStr> {
 
 #[stable(feature = "cow_from_cstr", since = "1.28.0")]
 impl<'a> From<&'a CString> for Cow<'a, CStr> {
+    /// Converts a `&`[`CString`] into a borrowed [`Cow`] without copying or allocating.
     #[inline]
     fn from(s: &'a CString) -> Cow<'a, CStr> {
         Cow::Borrowed(s.as_c_str())