@@ -17,7 +17,7 @@ mod private
1717 /// * `Err(io::Error)` - An error if any component fails to convert.
1818 pub fn join < Paths : PathJoined > ( paths : Paths ) -> Result < PathBuf , io:: Error >
1919 {
20- paths. join_paths ( )
20+ paths. iter_join ( )
2121 }
2222
2323 /// A trait for joining path components into a `PathBuf`.
@@ -33,16 +33,33 @@ mod private
3333 ///
3434 /// * `Ok(PathBuf)` - The joined path as a `PathBuf`.
3535 /// * `Err(io::Error)` - An error if any component fails to convert.
36- fn join_paths ( self ) -> Result < PathBuf , io:: Error > ;
36+ fn iter_join ( self ) -> Result < PathBuf , io:: Error > ;
3737 }
3838
39+ // // Implementation for an Iterator over items implementing TryIntoCowPath
40+ // impl< 'a, I, T > PathJoined for I
41+ // where
42+ // I : Iterator< Item = T >,
43+ // T : TryIntoCowPath< 'a >,
44+ // {
45+ // fn iter_join( self ) -> Result< PathBuf, io::Error >
46+ // {
47+ // let mut result = PathBuf::new();
48+ // for item in self
49+ // {
50+ // result.push( item.try_into_cow_path()?.as_ref() );
51+ // }
52+ // Ok( result )
53+ // }
54+ // }
55+
3956 // Implementation for a tuple of length 1
4057 impl < ' a , T1 > PathJoined for ( T1 , )
4158 where
4259 T1 : TryIntoCowPath < ' a > ,
4360 {
4461 #[ inline ]
45- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
62+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
4663 {
4764 let ( p1, ) = self ;
4865 let mut result = PathBuf :: new ( ) ;
@@ -58,7 +75,7 @@ mod private
5875 T2 : TryIntoCowPath < ' a > ,
5976 {
6077 #[ inline ]
61- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
78+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
6279 {
6380 let ( p1, p2 ) = self ;
6481 let mut result = PathBuf :: new ( ) ;
@@ -76,7 +93,7 @@ mod private
7693 T3 : TryIntoCowPath < ' a > ,
7794 {
7895 #[ inline ]
79- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
96+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
8097 {
8198 let ( p1, p2, p3 ) = self ;
8299 let mut result = PathBuf :: new ( ) ;
@@ -96,7 +113,7 @@ mod private
96113 T4 : TryIntoCowPath < ' a > ,
97114 {
98115 #[ inline ]
99- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
116+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
100117 {
101118 let ( p1, p2, p3, p4 ) = self ;
102119 let mut result = PathBuf :: new ( ) ;
@@ -118,7 +135,7 @@ mod private
118135 T5 : TryIntoCowPath < ' a > ,
119136 {
120137 #[ inline ]
121- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
138+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
122139 {
123140 let ( p1, p2, p3, p4, p5 ) = self ;
124141 let mut result = PathBuf :: new ( ) ;
@@ -137,7 +154,7 @@ mod private
137154 T : TryIntoCowPath < ' a > + Clone ,
138155 {
139156 #[ inline ]
140- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
157+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
141158 {
142159 let mut result = PathBuf :: new ( ) ;
143160 for item in self
@@ -154,7 +171,7 @@ mod private
154171 T : TryIntoCowPath < ' a > + Clone ,
155172 {
156173 #[ inline ]
157- fn join_paths ( self ) -> Result < PathBuf , io:: Error >
174+ fn iter_join ( self ) -> Result < PathBuf , io:: Error >
158175 {
159176 let mut result = PathBuf :: new ( ) ;
160177 for item in & self
0 commit comments