Skip to content

Commit

Permalink
Merge pull request #31 from Finomnis/core_error
Browse files Browse the repository at this point in the history
Switch to `core::error::Error` and remove `std` feature
  • Loading branch information
Finomnis authored Mar 1, 2025
2 parents 4aa1818 + e0d1140 commit 8214a64
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 41 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,6 @@ jobs:
- name: Build
run: cargo build --release --no-default-features


build_feature_std:
name: Build with 'std' feature
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

#- uses: Swatinem/rust-cache@v1

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Build
run: cargo build --release --no-default-features --features std

build_feature_embedded_graphics_textstyle:
name: Build with 'embedded_graphics_textstyle' feature
runs-on: ubuntu-latest
Expand Down Expand Up @@ -260,7 +243,6 @@ jobs:
build,
build_no_std,
build_no_features,
build_feature_std,
build_feature_embedded_graphics_textstyle,
build_examples,
test,
Expand Down
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "u8g2-fonts"
version = "0.5.2"
version = "0.6.0"
edition = "2021"
rust-version = "1.62"
rust-version = "1.81"
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/Finomnis/u8g2-fonts"
Expand All @@ -23,8 +23,6 @@ exclude = [
]

[features]
# Enables std::error::Error impls
std = []
# Enables U8g2TextStyle for the embedded_graphics font interface
embedded_graphics_textstyle = ["dep:embedded-graphics"]

Expand Down
10 changes: 3 additions & 7 deletions examples/simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ edition = "2021"


[dependencies]
u8g2-fonts = { path = "../..", features = [
"std",
"embedded_graphics_textstyle",
] }
u8g2-fonts = { path = "../..", features = ["embedded_graphics_textstyle"] }
embedded-graphics = "0.8.0"
embedded-graphics-simulator = "0.5.0"
embedded-graphics-simulator = "0.7.0"
anyhow = "1.0.71"

[profile.release]
strip = true # Automatically strip symbols from the binary.
strip = true # Automatically strip symbols from the binary.
lto = true
codegen-units = 1

8 changes: 2 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,9 @@ impl<T> From<LookupError> for Error<T> {
}
}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for LookupError {}
impl core::error::Error for LookupError {}

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl<DisplayError> std::error::Error for Error<DisplayError> where
impl<DisplayError> core::error::Error for Error<DisplayError> where
DisplayError: core::fmt::Debug + core::fmt::Display
{
}
Expand Down
7 changes: 1 addition & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
//! # Crate features
//! Additional features can be enabled by adding the following features to your Cargo.toml.
//!
//! - `std`:
//! - derive [`std::error::Error`] for the crate's error types.
//! - `embedded_graphics_textstyle`:
//! - enable [`U8g2TextStyle`] struct for drawing text with [`embedded_graphics::text::Text`].
//!
Expand All @@ -24,7 +22,7 @@
//! - optimized for the U8g2 fonts
//! - supports rendering [`format_args!()`](format_args)
//! - can render everything that can be passed
//! to [`format!()`](std::format), [`write!()`](write) or [`println!()`](std::println)
//! to `format!()`, [`write!()`](write) or `println!()`
//! - does not allocate an intermediate string buffer
//! - supports multi-line vertical alignment
//! - [`U8g2TextStyle`] — a compatibility layer for [`embedded_graphics::text`]
Expand Down Expand Up @@ -119,9 +117,6 @@
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[cfg(feature = "std")]
extern crate std;

mod content;
mod error;
mod font;
Expand Down

0 comments on commit 8214a64

Please sign in to comment.