To move a CSV file in Rust, you need to:
main.rs47 chars4 lines
Path::new()
to create a Path object that can be used with fs::rename()
)main.rs111 chars3 lines
fs::rename()
function, wrapped in a match
statement to handle any errors:main.rs319 chars9 lines
The fs::rename()
function returns a Result<(), io::Error>
object, where ()
indicates an empty tuple (no data is returned on success). If an error occurs, it returns an io::Error
object, which contains a kind()
method that can be used to determine the type of error.
Here's the full code snippet:
main.rs533 chars18 lines
gistlibby LogSnag