From 4797d8446c73eb8ca96d29aec336787f719a071c Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 18 Jun 2017 17:31:06 -0700 Subject: [PATCH] Add doc example for `NulError`. --- src/libstd/ffi/c_str.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 8a7757fde882b..bedd5f524c789 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -152,6 +152,14 @@ pub struct CStr { /// in the vector provided. /// /// [`CString::new`]: struct.CString.html#method.new +/// +/// # Examples +/// +/// ``` +/// use std::ffi::{CString, NulError}; +/// +/// let _: NulError = CString::new(b"f\0oo".to_vec()).unwrap_err(); +/// ``` #[derive(Clone, PartialEq, Eq, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct NulError(usize, Vec);