Skip to content

Replace FromValue/IntoValue with TryFrom/Into

Marc-André Lureau requested to merge elmarco/zbus:try_from into master

FromValue is a custom zvariant trait that isn't really convenient for Rust users. It does what TryFrom is supposed to do, plus it downcasts~~~~unwraps. Instead, implement the idiomatic TryFrom for the various Value kind, and use Value::downcast_ref() when an explicit unwrap is expected. Similarly, for IntoValue, implement From for the various types, and add a Value::new() method for the case where you expect Value->Value(Value)

Edited by Marc-André Lureau

Merge request reports

Loading