Skip to main content

PkgError

Enum PkgError 

Source
#[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

VariantPhaseSource
ManifestParseParsetoml::de::Error via #[from]
LockfileParseParsetoml::de::Error via map_err
LockfileWriteSerializetoml::ser::Error via #[from]
MissingLockfileI/Opath not found
SameNameConflictValidateduplicate name in lockfile
IoI/Ostd::io::Error via #[from]
ValidationPost-parsecustom message
GitFetchFetchgit2::Error via #[from]
TagShaMismatchFetchtag ↔ SHA conflict
DepConflictResolveone name, two different Dep specs
EntryNotFoundInstallno src/ / lua/ / . under the cache dir
UnknownDepValidateops::update name not in [deps]
FetchFetchper-dep wrapper around another variant
ManifestEditEdittoml_edit re-parse / structural edit
ManifestSerializeSerializetoml::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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ManifestParse

TOML parse failure when reading mlua-pkg.toml.

Automatically constructed from toml::de::Error via ?.

Fields

§source: Error
§

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.

Fields

§source: Error
§

LockfileWrite

TOML serialization failure when writing mlua-pkg.lock.

Automatically constructed from toml::ser::Error via ?.

Fields

§source: Error
§

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.

Fields

§path: PathBuf
§

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.

Fields

§name: String
§

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.

Fields

§name: String
§first: String
§second: String
§

Io

I/O error while reading or writing files (manifest, lockfile, cache).

Automatically constructed from std::io::Error via ?.

Fields

§source: Error
§

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.

Fields

§message: String
§

GitFetch

git2 operation failure during fetch or clone.

Automatically constructed from git2::Error via ?.

Fields

§source: Error
§

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.

Fields

§expected: String
§actual: String
§

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.

Fields

§name: String
§patch_dir: PathBuf
§reason: String
§pinned: String
§

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.

Fields

§name: String
§attempted: Vec<PathBuf>
§

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.

Fields

§name: String
§manifest: PathBuf
§

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.

Fields

§name: String
§requested_by: String
§source: Box<PkgError>
§

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).

Fields

§message: String
§

ManifestSerialize

TOML serialization failure when writing mlua-pkg.toml.

Does not carry #[from]LockfileWrite already claims From<toml::ser::Error>.

Fields

§source: Error

Trait Implementations§

Source§

impl Debug for PkgError

Source§

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

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

impl Display for PkgError

Source§

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

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

impl Error for PkgError

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 From<Error> for PkgError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for PkgError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for PkgError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for PkgError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<TomlError> for PkgError

Source§

fn from(e: TomlError) -> Self

Converts to this type from the input type.

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<E> ExternalError for E
where E: Into<Box<dyn Error>>,

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSync for T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.