FileAttributes

Struct FileAttributes 

Source
pub struct FileAttributes {
    pub size: Option<u64>,
    pub uid: Option<u32>,
    pub user: Option<String>,
    pub gid: Option<u32>,
    pub group: Option<String>,
    pub permissions: Option<u32>,
    pub atime: Option<u32>,
    pub mtime: Option<u32>,
}
Expand description

Used in the implementation of other packets. Implements most Metadata methods

The fields user and group are string names of users and groups for clients that can be displayed in longname. Can be omitted.

The flags field is omitted because it is set by itself depending on the fields

Fields§

§size: Option<u64>§uid: Option<u32>§user: Option<String>§gid: Option<u32>§group: Option<String>§permissions: Option<u32>§atime: Option<u32>§mtime: Option<u32>

Implementations§

Source§

impl FileAttributes

Source

pub fn is_dir(&self) -> bool

Returns true if is a dir

Source

pub fn set_dir(&mut self, is_dir: bool)

Set flag if is a dir or not

Source

pub fn is_regular(&self) -> bool

Returns true if is a regular

Source

pub fn set_regular(&mut self, is_regular: bool)

Set flag if is a regular or not

Returns true if is a symlink

Set flag if is a symlink or not

Source

pub fn is_character(&self) -> bool

Returns true if is a character

Source

pub fn set_character(&mut self, is_character: bool)

Set flag if is a character or not

Source

pub fn is_block(&self) -> bool

Returns true if is a block

Source

pub fn set_block(&mut self, is_block: bool)

Set flag if is a block or not

Source

pub fn is_fifo(&self) -> bool

Returns true if is a fifo

Source

pub fn set_fifo(&mut self, is_fifo: bool)

Set flag if is a fifo or not

Source

pub fn set_type(&mut self, mode: FileMode)

Set mode flag

Source

pub fn remove_type(&mut self, mode: FileMode)

Remove mode flag

Source

pub fn file_type(&self) -> FileType

Returns the file type

Source

pub fn is_empty(&self) -> bool

Returns true if is empty

Source

pub fn len(&self) -> u64

Returns the size of the file

Source

pub fn permissions(&self) -> FilePermissions

Returns the permissions of the file this metadata is for.

Source

pub fn accessed(&self) -> Result<SystemTime>

Returns the last access time

Source

pub fn modified(&self) -> Result<SystemTime>

Returns the last modification time

Source

pub fn empty() -> Self

Creates a structure with omitted attributes

Trait Implementations§

Source§

impl Clone for FileAttributes

Source§

fn clone(&self) -> FileAttributes

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileAttributes

For packets which require dummy attributes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FileAttributes

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Metadata> for FileAttributes

For simple conversion of Metadata into FileAttributes

Source§

fn from(metadata: &Metadata) -> Self

Converts to this type from the input type.
Source§

impl Serialize for FileAttributes

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,