Beginner's Guide to Rust Filesystem APIs 🦀 Rust Tutorial

11,191
0
Published 2023-09-06
One of the most common operations you'll need, as a Rust developer, is the ability to read and write to the local filesystem. The standard library in Rust provides the essential functions to create / remove / rename directories, create / read / write / delete files, create symlinks, validate filesystem paths, and more. Let's dive into some of the core filesystem functionality provided by Rust!

🤯 Rust Programming Playlist 🦀    • Rust Programming Tutorial 🦀  

📖 Rust std::fs docs ➡️ doc.rust-lang.org/std/fs/index.html

Visual Studio Code ➡️ code.visualstudio.com/
Rust Website ➡️ rust-lang.org/
Rustup Installer ➡️ rustup.rs/
Rust Docs ➡️ doc.rust-lang.org/book

Please follow me on these other social channels!

➡️ trevorsullivan.net/
➡️ github.com/pcgeek86
➡️ twitter.com/pcgeek86
➡️ youtube.com/trevorsullivan
➡️ facebook.com/trevorsoftware
➡️ tiktok.com/pcgeek86

All trademarks, logos and brand names are the property of their respective owners. All company, product and service names used in this website are for identification purposes only. Use of these names,trademarks and brands does not imply endorsement.

#rustlang #rust #rustdev #opensource #software #linux #devops #programming #rusty #dev #coding #codinglife #code #coder #ubuntu #ubuntulinux #appdev #developer

All Comments (20)
  • Hi Trevor, thank you for creating this content. I would like to make one comment about the video. I believe reading raw bytes from file and converting them to chars and string via fold on iterator might be a bit daunting to some viewers. I see the value in it as it shows low level mechanism, however, I would add another minute or two to video to show `std::fs::read_to_string` function that does conversion of bytes to String behind the scenes. I also think that the video on `std::fs::File` should contain examples on using `std::io::BufReader` to read contents of file to a Vec.
  • @AhmedFalih-kj3tt
    very exciting video, I really appreciate your videos man, thank you alot
  • @Gruby7C1h
    Small correction for part around 24:07 -> the std::fs::write does return useful info (try to create a file in unexisting directory for example). You only see unit as a result because here the result is actually std::io::Result which always has std::io::Error as Err value. Nice channel btw :)
  • @JOHNSMITH-ve3rq
    Loving this channel bro. The geek vibes are off the charts and it’s beautiful. And super educational!!
  • @aintnochange
    I'm so surprised how useful and consistent Rust's std crate is. Thanks for the video!
  • @nhwhn
    thank you for the great contents
  • @fedenfer
    Hello brother, greetings from Argentina, are you managing infrastructure with rust? Or do you prefer other languages, such as python or golang?
  • @maylay3775
    perfect an hour on 0.75 playback speed
  • @736939
    But how to read and write binary files like in python with pickle? For example, if İ want to save an object data.
  • @aryabp
    please integrate with actix and make google drive clone
  • This is very helpful. Thankfully rust handles utf8. I learned a lot from this (and your other) video: that's my goal and you're delivering it.