#rust
Read more stories on Hashnode
Articles with this tag
When reading rust codes, you sometimes see File::open or f.read(). Why are some functions accessed with ::, and others with .? By taking a look at the...
閱讀 rust 程式的時候偶爾會看到 File::open() 或是 f.read()。但為什麼有些功能是用 :: 呼叫,有些是用 . ? 翻開 std::fs::File 的原始碼,可以看到這些功能都是定義在 impl File 或是 impl SomeTrait for File 內: //...
In Python, you can make use of the Path class from pathlib module: from pathlib import Path p = Path("/home/eric") for item in p.iterdir(): ...