1
- use crate :: rule:: { EmptyDefinition , NonEmptyRule } ;
1
+ use crate :: rule:: { EmptyDefinition , NonEmptyIntoIter , NonEmptyRule } ;
2
2
use crate :: Refined ;
3
- use std:: iter:: Map ;
4
3
4
+ use std:: iter:: Map ;
5
5
use std:: ops:: Add ;
6
- use std:: vec:: IntoIter ;
7
6
8
7
impl < I : ExactSizeIterator + EmptyDefinition > Refined < NonEmptyRule < I > > {
9
8
pub fn map < B , F > ( self , f : F ) -> Refined < NonEmptyRule < Map < I , F > > >
@@ -21,30 +20,12 @@ impl<I: ExactSizeIterator + EmptyDefinition> Refined<NonEmptyRule<I>> {
21
20
where
22
21
Self : Sized ,
23
22
{
24
- let a: B = FromIterator :: from_iter ( self . into_value ( ) ) ;
25
- Refined :: new ( a) . ok ( ) . expect ( "" )
23
+ Refined :: new ( FromIterator :: from_iter ( self . into_value ( ) ) )
24
+ . ok ( )
25
+ . expect ( "This error is always unreachable" )
26
26
}
27
27
}
28
28
29
- pub type NonEmptyIntoIter < T > = Refined < NonEmptyIntoIterRule < T > > ;
30
- pub type NonEmptyIntoIterRule < T > = NonEmptyRule < IntoIter < T > > ;
31
-
32
- pub type NonEmptyMap < I , F > = Refined < NonEmptyMapRule < I , F > > ;
33
- pub type NonEmptyMapRule < I , F > = NonEmptyRule < Map < I , F > > ;
34
-
35
- // impl<T> NonEmptyIntoIter<T> {
36
- // pub fn map<B, F>(self, f: F) -> Refined<NonEmptyRule<Map<IntoIter<T>, F>>>
37
- // where
38
- // Self: Sized,
39
- // F: FnMut(T) -> B,
40
- // {
41
- // let map_into_iter = self.into_value().map(f);
42
- // Refined::new(map_into_iter)
43
- // .ok()
44
- // .expect("This error is always unreachable")
45
- // }
46
- // }
47
-
48
29
pub type NonEmptyVec < T > = Refined < NonEmptyVecRule < T > > ;
49
30
50
31
impl < T > NonEmptyVec < T >
0 commit comments