Skip to content

Commit 4797d84

Browse files
committed
Add doc example for NulError.
1 parent e52d2f2 commit 4797d84

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libstd/ffi/c_str.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ pub struct CStr {
152152
/// in the vector provided.
153153
///
154154
/// [`CString::new`]: struct.CString.html#method.new
155+
///
156+
/// # Examples
157+
///
158+
/// ```
159+
/// use std::ffi::{CString, NulError};
160+
///
161+
/// let _: NulError = CString::new(b"f\0oo".to_vec()).unwrap_err();
162+
/// ```
155163
#[derive(Clone, PartialEq, Eq, Debug)]
156164
#[stable(feature = "rust1", since = "1.0.0")]
157165
pub struct NulError(usize, Vec<u8>);

0 commit comments

Comments
 (0)