Update document for std::io::Error::downcast

This commit is contained in:
Jiahao XU 2024-04-12 23:03:36 +10:00 committed by GitHub
parent ab71ee7a92
commit 4a6b1562b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -852,15 +852,15 @@ pub fn into_inner(self) -> Option<Box<dyn error::Error + Send + Sync>> {
}
}
/// Attempt to downcast the inner error to `E` if any.
/// Attempt to downcast the custom boxed error to `E`.
///
/// If this [`Error`] was constructed via [`new`] then this function will
/// attempt to perform downgrade on it, otherwise it will return [`Err`].
/// If this [`Error`] when this contains a custom boxed error,
/// then it would attempt downcasting on the boxed error,
/// otherwise it will return [`Err`].
///
/// If the downcast succeeds, it will return [`Ok`], otherwise it will also
/// return [`Err`].
/// If the custom boxed error has the same type as `E`, it will return [`Ok`],
/// otherwise it will also return [`Err`].
///
/// [`new`]: Error::new
///
/// # Examples
///