What is the best way to create yes or no (y/n) user dialog window?

What is the most aesthetic way to create a user yes or no (y/n) user dialog and then store the answer in a boolean type variable? I know that we can do it with std::io::stdin.read_line, but is there a better way to do that?

Maybe see if dialoguer - Rust does what you want.

1 Like

Yeah! But can I do that without using a additional library?

The Rust standard library does not provide user interface elements, so no.

3 Likes

So sad :frowning: thanks for your time!

Not sure what languages you are familiar with, but in Rust it is pretty normal to use third-party modules. The standard library is intentionally relatively small.

4 Likes

No mainstream language provides GUI in its standard library except Java, which had to change design at least three times (AWK, JavaFX, Swing) and it's still horrible.

GUI does not belong in the standard library.

1 Like

No mainstream language provides GUI in its standard library except Java

Well, python has tkinter and it is fitting for quick and dirty dialog windows. It would be a bad fit for a language like Rust as many have pointed out.

Tkinter is an interface to the Tk library. Python has support for SQLite3, too, but that doesn't make SQLite part of Python.

1 Like

Shure it does. It does not matter to most users at all how the functionality is achieved. What matters is that it is part of the standard library. Rust's standard library links to libc on most platforms for OS interaction.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.