With this code:
.child(EditView::new().set_secret(true).with_name("wlan0-ap0_passwd").fixed_width(16))
I get the error:
error[E0599]: the method `with_name` exists for unit type `()`, but its trait bounds were not satisfied
--> src/main.rs:24:61
|
24 | .child(EditView::new().set_secret(true).with_name("wlan0-ap0_passwd").fixed_width(16))
| ^^^^^^^^^
|
note: method `set_secret` modifies its receiver in-place
--> src/main.rs:24:44
|
24 | .child(EditView::new().set_secret(true).with_name("wlan0-ap0_passwd").fixed_width(16))
| ^^^^^^^^^^ this call modifies its receiver in-place
= note: the following trait bounds were not satisfied:
`(): cursive::View`
which is required by `(): Nameable`
`&(): cursive::View`
which is required by `&(): Nameable`
`&mut (): cursive::View`
which is required by `&mut (): Nameable`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `ssid-tui` (bin "ssid-tui") due to 1 previous error
The error is telling me that .set_secret() is a mutable operation on the EditView and so it must end the chain. i.e. It doesn't return a View.
I expect that I can add a few lines to create the EditView, assign it to a variable, call .set_secret('true') on that variable, and then move that variable into the .child() call.
As I have several "secret" EditViews this seems rather long-winded.
Is there an in-line solution to creating "secret" "named" EditViews?