-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from WyvernIXTL/feature/cli
Feature: API Change to Support Usage for Programs Outside of Build Scripts
- Loading branch information
Showing
5 changed files
with
195 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "license-fetcher" | ||
description = "Fetch licenses of dependencies at build time and embed them into your program." | ||
authors = ["Adam McKellar <[email protected]>"] | ||
version = "0.5.0" | ||
version = "0.6.0" | ||
edition = "2021" | ||
readme = "README.md" | ||
repository = "https://github.com/WyvernIXTL/license-fetcher" | ||
|
@@ -14,7 +14,7 @@ keywords = ["license", "embed", "fetch", "about", "find"] | |
bincode = "=2.0.0-rc.3" | ||
directories = {version = "5.0.1", optional = true} | ||
log = { version = "0.4.22", optional = true } | ||
miniz_oxide = { version = "0.8.0", optional = true } | ||
miniz_oxide = { version = "0.8.0", optional = true, features = ["std"]} | ||
once_cell = { version = "1.19.0", optional = true } | ||
regex = { version = "1.10.6", optional = true } | ||
serde = { version = "1.0.210", features = ["derive"], optional = true } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright Adam McKellar 2025 | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE or copy at | ||
// https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
use std::error::Error; | ||
use std::fmt; | ||
|
||
/// Error union representing errors that might occur during unpacking of license data. | ||
#[derive(Debug)] | ||
pub enum UnpackError { | ||
#[cfg(feature = "compress")] | ||
DecompressError(miniz_oxide::inflate::DecompressError), | ||
DecodeError(bincode::error::DecodeError), | ||
} | ||
|
||
#[cfg(feature = "compress")] | ||
impl From<miniz_oxide::inflate::DecompressError> for UnpackError { | ||
fn from(value: miniz_oxide::inflate::DecompressError) -> Self { | ||
Self::DecompressError(value) | ||
} | ||
} | ||
|
||
impl From<bincode::error::DecodeError> for UnpackError { | ||
fn from(value: bincode::error::DecodeError) -> Self { | ||
Self::DecodeError(value) | ||
} | ||
} | ||
|
||
impl fmt::Display for UnpackError { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self { | ||
#[cfg(feature = "compress")] | ||
Self::DecompressError(e) => writeln!(f, "{}", e), | ||
Self::DecodeError(e) => writeln!(f, "{}", e), | ||
} | ||
} | ||
} | ||
|
||
impl Error for UnpackError { | ||
fn source(&self) -> Option<&(dyn Error + 'static)> { | ||
Some(match self { | ||
#[cfg(feature = "compress")] | ||
Self::DecompressError(e) => e, | ||
Self::DecodeError(e) => e, | ||
}) | ||
} | ||
} |
Oops, something went wrong.