@@ -642,6 +642,12 @@ impl fmt::Debug for CString {
642642
643643#[ stable( feature = "cstring_into" , since = "1.7.0" ) ]
644644impl From < CString > for Vec < u8 > {
645+ /// Converts a [`CString`] into a [`Vec`]`<u8>`.
646+ ///
647+ /// The conversion consumes the [`CString`], and removes the terminating NUL byte.
648+ ///
649+ /// [`Vec`]: ../vec/struct.Vec.html
650+ /// [`CString`]: ../ffi/struct.CString.html
645651 #[ inline]
646652 fn from ( s : CString ) -> Vec < u8 > {
647653 s. into_bytes ( )
@@ -700,6 +706,10 @@ impl<'a> From<&'a CStr> for Box<CStr> {
700706
701707#[ stable( feature = "c_string_from_box" , since = "1.18.0" ) ]
702708impl From < Box < CStr > > for CString {
709+ /// Converts a [`Box`]`<CStr>` into a [`CString`] without copying or allocating.
710+ ///
711+ /// [`Box`]: ../boxed/struct.Box.html
712+ /// [`CString`]: ../ffi/struct.CString.html
703713 #[ inline]
704714 fn from ( s : Box < CStr > ) -> CString {
705715 s. into_c_string ( )
@@ -716,6 +726,10 @@ impl Clone for Box<CStr> {
716726
717727#[ stable( feature = "box_from_c_string" , since = "1.20.0" ) ]
718728impl From < CString > for Box < CStr > {
729+ /// Converts a [`CString`] into a [`Box`]`<CStr>` without copying or allocating.
730+ ///
731+ /// [`CString`]: ../ffi/struct.CString.html
732+ /// [`Box`]: ../boxed/struct.Box.html
719733 #[ inline]
720734 fn from ( s : CString ) -> Box < CStr > {
721735 s. into_boxed_c_str ( )
@@ -748,6 +762,10 @@ impl<'a> From<&'a CString> for Cow<'a, CStr> {
748762
749763#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
750764impl From < CString > for Arc < CStr > {
765+ /// Converts a [`CString`] into a [`Arc`]`<CStr>` without copying or allocating.
766+ ///
767+ /// [`CString`]: ../ffi/struct.CString.html
768+ /// [`Arc`]: ../sync/struct.Arc.html
751769 #[ inline]
752770 fn from ( s : CString ) -> Arc < CStr > {
753771 let arc: Arc < [ u8 ] > = Arc :: from ( s. into_inner ( ) ) ;
@@ -766,6 +784,10 @@ impl<'a> From<&'a CStr> for Arc<CStr> {
766784
767785#[ stable( feature = "shared_from_slice2" , since = "1.24.0" ) ]
768786impl From < CString > for Rc < CStr > {
787+ /// Converts a [`CString`] into a [`Rc`]`<CStr>` without copying or allocating.
788+ ///
789+ /// [`CString`]: ../ffi/struct.CString.html
790+ /// [`Rc`]: ../rc/struct.Rc.html
769791 #[ inline]
770792 fn from ( s : CString ) -> Rc < CStr > {
771793 let rc: Rc < [ u8 ] > = Rc :: from ( s. into_inner ( ) ) ;
@@ -839,6 +861,10 @@ impl fmt::Display for NulError {
839861
840862#[ stable( feature = "rust1" , since = "1.0.0" ) ]
841863impl From < NulError > for io:: Error {
864+ /// Converts a [`NulError`] into a [`io::Error`].
865+ ///
866+ /// [`NulError`]: ../ffi/struct.NulError.html
867+ /// [`io::Error`]: ../io/struct.Error.html
842868 fn from ( _: NulError ) -> io:: Error {
843869 io:: Error :: new ( io:: ErrorKind :: InvalidInput ,
844870 "data provided contains a nul byte" )
0 commit comments