1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2023 Nick Piaddo
// SPDX-License-Identifier: Apache-2.0 OR MIT
// From dependency library
use thiserror::Error;
// From standard library
// From this library
/// [`Fdisk`](crate::fdisk::Fdisk) runtime errors.
#[derive(Debug, Error, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
pub enum FdiskError {
/// Error while assigning a device to a [`Fdisk`](crate::fdisk::Fdisk) instance.
#[error("{0}")]
AssignDevice(String),
/// Error while closing the device assigned to a [`Fdisk`](crate::fdisk::Fdisk) instance.
#[error("{0}")]
CloseDevice(String),
/// Error while configuring a [`Fdisk`](crate::fdisk::Fdisk).
#[error("{0}")]
Config(String),
/// Error while performing a conversion.
#[error("{0}")]
Conversion(String),
/// Error while creating a new [`Fdisk`](crate::fdisk::Fdisk) instance.
#[error("{0}")]
Creation(String),
/// Error when prompts are disabled.
#[error("{0}")]
DialogsDisabled(String),
/// Error while converting a value to [`CString`](std::ffi::CString).
#[error("{0}")]
CStringConversion(String),
/// Error while aligning data to block sector boundaries on disk.
#[error("{0}")]
DataAlignment(String),
/// Input/Output runtime errors.
#[error("{0}")]
IoError(String),
/// Error while printing log messages.
#[error("{0}")]
Log(String),
/// Error when there is no more assignable partition number.
#[error("{0}")]
NoNextPartitionNumber(String),
/// Error when trying to allocate memory.
#[error("{0}")]
OutOfMemory(String),
/// Error while overriding `Fdisk` attributes in memory.
#[error("{0}")]
Override(String),
/// Error while reading the answer to a prompt.
#[error("{0}")]
Prompt(String),
/// Error while restoring `Fdisk` attributes from their saved values on disk.
#[error("{0}")]
Restore(String),
/// Error if returned value is out of range.
#[error("{0}")]
ResultOutOfRange(String),
/// Error while saving `Fdisk` attributes.
#[error("{0}")]
Save(String),
/// [`Script`](crate::core::script::Script) runtime error.
#[error("{0}")]
Script(String),
#[error("{0}")]
Unexpected(String),
}