Skip to main content

Error

Enum Error 

Source
#[repr(C)]
pub enum Error {
Show 43 variants FailedToInitializeFileSystem = 1, PermissionDenied = 2, NotFound = 3, AlreadyExists = 4, DirectoryAlreadyExists = 5, FileSystemFull = 6, FileSystemError = 7, InvalidPath = 8, InvalidFile = 9, InvalidDirectory = 10, InvalidSymbolicLink = 11, Unknown = 12, InvalidIdentifier = 13, FailedToGetTaskInformations = 14, FailedToGetUsersInformations = 15, TooManyMountedFileSystems = 16, TooManyOpenFiles = 17, InternalError = 18, InvalidMode = 19, UnsupportedOperation = 20, RessourceBusy = 21, AlreadyInitialized = 22, NotInitialized = 23, FailedToGetUsersManagerInstance = 24, FailedToGetTaskManagerInstance = 25, InvalidParameter = 26, InvalidFlags = 27, NotDirectory = 28, IsDirectory = 29, InputOutput = 30, DirectoryNotEmpty = 31, FileTooLarge = 32, NoAttribute = 33, NameTooLong = 34, Corrupted = 35, NoMemory = 36, NoSpaceLeft = 37, TimeError = 38, InvalidInode = 39, NotMounted = 40, AlreadyMounted = 41, InvalidContext = 42, Other = 43,
}
Expand description

Comprehensive enumeration of all possible file system errors.

This enum covers errors that can occur at various levels of the file system stack, from low-level device operations to high-level file system operations. Each variant has a unique numeric discriminant for FFI compatibility.

Variants§

§

FailedToInitializeFileSystem = 1

Failed to initialize the file system.

§

PermissionDenied = 2

Permission denied for the requested operation.

§

NotFound = 3

File, directory, or resource not found.

§

AlreadyExists = 4

File or directory already exists.

§

DirectoryAlreadyExists = 5

Directory already exists (more specific than Already_exists).

§

FileSystemFull = 6

File system is full and cannot store more data.

§

FileSystemError = 7

Generic file system error.

§

InvalidPath = 8

The provided path is invalid or malformed.

§

InvalidFile = 9

The file is corrupted or invalid.

§

InvalidDirectory = 10

The directory is corrupted or invalid.

The symbolic link is invalid or broken.

§

Unknown = 12

Unknown or unspecified error.

§

InvalidIdentifier = 13

File or task identifier is invalid.

§

FailedToGetTaskInformations = 14

Failed to retrieve task information from task manager.

§

FailedToGetUsersInformations = 15

Failed to retrieve user information from user manager.

§

TooManyMountedFileSystems = 16

Maximum number of mounted file systems exceeded.

§

TooManyOpenFiles = 17

Maximum number of open files exceeded.

§

InternalError = 18

Internal implementation error.

§

InvalidMode = 19

Invalid access mode specified.

§

UnsupportedOperation = 20

Operation is not supported by the device or file system.

§

RessourceBusy = 21

Resource is temporarily busy or unavailable.

§

AlreadyInitialized = 22

System or component is already initialized.

§

NotInitialized = 23

System or component is not initialized.

§

FailedToGetUsersManagerInstance = 24

Failed to get users manager instance.

§

FailedToGetTaskManagerInstance = 25

Failed to get task manager instance.

§

InvalidParameter = 26

Invalid parameter provided to function.

§

InvalidFlags = 27

Invalid flags specified for operation.

§

NotDirectory = 28

Expected a directory but found a file.

§

IsDirectory = 29

Expected a file but found a directory.

§

InputOutput = 30

Input/output error during operation.

§

DirectoryNotEmpty = 31

Directory is not empty and cannot be removed.

§

FileTooLarge = 32

File size exceeds maximum allowed size.

§

NoAttribute = 33

Requested attribute does not exist.

§

NameTooLong = 34

File or directory name is too long.

§

Corrupted = 35

Data corruption detected.

§

NoMemory = 36

Insufficient memory for operation.

§

NoSpaceLeft = 37

No space left on device.

§

TimeError = 38

Error in timestamp or time-related operation.

§

InvalidInode = 39

Invalid inode reference.

§

NotMounted = 40

Not mounted.

§

AlreadyMounted = 41

Already mounted.

§

InvalidContext = 42

Invalid context

§

Other = 43

Other unclassified error.

Implementations§

Source§

impl Error

Source

pub fn get_discriminant(&self) -> NonZeroU32

Get the numeric discriminant of the error as a non-zero u32.

This is useful for FFI operations where errors need to be represented as numeric codes.

§Returns

A NonZeroU32 containing the error’s discriminant value.

§Examples
use file_system::Error;

let error = Error::PermissionDenied;
let code = error.get_discriminant();
assert_eq!(code.get(), 2); // Permission_denied has discriminant 2

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Error

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Display implementation for user-friendly error messages.

Provides human-readable descriptions of all error variants.

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl Error for Error

Source§

fn kind(&self) -> ErrorKind

Get the kind of this error.
Source§

impl From<Error> for Error

Convert Task module errors to file system errors.

This allows transparent handling of task-related errors in file system operations.

Source§

fn from(_: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Convert Users module errors to file system errors.

This allows transparent handling of user-related errors in file system operations.

Source§

fn from(_: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for NonZeroU32

Convert file system errors to numeric discriminants.

This conversion is useful for FFI where errors need to be represented as numbers.

Source§

fn from(error: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Error) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.