]> git.ipfire.org Git - thirdparty/qemu.git/commit
rust/util: use anyhow's native chaining capabilities
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 10 Oct 2025 16:17:59 +0000 (18:17 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 4 Nov 2025 16:13:11 +0000 (17:13 +0100)
commit0830ec94059b239b3f67527b58e52fa7cd4a5439
tree91bec6cd6cef7bf4bb46fb332ab27b071aa46e37
parent56dbf087a8a2cec7e3aeb19defed2a19efc85faa
rust/util: use anyhow's native chaining capabilities

This simplifies conversions, making it possible to convert any error
into a QEMU util::Error with ".into()" (and therefore with "?").

The cost is having a separate constructor for when the error is a simple
string, but that is made easier by the ensure! macro.  If necessary,
another macro similar to "anyhow!" can be returned, but for now there
is no need for that.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/util/src/error.rs