Skip to content

Commit 5700351

Browse files
committed
update doc comment
1 parent de772f2 commit 5700351

17 files changed

+35
-13
lines changed

src/rule/empty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::ops::Add;
1313

1414
pub use empty_definition::EmptyDefinition;
1515

16-
/// The `Empty` type is a type that indicates that its subject is empty.
16+
/// A type that holds a value satisfying the `EmptyRule`
1717
/// The definition of empty is defined by `EmptyDefinition`.
1818
///
1919
/// # Example
@@ -38,7 +38,7 @@ where
3838
}
3939
}
4040

41-
/// Rule where the data is empty
41+
/// Rule where the input value is empty
4242
/// ```rust
4343
/// use refined_type::rule::{EmptyRule, Rule};
4444
///

src/rule/empty/empty_definition.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// This trait is used to define the empty method for a type.
12
pub trait EmptyDefinition {
23
fn empty(&self) -> bool;
34
}

src/rule/non_empty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ pub use non_empty_string::*;
1515
pub use non_empty_vec::*;
1616
pub use non_empty_vec_deque::*;
1717

18-
/// The `NonEmpty` type is a type that negates `Empty` using the `Not` composer.
19-
/// It represents data that does not match the empty definition
18+
/// Refined type where the input value is not empty
19+
/// The definition of empty is defined by `EmptyDefinition`.
2020
pub type NonEmpty<T> = Refined<NonEmptyRule<T>>;
2121

22-
/// Rule where the data is non-empty
22+
/// Rule where the input value is not empty
2323
/// ```rust
2424
/// use refined_type::rule::{NonEmptyRule, Rule};
2525
/// assert!(NonEmptyRule::<String>::validate(&"non empty".to_string()).is_ok());

src/rule/non_empty/non_empty_map.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::collections::hash_map::{IntoKeys, IntoValues, Keys, Values};
66
use std::collections::HashMap;
77
use std::hash::{BuildHasher, Hash};
88

9-
/// `NonEmptyHashMap` is a `HashMap` that follows the `NonEmptyRule`
9+
/// A type that holds a value satisfying the `NonEmptyHashMapRule`
1010
/// # Example
1111
/// ```rust
1212
/// # use std::collections::{HashMap, HashSet};
@@ -25,6 +25,8 @@ use std::hash::{BuildHasher, Hash};
2525
/// );
2626
/// ```
2727
pub type NonEmptyHashMap<K, V, S = RandomState> = Refined<NonEmptyHashMapRule<K, V, S>>;
28+
29+
/// Rule where the input `HashMap` is not empty
2830
pub type NonEmptyHashMapRule<K, V, S = RandomState> = NonEmptyRule<HashMap<K, V, S>>;
2931

3032
impl<K, V, S> NonEmptyHashMap<K, V, S> {

src/rule/non_empty/non_empty_set.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::collections::hash_map::RandomState;
77
use std::collections::HashSet;
88
use std::hash::{BuildHasher, Hash};
99

10-
/// `NonEmptyHashSet` is a `HashSet` that follows the `NonEmptyRule`
10+
/// A type that holds a value satisfying the `NonEmptyHashSetRule`
1111
/// # Example
1212
/// ```rust
1313
/// # use std::collections::HashSet;
@@ -22,6 +22,8 @@ use std::hash::{BuildHasher, Hash};
2222
/// assert_eq!(set.into_value(), set_origin);
2323
/// ```
2424
pub type NonEmptyHashSet<T, S = RandomState> = Refined<NonEmptyRule<HashSet<T, S>>>;
25+
26+
/// Rule where the input `HashSet` is not empty
2527
pub type NonEmptyHashSetRule<T, S = RandomState> = NonEmptyRule<HashSet<T, S>>;
2628

2729
impl<T, S> NonEmptyHashSet<T, S> {

src/rule/non_empty/non_empty_string.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::rule::{NonEmptyRule, NonEmptyVec};
44
use std::ops::Add;
55
use std::str::FromStr;
66

7-
/// This is a predicate type representing a non-empty string
7+
/// A type that holds a value satisfying the `NonEmptyStringRule`
88
///
99
/// # Example
1010
/// ```rust
@@ -17,6 +17,8 @@ use std::str::FromStr;
1717
/// assert_eq!(non_empty_string.into_value(), "HelloWorld");
1818
/// ```
1919
pub type NonEmptyString = Refined<NonEmptyStringRule>;
20+
21+
/// Rule where the input `String` is not empty
2022
pub type NonEmptyStringRule = NonEmptyRule<String>;
2123

2224
impl NonEmptyString {

src/rule/non_empty/non_empty_vec.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Refined;
33

44
use std::ops::Add;
55

6-
/// `NonEmptyVec` is a `Vec` that follows the `NonEmptyRule`
6+
/// A type that holds a value satisfying the `NonEmptyVecRule`
77
///
88
/// # Example
99
/// ```rust
@@ -13,6 +13,8 @@ use std::ops::Add;
1313
/// assert_eq!(vec.into_value(), vec![1, 2, 3]);
1414
/// ```
1515
pub type NonEmptyVec<T> = Refined<NonEmptyVecRule<T>>;
16+
17+
/// Rule where the input `Vec` is not empty
1618
pub type NonEmptyVecRule<T> = NonEmptyRule<Vec<T>>;
1719

1820
impl<T> NonEmptyVec<T> {

src/rule/non_empty/non_empty_vec_deque.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Refined;
33
use std::collections::VecDeque;
44
use std::ops::Add;
55

6-
/// `NonEmptyVecDeque` is a `VecDeque` that follows the `NonEmptyRule`
6+
/// A type that holds a value satisfying the `NonEmptyVecDequeRule`
77
///
88
/// # Example
99
/// ```rust
@@ -17,6 +17,8 @@ use std::ops::Add;
1717
/// assert_eq!(deque.into_value(), vec![2, 1, 3]);
1818
/// ```
1919
pub type NonEmptyVecDeque<T> = Refined<NonEmptyVecDequeRule<T>>;
20+
21+
/// Rule where the input `VecDeque` is not empty
2022
pub type NonEmptyVecDequeRule<T> = NonEmptyRule<VecDeque<T>>;
2123

2224
impl<T> NonEmptyVecDeque<T> {

src/rule/number/equal.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ macro_rules! equal_rule {
66
#[allow(dead_code)]
77
pub type [<Equal $e $t>] = $crate::Refined<[<EqualRule $e $t>]>;
88

9+
/// Rule where the number is equal to `N`
910
#[allow(dead_code)]
1011
pub struct [<EqualRule $e $t>];
1112

src/rule/number/even.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ macro_rules! even_rule {
55
#[allow(dead_code)]
66
pub type [<Even $t:upper>] = $crate::Refined<[<EvenRule $t:upper>]>;
77

8+
/// Rule where the number is even
89
#[allow(dead_code)]
910
pub struct [<EvenRule $t:upper>];
1011

src/rule/number/greater.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ macro_rules! greater_rule {
66
#[allow(dead_code)]
77
pub type [<Greater $e $t>] = $crate::Refined<[<GreaterRule $e $t>]>;
88

9+
/// Rule where the number is greater than `N`
910
#[allow(dead_code)]
1011
pub struct [<GreaterRule $e $t>];
1112

src/rule/number/less.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ macro_rules! less_rule {
66
#[allow(dead_code)]
77
pub type [<Less $e $t>] = $crate::Refined<[<LessRule $e $t>]>;
88

9+
/// Rule where the number is less than `N`
910
#[allow(dead_code)]
1011
pub struct [<LessRule $e $t>];
1112

src/rule/number/odd.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ macro_rules! odd_rule {
33
paste::item! {
44
/// `Odd[TYPE]` is a type that represents that the number is odd.
55
pub type [<Odd $t:upper>] = $crate::Refined<[<OddRule $t:upper>]>;
6+
/// Rule where the number is odd
67
pub struct [<OddRule $t:upper>];
78

89
impl $crate::rule::Rule for [<OddRule $t:upper>] {

src/rule/string/alpha_digit.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ use crate::rule::Rule;
33
use crate::Refined;
44
use regex::Regex;
55

6+
/// A type that holds a value satisfying the `AlphaDigitRule`
67
pub type AlphaDigit = Refined<AlphaDigitRule>;
8+
9+
/// Rule where the input `String` contains only alphabet and digit characters
710
pub struct AlphaDigitRule;
811

912
impl Rule for AlphaDigitRule {

src/rule/string/alphabet.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::rule::Rule;
33
use crate::Refined;
44
use regex::Regex;
55

6-
/// The `Alphabet` type represents a type that can contain zero or more alphabetic characters.
6+
/// A type that holds a value satisfying the `AlphabetRule`
77
///
88
/// # Example
99
/// ```rust
@@ -17,7 +17,7 @@ use regex::Regex;
1717
/// ```
1818
pub type Alphabet = Refined<AlphabetRule>;
1919

20-
/// A string consisting entirely of alphabetic characters
20+
/// Rule where the input `String` contains only alphabet characters
2121
pub struct AlphabetRule;
2222

2323
impl Rule for AlphabetRule {

src/rule/string/digit.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use crate::rule::Rule;
33
use crate::Refined;
44
use regex::Regex;
55

6+
/// A type that holds a value satisfying the `DigitRule`
67
pub type Digit = Refined<DigitRule>;
8+
/// Rule where the input `String` contains only digit characters
79
pub struct DigitRule;
810

911
impl Rule for DigitRule {

src/rule/string/email.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::rule::Rule;
33
use crate::Refined;
44
use regex::Regex;
55

6-
/// The `Email` type represents a type that conforms to the format of an Email.
6+
/// A type that holds a value satisfying the `EmailRule`
77
///
88
/// # Example
99
/// ```rust
@@ -17,6 +17,7 @@ use regex::Regex;
1717
/// ```
1818
pub type Email = Refined<EmailRule>;
1919

20+
/// Rule where the input `String` is a valid email format
2021
pub struct EmailRule;
2122

2223
impl Rule for EmailRule {

0 commit comments

Comments
 (0)