Skip to content

Commit

Permalink
Bumped version to 1.10.1, fixed TypeWitnessTypeArg impl of BoolWitG
Browse files Browse the repository at this point in the history
Added doc example to BoolWitG showing where it'd be used over BoolWit
  • Loading branch information
rodrimati1992 committed Nov 26, 2024
1 parent d824f85 commit 3a81cce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "typewit"
version = "1.10.0"
version = "1.10.1"
authors = ["rodrimati1992 <[email protected]>"]
rust-version = "1.57.0"
edition = "2021"
Expand Down
25 changes: 23 additions & 2 deletions src/const_marker/boolwit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ pub type BoolWit<const B: bool> = BoolWitG<Bool<B>>;
/// Use this over [`BoolWit`] if you want to write a [`HasTypeWitness`] bound
/// and adding a `const B: bool` parameter would be impossible.
///
/// # Example
///
/// This basic example demonstrates where `BoolWitG` would be used instead of `BoolWit`.
///
/// ```rust
/// use typewit::const_marker::{Bool, BoolWitG};
/// use typewit::HasTypeWitness;
///
///
/// trait Boolean: Sized + HasTypeWitness<BoolWitG<Self>> {
/// type Not: Boolean<Not = Self>;
/// }
///
/// impl Boolean for Bool<true> {
/// type Not = Bool<false>;
/// }
///
/// impl Boolean for Bool<false> {
/// type Not = Bool<true>;
/// }
/// ```
///
/// [`HasTypeWitness`]: crate::HasTypeWitness
pub enum BoolWitG<B> {
Expand All @@ -197,8 +218,8 @@ impl<const B: bool> Debug for BoolWitG<Bool<B>> {
}
}

impl<const B: bool> TypeWitnessTypeArg for BoolWitG<Bool<B>> {
type Arg = Bool<B>;
impl<B> TypeWitnessTypeArg for BoolWitG<B> {
type Arg = B;
}

impl<const B: bool> MakeTypeWitness for BoolWitG<Bool<B>> {
Expand Down

0 comments on commit 3a81cce

Please sign in to comment.