pub struct FileAttributes { /* private fields */ }Implementations§
Source§impl FileAttributes
impl FileAttributes
Sourcepub fn builder() -> FileAttributesBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> FileAttributesBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building FileAttributes.
On the builder, call .mode(...), .size(...)(optional), .nlink(...)(optional), .uid(...)(optional), .gid(...)(optional), .rdev(...)(optional), .blksize(...)(optional), .blocks(...)(optional), .atime(...)(optional), .mtime(...)(optional), .ctime(...)(optional), .ttl(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of FileAttributes.
Source§impl FileAttributes
impl FileAttributes
pub fn mode(&self) -> u32
pub fn nlink(&self) -> u32
pub fn uid(&self) -> u32
pub fn gid(&self) -> u32
pub fn rdev(&self) -> u32
pub fn blksize(&self) -> u32
pub fn blocks(&self) -> u64
pub fn atime(&self) -> Duration
pub fn mtime(&self) -> Duration
pub fn ctime(&self) -> Duration
Sourcepub fn ttl(&self) -> Duration
pub fn ttl(&self) -> Duration
§Note
ttl means time to live
This is not time to live, such as you’d go live on Twitch. It means time to live,
as in the remaining time you have left alive. I spent way too long misunderstanding
that.
pub fn set_mode(&mut self, mode: u32)
Sourcepub fn set_size(&mut self, size: u64)
pub fn set_size(&mut self, size: u64)
Examples found in repository?
examples/memfs.rs (line 178)
165 fn write<T: BufRead>(&mut self, ino: INode, offset: u64, size: u32, mut buf: T) -> Result<u32> {
166 let file = self.inodes.get_mut(ino).ok_or(FSError::NoEntry)?;
167 let file = file.as_file_mut().ok_or(FSError::NotFile)?;
168
169 let offset = offset as usize;
170 let size = size as usize;
171
172 file.data
173 .resize(std::cmp::max(file.size(), offset + size), 0);
174
175 buf.read_exact(&mut file.data[offset..offset + size])
176 .unwrap();
177
178 file.attrs.set_size((offset + size) as u64);
179
180 Ok(size as u32)
181 }pub fn set_nlink(&mut self, nlink: u32)
pub fn set_uid(&mut self, uid: u32)
pub fn set_gid(&mut self, gid: u32)
pub fn set_rdev(&mut self, rdev: u32)
pub fn set_blksize(&mut self, blksize: u32)
pub fn set_blocks(&mut self, blocks: u64)
pub fn set_atime(&mut self, atime: Duration)
pub fn set_mtime(&mut self, mtime: Duration)
pub fn set_ctime(&mut self, ctime: Duration)
pub fn set_ttl(&mut self, ttl: Duration)
Sourcepub fn apply_attrs(&mut self, attrs: SetFileAttributes)
pub fn apply_attrs(&mut self, attrs: SetFileAttributes)
Trait Implementations§
Source§impl Clone for FileAttributes
impl Clone for FileAttributes
Source§fn clone(&self) -> FileAttributes
fn clone(&self) -> FileAttributes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileAttributes
impl Debug for FileAttributes
impl Copy for FileAttributes
Auto Trait Implementations§
impl Freeze for FileAttributes
impl RefUnwindSafe for FileAttributes
impl Send for FileAttributes
impl Sync for FileAttributes
impl Unpin for FileAttributes
impl UnsafeUnpin for FileAttributes
impl UnwindSafe for FileAttributes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more