Expand description
A result type for testing that supports to eliminate using of
Result::unwrap. So a library may enforce flags such as -D clippy::unwrap_used without hassle.
Set environment RUST_BACKTRACE=1 to enable backtrace. The first
backtrace’s frame does not point to the error’s location accuracy.
Sometimes, the third or fourth does. This issue may be solved once
Backtrace::frames is stable.
Do not use Result for anything other than testing. Because it depends on
Error that does not implement std::error::Error. This is not a choice.
There is no way to implemnt std::error::Error and From<dyn std::error::Error> at the same time. If there is a need of using Error as
std::error::Error, then Error::as_std_error may help.
#[cfg(test)]
mod test {
use kix::Result;
#[test]
fn file_must_be_empty() -> Result<()> {
let content = std::fs::read_to_string("/dev/nullx")?;
assert!(content.is_empty());
Ok(())
}
}
fn main() {}