You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let vector:Collections::IVector<IStringable> = ...;let uri = Uri::CreateUri(h!("https://github.com"))?;
vector.Append(&uri)?;
------ ^^^ the trait `CanInto<IStringable>` is not implemented for `Uri`
|
required by a bound introduced by this call
= note: required for `&windows::Foundation::Uri` to implement `IntoParam<windows::Foundation::IStringable,ReferenceType>`
Instead, one has to manually cast the Uri to a IStringable. This should not be necessary, because it is guaranteed that Uri implements IStringable.
I understand that Uri implements CanTryInto<IStringable>, which makes it compatible with TryIntoParam<IStringable> arguments, but TryIntoParam arguments only seem to be used for a few methods.
The same problem also exists for WinRT interfaces which require another interface.
Suggestion
I'm not sure if I'm missing something, but I would suggest getting rid of the distinction between CanInto/IntoParam and CanTryInto/TryIntoParam, replacing the latter with the former.
This would require changes to CanInto to support conversions using QueryInterface, but that should not be a problem, as the conversions are guaranteed to succeed.
I would be happy to hear any opinion on this; whether the proposal makes sense or if there are reasons for not doing this and keeping the current solution.
The text was updated successfully, but these errors were encountered:
Suggestion
Use case
Currently, the following code does not compile:
Instead, one has to manually cast the
Uri
to aIStringable
. This should not be necessary, because it is guaranteed thatUri
implementsIStringable
.I understand that
Uri
implementsCanTryInto<IStringable>
, which makes it compatible withTryIntoParam<IStringable>
arguments, butTryIntoParam
arguments only seem to be used for a few methods.The same problem also exists for WinRT interfaces which require another interface.
Suggestion
I'm not sure if I'm missing something, but I would suggest getting rid of the distinction between
CanInto
/IntoParam
andCanTryInto
/TryIntoParam
, replacing the latter with the former.This would require changes to
CanInto
to support conversions usingQueryInterface
, but that should not be a problem, as the conversions are guaranteed to succeed.I would be happy to hear any opinion on this; whether the proposal makes sense or if there are reasons for not doing this and keeping the current solution.
The text was updated successfully, but these errors were encountered: