'How to open and close a device in Rust such as "/dev/something"?

In C I can use the function open to open a file or anything else such as /dev/something. And there's close as well. How can I open and close /dev/something in Rust?

In fact, I also need to write to and read from it. How can I do that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source