diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-06-18 17:44:41 -0700 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2017-06-20 13:49:42 -0400 |
| commit | d3c26fe7e32630470ed6ffc53cf65cdeaeecd9e9 (patch) | |
| tree | cd70e9c7d37a3ff0cfe6bfbb41bfe09e022329db /src/libstd | |
| parent | 4797d8446c73eb8ca96d29aec336787f719a071c (diff) | |
| download | rust-d3c26fe7e32630470ed6ffc53cf65cdeaeecd9e9.tar.gz rust-d3c26fe7e32630470ed6ffc53cf65cdeaeecd9e9.zip | |
Add doc example for `FromBytesWithNulError`.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index bedd5f524c7..ca7cd37a88d 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -168,6 +168,14 @@ pub struct NulError(usize, Vec<u8>); /// byte was found too early in the slice provided or one wasn't found at all. /// /// [`CStr::from_bytes_with_nul`]: struct.CStr.html#method.from_bytes_with_nul +/// +/// # Examples +/// +/// ``` +/// use std::ffi::{CStr, FromBytesWithNulError}; +/// +/// let _: FromBytesWithNulError = CStr::from_bytes_with_nul(b"f\0oo").unwrap_err(); +/// ``` #[derive(Clone, PartialEq, Eq, Debug)] #[stable(feature = "cstr_from_bytes", since = "1.10.0")] pub struct FromBytesWithNulError { |
