pub trait IoResultExt<T>: Sealed + Sized {
// Required methods
fn optional(self) -> Result<Option<T>>;
fn can_exist(self) -> Self
where T: Default;
}
Expand description
A collection of helper methods for std::io::Result
.
Required Methods§
Sourcefn can_exist(self) -> Selfwhere
T: Default,
fn can_exist(self) -> Selfwhere
T: Default,
Mask ErrorKind::AlreadyExists
errors.
fs::create_dir("cache").can_exist()?;
// And then on a later run...
fs::create_dir("cache").can_exist()?;
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.