rust, rust-fs, windows Peter Girnus rust, rust-fs, windows Peter Girnus

Rust Metadata Extensions (std::os::windows::fs::MetadataExt) Trait for the Windows OS

The Rust std::os::windows::fs::MetadataExt trait provides operating system extensions for the Microsoft Windows platform. These Metadata extensions for Windows allow programmers to view metadata such as its permissions, size, modification times, and other information about a file. The MetadataExt trait is a part of the Windows-specific extensions to primitives in the std::fs module. Data exposed by this trait include those of the Windows BY_HANDLE_FILE_INFORMATION structure.

Read More
rust, rust-fs, linux Peter Girnus rust, rust-fs, linux Peter Girnus

Rust Metadata Extensions (std::os::linux::fs::MetadataExt) Trait for the Linux OS

In Rust the std::os::linux::fs::MetadataExt trait provides os-specific extensions for the Linux platform. These extensions allow programmers to view metadata about a file such as its permissions, size, modification times, and other information about a file. The MetadataExt trait is a part of the Linux-specific extensions to primitives in the std::fs module.

Read More
rust, rust-fs Peter Girnus rust, rust-fs Peter Girnus

Rust Standard Library (std::fs): Getting File Metadata With Code Examples

In Rust, the standard library (std::fs) provides the Metadata structure, which gives programmers Metadata about a file, such as its permissions, size, times, file type, block information, etc. In addition, the Metadata structure contains a plethora of implementations for platform-specific behavior and fields that include functions for Linux, Unix, MacOS, and Windows. In this blog post, I will highlight Rust examples of the various functions and implementations provided by the Rust standard library.

Read More
rust, rust-fs Peter Girnus rust, rust-fs Peter Girnus

Rust std::fs Programming - Filetype Struct, Learning Through Rust Code

The Rust FileType struct is a structure within the Rust standard library (std::fs) and is part of the filesystem manipulation operations (fs) module. The FileType structure represents a type of file and provides accessors for each file type. This is accomplished through the return of the Metadata::file_type method. In this post, we will explore the FileType struct with examples using Rust code, providing valuable examples based on the Rust lang documentation.

Read More
rust, rust-fs Peter Girnus rust, rust-fs Peter Girnus

Rust std::fs: Creating, Writing, & Reading Files In Rust

Today, I want to explore the Rust std::fs library and its file creation, writing, and reading functions. This post can be helpful to Rust newcomers or those seeking a refresher on this topic. In this guide, we will explore the impressive capabilities of the File object, including how to create files in Rust using this object and how to read them using various techniques.

Read More
rust, rust-fs Peter Girnus rust, rust-fs Peter Girnus

Rust std::fs: Parsing Directories & File Entries with DirEntry

The Rust programming language provides a robust and efficient way to interact with the file system, making it a popular choice for systems programming and file manipulation tasks. In this mini how-to guide, we will explore the powerful capabilities of the DirEntry struct, which is part of the Rust standard library's std::fs module. DirEntry enables developers to navigate and extract valuable information from directory entries effortlessly, making it an essential tool for file-related operations.

Read More
rust, rust-fs Peter Girnus rust, rust-fs Peter Girnus

Rust std::fs: Creating Directories with DirBuilder

This lightning how-to focuses on creating directories in Rust using the the DirBuilder impl which is is part of the Rust standard library (source code).

The DirBuilder impl is part of the the DirBuilder Struct contained in the std::fs module (filesystem manipulation operations) which allows us to use Rust to manipulate the filesystem.

This lightning how-to will first define a simple problem and then work out the solution. Let’s define our problem first.

Read More