Convert a Vec<String> into an IIterable<HSTRING> using Rust and windows-rs

115 Views Asked by At

I am using Rust and the windows-rs crate to access the Windows API from Rust.

As input, I have an Vec<String> which I want to convert into an IIterable<HSTRING>. According to this ticket, it should be possible to use the try_from trait.

Here is what I've tried:

let hStringVector: Vec<HSTRING> = stringVector.iter().map(|c| HSTRING::from(c)).collect()?; 
let storeidsWin = IIterable::<HSTRING>::try_from(storeIdsWinRaw);

But this gives me the following error:

error[E0277]: the trait bound `IIterable<HSTRING>: From<Vec<HSTRING>>` is not satisfied
   --> src\lib.rs:104:58
    |
104 |         let storeidsWin = IIterable::<HSTRING>::try_from(hStringVector);
    |                           ------------------------------ ^^^^^^^^^^^^^ the trait `From<Vec<HSTRING>>` is not implemented for `IIterable<HSTRING>`
    |                           |
    |                           required by a bound introduced by this call
    |
    = note: required for `Vec<HSTRING>` to implement `Into<IIterable<HSTRING>>`
    = note: required for `IIterable<HSTRING>` to implement `TryFrom<Vec<HSTRING>>`

Unfortunately I am new to Rust and don't know what this error wants to tell me (and how to fix it).

0

There are 0 best solutions below