Skip to content

Conversation

joshka
Copy link
Contributor

@joshka joshka commented Sep 20, 2024

Verbosity is serialized and deserialized using the lowercase of the
VerbosityFilter (e.g. "debug")

The serde dependency is gated behind an optional feature flag.

Added conversion methods between Verbosity and VerbosityFilter to
simplify the implementation and derived PartialEq, Eq impls on
types where this was necesary for testing.

Fixes: #88

@coveralls
Copy link

coveralls commented Sep 20, 2024

Pull Request Test Coverage Report for Build 17053845567

Details

  • 8 of 12 (66.67%) changed or added relevant lines in 1 file are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.5%) to 49.541%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/lib.rs 8 12 66.67%
Files with Coverage Reduction New Missed Lines %
src/lib.rs 5 49.28%
Totals Coverage Status
Change from base Build 16806571281: -0.5%
Covered Lines: 54
Relevant Lines: 109

💛 - Coveralls

Copy link
Contributor Author

@joshka joshka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will:

  • remove rstest
  • serialize to/from LevelFilter instead of Option(Level)
  • add a specific test for TOML serialization
  • Fix the github lints
  • split the i8 change out to another commit (and will raise another PR for it if necessary)

Copy link
Contributor Author

@joshka joshka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to LevelFilter made it easy to derive serialize / deserialize using From<LevelFilter> instead of a custom implementation.

@joshka joshka force-pushed the jm/serde branch 2 times, most recently from 2a3fb79 to 99d104e Compare September 26, 2024 19:14
@joshka
Copy link
Contributor Author

joshka commented Nov 29, 2024

In eb58de2, I rewrote this based on the 3.0 release. Notably this uses the VerbosityFilter to de/serialize instead of log::LogLevelFilter which means that it only handles Title case deserialization. I've also simplified the style and quantity of tests significantly.

@Lurk
Copy link

Lurk commented Aug 16, 2025

I need that Serialise/Deserialize functionality and would like to continue work on it.

As far as I understand, the way to go is to have three separate PRs:

  1. PR for how the count math is done
  2. PR for impl<L: LogLevel> From<Verbosity<L>> for VerbosityFilter and impl<L: LogLevel> From<VerbosityFilter> for Verbosity<L> (this one will also include derive Eq for tests)
  3. PR for feature-gated Serialize/Deserialize

Does it sound ok?

@joshka
Copy link
Contributor Author

joshka commented Aug 16, 2025

As far as I understand, the way to go is to have three separate PRs:

Likely just massaging the commits in this PR would do fine here. Ed has a high bar for small documented commits. Above force push is just a rebase onto the current main. Splitting in process now.

This will simplify the implementation of Serialization.
@joshka

This comment was marked as duplicate.

@joshka
Copy link
Contributor Author

joshka commented Aug 18, 2025

Updated to serialize and deserialize from lowercase.

Verbosity is serialized and deserialized using the title case of the
VerbosityFilter (e.g. "Debug")

The `serde` dependency is gated behind an optional feature flag.

Fixes: clap-rs#88
@epage epage merged commit 210e8d9 into clap-rs:master Aug 19, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialize & Deserialize
4 participants