Skip to content

Improved ergonomics of API accepting ObjectPath as a generic type

Zeeshan Ali Khan requested to merge zeenix/tryinto into main

Currently the generic type for anything that can be converted into an ObjectPath would be impl TryInto<ObjectPath, Error=zvariant::Error>, which has two issues:

  1. It (ironically) won't work for ObjectPath itself because TryInto<T> for T is not possible as that contradicts the blanket impl Into<T> for T.
  2. Having to explicitly specify the error is super annoying.

So we introduce a new trait, IntoObjectPath (and IntoOwnedObjectPath) that has a specific error type and we implement it for ObjectPath itself as well.

Fixes #139 (closed).


This branch is based on !261 (merged).

Merge request reports

Loading