#[non_exhaustive]pub enum PkgError {
Show 16 variants
ManifestParse {
source: Error,
},
LockfileParse {
source: Error,
},
LockfileWrite {
source: Error,
},
MissingLockfile {
path: PathBuf,
},
SameNameConflict {
name: String,
},
DepConflict {
name: String,
first: String,
second: String,
},
Io {
source: Error,
},
Validation {
message: String,
},
GitFetch {
source: Error,
},
TagShaMismatch {
expected: String,
actual: String,
},
PatchDrift {
name: String,
patch_dir: PathBuf,
reason: String,
pinned: String,
},
EntryNotFound {
name: String,
attempted: Vec<PathBuf>,
},
UnknownDep {
name: String,
manifest: PathBuf,
},
Fetch {
name: String,
requested_by: String,
source: Box<PkgError>,
},
ManifestEdit {
message: String,
},
ManifestSerialize {
source: Error,
},
}Expand description
Crate-wide error for PkgMgr operations.
§Error taxonomy
| Variant | Phase | Source |
|---|---|---|
ManifestParse | Parse | toml::de::Error via #[from] |
LockfileParse | Parse | toml::de::Error via map_err |
LockfileWrite | Serialize | toml::ser::Error via #[from] |
MissingLockfile | I/O | path not found |
SameNameConflict | Validate | duplicate name in lockfile |
Io | I/O | std::io::Error via #[from] |
Validation | Post-parse | custom message |
GitFetch | Fetch | git2::Error via #[from] |
TagShaMismatch | Fetch | tag ↔ SHA conflict |
DepConflict | Resolve | one name, two different Dep specs |
EntryNotFound | Install | no src/ / lua/ / . under the cache dir |
UnknownDep | Validate | ops::update name not in [deps] |
Fetch | Fetch | per-dep wrapper around another variant |
ManifestEdit | Edit | toml_edit re-parse / structural edit |
ManifestSerialize | Serialize | toml::ser::Error via map_err |
Variants are #[non_exhaustive] so that future subtasks can add new
variants without breaking downstream match arms that include a wildcard.
The existing crate::ResolveError is intentionally not modified.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ManifestParse
TOML parse failure when reading mlua-pkg.toml.
Automatically constructed from toml::de::Error via ?.
LockfileParse
TOML parse failure when reading mlua-pkg.lock.
Does not carry #[from] — ManifestParse
already claims From<toml::de::Error>. Lockfile read paths must use
.map_err(|e| PkgError::LockfileParse { source: e }) explicitly.
LockfileWrite
TOML serialization failure when writing mlua-pkg.lock.
Automatically constructed from toml::ser::Error via ?.
MissingLockfile
mlua-pkg.lock not found at the expected path.
Raised by Lockfile::read when the
file is absent, to distinguish the “not yet installed” case from other
I/O failures.
SameNameConflict
Two packages share the same name field within a lockfile.
Package names must be unique within a lockfile. Raised during
Lockfile::read and at install time.
DepConflict
The same package name is requested with two different Dep specs
(git URL / pin / entry / target_dir) during transitive resolution.
first / second name who asked: <manifest> for a direct dep, else the
package whose mlua-pkg.toml declared it. There is no version
unification; make both sides agree on one spec.
Io
I/O error while reading or writing files (manifest, lockfile, cache).
Automatically constructed from std::io::Error via ?.
Validation
Post-parse validation failure.
Raised when the parsed manifest satisfies TOML grammar but violates
semantic constraints, e.g. specifying both tag and rev in a
single dependency entry.
GitFetch
git2 operation failure during fetch or clone.
Automatically constructed from git2::Error via ?.
TagShaMismatch
The resolved SHA for a tag did not match the expected SHA.
Raised when the caller pins a specific SHA together with a tag and the tag resolves to a different commit.
PatchDrift
A dep with patch_drift = "error" whose patch_dir cannot be used.
Raised by install instead of the warning-and-fall-back that
patch_drift = "warn" (the default) applies. reason says why the
patch was rejected (pin moved / directory missing / no recorded
base); pinned is the commit the pin currently resolves to.
EntryNotFound
No suitable entry point directory found within a cached package.
Raised by mlua_pkg::resolve_entry when neither
the override path nor any fallback candidate (src/, lua/, .) exists
as a directory under cache_path.
Also raised during VendoredResolver::from_lockfile
construction when a package in the lockfile has no resolvable entry.
UnknownDep
A dependency name was given that is not present in [deps].
Raised by ops::update when the caller
restricts the update to a single package that the manifest does not
declare.
Fetch
Fetch of one named dependency failed.
Wraps the underlying error so callers of ops::install
can tell which package broke without parsing messages.
requested_by is <manifest> for a direct dep, else the package
whose mlua-pkg.toml declared it.
ManifestEdit
Format-preserving manifest edit failed.
update rewrites mlua-pkg.toml through toml_edit so comments and
key order survive; this variant covers both the re-parse and the
structural edit (e.g. [deps] table missing).
ManifestSerialize
TOML serialization failure when writing mlua-pkg.toml.
Does not carry #[from] — LockfileWrite
already claims From<toml::ser::Error>.
Trait Implementations§
Source§impl Error for PkgError
impl Error for PkgError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for PkgError
impl !UnwindSafe for PkgError
impl Freeze for PkgError
impl Send for PkgError
impl Sync for PkgError
impl Unpin for PkgError
impl UnsafeUnpin for PkgError
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
Source§impl<E> ExternalError for E
impl<E> ExternalError for E
fn into_lua_err(self) -> Error
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> ⓘ
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> ⓘ
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