added Error and Display impl for std::ffi::FromBytesWithNulError
This commit is contained in:
parent
0128be9ad7
commit
6a10e63ca0
1 changed files with 14 additions and 0 deletions
|
|
@ -455,6 +455,20 @@ impl From<NulError> for io::Error {
|
|||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "frombyteswithnulerror_impls", reason = "recently added", issue = "39925")]
|
||||
impl Error for FromBytesWithNulError {
|
||||
fn description(&self) -> &str {
|
||||
"data provided is not null terminated or contains an interior nul byte"
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "frombyteswithnulerror_impls", reason = "recently added", issue = "39925")]
|
||||
impl fmt::Display for FromBytesWithNulError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.description().fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoStringError {
|
||||
/// Consumes this error, returning original `CString` which generated the
|
||||
/// error.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue