pub struct Entry { /* private fields */ }
Expand description
Represents a single entry within a directory.
A directory entry contains metadata about a file system object including its inode number, name, type, and size. This structure is used when reading directory contents to provide information about each item within the directory.
§Examples
use file_system::*;
use alloc::string::String;
// Create a directory entry for a regular file
let file_entry = Entry_type::new(
Inode_type::new(42),
String::from("document.txt"),
Type_type::File,
Size::new(1024)
);
assert_eq!(file_entry.get_name(), "document.txt");
assert_eq!(file_entry.get_type(), Type_type::File);
assert_eq!(file_entry.get_size().As_u64(), 1024);
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn new(inode: Inode, name: String, type: Kind, size: Size) -> Self
pub fn new(inode: Inode, name: String, type: Kind, size: Size) -> Self
Create a new directory entry with the specified metadata.
§Arguments
Inode
- Unique inode number for this file system objectName
- Name of the file or directoryType
- Type of the file system objectSize
- Size in bytes (for files) or entry count (for directories)
§Examples
use file_system::*;
use alloc::string::String;
let entry = Entry_type::new(
Inode_type::new(123),
String::from("example.txt"),
Type_type::File,
Size::new(2048)
);
Sourcepub fn get_inode(&self) -> Inode
pub fn get_inode(&self) -> Inode
Get the inode number of this directory entry.
§Returns
The unique inode number identifying this file system object.
Sourcepub fn get_name(&self) -> &String
pub fn get_name(&self) -> &String
Get the name of this directory entry.
§Returns
A reference to the string containing the file or directory name.
Sourcepub fn get_type(&self) -> Kind
pub fn get_type(&self) -> Kind
Get the type of this directory entry.
§Returns
The type of file system object (file, directory, symbolic link, etc.).
Sourcepub fn get_size(&self) -> Size
pub fn get_size(&self) -> Size
Get the size of this directory entry.
§Returns
For files, this is the size in bytes. For directories, this may represent the number of entries or be implementation-defined.