Тёмный

Beginner's Guide to Rust Filesystem APIs 🦀 Rust Tutorial 

Trevor Sullivan
Подписаться 17 тыс.
Просмотров 14 тыс.
50% 1

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 Tutor...
📖 Rust std::fs docs ➡️ doc.rust-lang....
Visual Studio Code ➡️ code.visualstu...
Rust Website ➡️ rust-lang.org
Rustup Installer ➡️ rustup.rs
Rust Docs ➡️ doc.rust-lang....
Please follow me on these other social channels!
➡️ trevorsullivan...
➡️ github.com/pcg...
➡️ / pcgeek86
➡️ / trevorsullivan
➡️ / trevorsoftware
➡️ tiktok.com/pcg...
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

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@tomaszsosinski5935
@tomaszsosinski5935 11 месяцев назад
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.
@TrevorSullivan
@TrevorSullivan 11 месяцев назад
Hello Tomas, that's a good idea! Thank you for taking the time to write out your thoughts. I agree that reading raw bytes from a file can be daunting for someone who's new to programming. Cheers 🙂
@emnul8583
@emnul8583 Месяц назад
Your videos are so thorough I really enjoy that about your content!
@marlonsbardelatti202
@marlonsbardelatti202 Год назад
the quality of your content is really great, apreciate it bro
@JOHNSMITH-ve3rq
@JOHNSMITH-ve3rq Год назад
Loving this channel bro. The geek vibes are off the charts and it’s beautiful. And super educational!!
@Gruby7C1h
@Gruby7C1h 10 месяцев назад
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 :)
@jasperzanjani
@jasperzanjani 2 месяца назад
I was about to say you should have used an if let or even a match statement but I guess it's kind of clever avoiding that syntax for the sake of beginners
@TrevorSullivan
@TrevorSullivan 2 месяца назад
@@jasperzanjani yeah, match makes sense but I always get tripped up by if.. let, even after a year
@AhmedFalih-kj3tt
@AhmedFalih-kj3tt Год назад
very exciting video, I really appreciate your videos man, thank you alot
@kafuu1
@kafuu1 3 месяца назад
u are the hero
@RichardWalterLanda
@RichardWalterLanda 2 месяца назад
THANKS for your videos
@deverse
@deverse 11 месяцев назад
loving this channel
@world-9644
@world-9644 7 дней назад
Can someone help me? I made a simple rust program that reads a json file and prints the contents. Cargo run works totally fine, but when I run the executable, it says it cannot find the json file, even when it’s in the same directory. I want to be able to make a change to the file, run the executable, and see those changes, so I need the JSON to be separate from the bundled exe. How do I do this? Can’t find any answers online.
@le0nz
@le0nz 3 дня назад
Don't use relative paths, a easy way to debug is print the root of your dir so you see it's not the same as the root of the cargo project
@daniil2704
@daniil2704 10 месяцев назад
35:00 String::from_utf8(read_result.unwrap())
@nicolaswolyniec1354
@nicolaswolyniec1354 Год назад
thanks for the video! I enjoyed it!
@nhwhn
@nhwhn 6 месяцев назад
thank you for the great contents
@736939
@736939 5 месяцев назад
But how to read and write binary files like in python with pickle? For example, if İ want to save an object data.
@TrevorSullivan
@TrevorSullivan 5 месяцев назад
That's a great question! Great idea for another video
@736939
@736939 5 месяцев назад
@@TrevorSullivan Thank you, it would be the great tutorial :)
@piyushpatil6874
@piyushpatil6874 6 месяцев назад
Love from India ❤❤❤
@crissdell
@crissdell Месяц назад
Why does use ? At the end of the lines?
@TrevorSullivan
@TrevorSullivan Месяц назад
In cases where a Result is returned by a function call, the ? will unwrap the result or surface the Error up to the caller. This requires that the function has the Result type as a return value though. I'm sure the documentation covers this better than I can in a comment, so I'd read more about it there.
@TrevorSullivan
@TrevorSullivan Месяц назад
doc.rust-lang.org/rust-by-example/std/result/question_mark.html
@fedenfer
@fedenfer Год назад
Hello brother, greetings from Argentina, are you managing infrastructure with rust? Or do you prefer other languages, such as python or golang?
@TrevorSullivan
@TrevorSullivan Год назад
Hello! Thanks for your question. I am not currently using Rust to manage infrastructure, but I think it would be an excellent language to use for that purpose! If you are wanting to use something "off the shelf," then Salt, Ansible, and existing tooling might be your best bet though.
@maylay3775
@maylay3775 Год назад
perfect an hour on 0.75 playback speed
@aryabp
@aryabp Год назад
please integrate with actix and make google drive clone
@ChidleyITCompute
@ChidleyITCompute 6 месяцев назад
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.
@TrevorSullivan
@TrevorSullivan 6 месяцев назад
Thanks so much for your kind comment! 😊❤️🦀
@NSA.
@NSA. 21 день назад
Thank you mann
@ibrahimyıldız-i3q
@ibrahimyıldız-i3q 3 месяца назад
great!
@pratikkulkarni891
@pratikkulkarni891 10 месяцев назад
Thank you.