Add doc example for `NulError`.

This commit is contained in:
Corey Farwell 2017-06-18 17:31:06 -07:00
parent e52d2f2ad0
commit 4797d8446c
1 changed files with 8 additions and 0 deletions

View File

@ -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<u8>);