File tree 6 files changed +3
-43
lines changed
6 files changed +3
-43
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,10 @@ repository = "https://github.com/tomoikey/refined-type"
6
6
readme = " README.md"
7
7
categories = [" development-tools" ]
8
8
license = " MIT"
9
- version = " 0.3.5 "
9
+ version = " 0.3.6 "
10
10
edition = " 2021"
11
11
12
12
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13
13
14
14
[dependencies ]
15
- regex = " 1.10.2"
16
- paste = " 1.0.14"
15
+ regex = " 1.10.3"
Original file line number Diff line number Diff line change 71
71
mod test {
72
72
use crate :: refined:: Refined ;
73
73
use crate :: result:: Error ;
74
- use crate :: rule:: { ClosedAlgebraic , NonEmptyStringRule } ;
74
+ use crate :: rule:: NonEmptyStringRule ;
75
75
76
76
#[ test]
77
77
fn test_refined_non_empty_string_ok ( ) -> Result < ( ) , Error < String > > {
@@ -93,14 +93,4 @@ mod test {
93
93
assert_eq ! ( format!( "{}" , non_empty_string) , "Hello" ) ;
94
94
Ok ( ( ) )
95
95
}
96
-
97
- #[ test]
98
- fn test_refined_plus_non_empty_string ( ) -> Result < ( ) , Error < String > > {
99
- let non_empty_string_1 = Refined :: < NonEmptyStringRule > :: new ( "Hello" . to_string ( ) ) ?;
100
- let non_empty_string_2 = Refined :: < NonEmptyStringRule > :: new ( "World" . to_string ( ) ) ?;
101
- let nonempty_string = non_empty_string_1. plus ( non_empty_string_2) ;
102
-
103
- assert_eq ! ( nonempty_string. into_value( ) , "HelloWorld" ) ;
104
- Ok ( ( ) )
105
- }
106
96
}
Original file line number Diff line number Diff line change 1
- mod closed_algebraic;
2
1
pub mod composer;
3
2
mod empty;
4
3
mod non_empty;
5
4
mod string;
6
5
7
6
use crate :: result:: Error ;
8
- pub use closed_algebraic:: ClosedAlgebraic ;
9
7
pub use empty:: * ;
10
8
pub use non_empty:: * ;
11
9
pub use string:: * ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
use crate :: refined:: Refined ;
2
- use crate :: rule:: closed_algebraic:: ClosedAlgebraic ;
3
2
use crate :: rule:: NonEmpty ;
4
3
5
4
/// This is a predicate type representing a non-empty string
6
5
pub type NonEmptyString = Refined < NonEmptyStringRule > ;
7
6
8
7
pub type NonEmptyStringRule = NonEmpty < String > ;
9
8
10
- /// # Math Theory
11
- /// NonEmpty + NonEmpty = NonEmpty
12
- impl ClosedAlgebraic for NonEmptyString {
13
- fn plus ( self , that : NonEmptyString ) -> NonEmptyString {
14
- Refined :: new ( format ! ( "{}{}" , self . into_value( ) , that. into_value( ) ) ) . unwrap ( )
15
- }
16
- }
17
-
18
9
#[ cfg( test) ]
19
10
mod test {
20
11
use crate :: rule:: { NonEmptyStringRule , Rule } ;
Original file line number Diff line number Diff line change 1
- use crate :: rule:: closed_algebraic:: ClosedAlgebraic ;
2
1
use crate :: rule:: NonEmpty ;
3
2
use crate :: Refined ;
4
- use std:: fmt:: Debug ;
5
3
6
4
pub type NonEmptyVec < T > = Refined < NonEmptyVecRule < T > > ;
7
5
pub type NonEmptyVecRule < T > = NonEmpty < Vec < T > > ;
8
6
9
- /// # Math Theory
10
- /// NonEmptyVec + NonEmptyVec = NonEmptyVec
11
- impl < T > ClosedAlgebraic for NonEmptyVec < T >
12
- where
13
- T : Debug ,
14
- {
15
- fn plus ( self , that : NonEmptyVec < T > ) -> NonEmptyVec < T > {
16
- let mut result = self . into_value ( ) ;
17
- result. append ( & mut that. into_value ( ) ) ;
18
- Refined :: new ( result) . unwrap ( )
19
- }
20
- }
21
-
22
7
#[ cfg( test) ]
23
8
mod test {
24
9
use crate :: rule:: non_empty:: NonEmptyVecRule ;
You can’t perform that action at this time.
0 commit comments