@@ -28,7 +28,8 @@ pub struct TypeRowBase<ROWVARS: MaybeRV> {
28
28
/// Row of single types i.e. of known length, for node inputs/outputs
29
29
pub type TypeRow = TypeRowBase < NoRV > ;
30
30
31
- /// Row of types and/or row variables, the number of actual types is thus unknown
31
+ /// Row of types and/or row variables, the number of actual types is thus
32
+ /// unknown
32
33
pub type TypeRowRV = TypeRowBase < RowVariable > ;
33
34
34
35
impl < RV1 : MaybeRV , RV2 : MaybeRV > PartialEq < TypeRowBase < RV1 > > for TypeRowBase < RV2 > {
@@ -223,7 +224,7 @@ impl TryFrom<Term> for TypeRow {
223
224
224
225
fn try_from ( value : TypeArg ) -> Result < Self , Self :: Error > {
225
226
match value {
226
- TypeArg :: Tuple ( elems) => elems
227
+ TypeArg :: List ( elems) => elems
227
228
. into_iter ( )
228
229
. map ( |ta| ta. as_runtime ( ) )
229
230
. collect :: < Option < Vec < _ > > > ( )
@@ -242,7 +243,7 @@ impl TryFrom<Term> for TypeRowRV {
242
243
243
244
fn try_from ( value : Term ) -> Result < Self , Self :: Error > {
244
245
match value {
245
- TypeArg :: Tuple ( elems) => elems
246
+ TypeArg :: List ( elems) => elems
246
247
. into_iter ( )
247
248
. map ( TypeRV :: try_from)
248
249
. collect :: < Result < Vec < _ > , _ > > ( )
@@ -260,13 +261,13 @@ impl TryFrom<Term> for TypeRowRV {
260
261
261
262
impl From < TypeRow > for Term {
262
263
fn from ( value : TypeRow ) -> Self {
263
- Term :: Tuple ( value. into_owned ( ) . into_iter ( ) . map_into ( ) . collect ( ) )
264
+ Term :: List ( value. into_owned ( ) . into_iter ( ) . map_into ( ) . collect ( ) )
264
265
}
265
266
}
266
267
267
268
impl From < TypeRowRV > for Term {
268
269
fn from ( value : TypeRowRV ) -> Self {
269
- Term :: Tuple ( value. into_owned ( ) . into_iter ( ) . map_into ( ) . collect ( ) )
270
+ Term :: List ( value. into_owned ( ) . into_iter ( ) . map_into ( ) . collect ( ) )
270
271
}
271
272
}
272
273
@@ -330,26 +331,26 @@ mod test {
330
331
331
332
#[ test]
332
333
fn test_try_from_term_to_typerow ( ) {
333
- // Test successful conversion with Tuple
334
+ // Test successful conversion with List
334
335
let types = vec ! [ Type :: new_unit_sum( 1 ) , bool_t( ) ] ;
335
336
let type_args = types. iter ( ) . map ( |t| TypeArg :: Runtime ( t. clone ( ) ) ) . collect ( ) ;
336
- let term = TypeArg :: Tuple ( type_args) ;
337
+ let term = TypeArg :: List ( type_args) ;
337
338
let result = TypeRow :: try_from ( term) ;
338
339
assert ! ( result. is_ok( ) ) ;
339
340
assert_eq ! ( result. unwrap( ) , TypeRow :: from( types) ) ;
340
341
341
- // Test failure with non-tuple
342
+ // Test failure with non-list
342
343
let term = TypeArg :: Runtime ( Type :: UNIT ) ;
343
344
let result = TypeRow :: try_from ( term) ;
344
345
assert ! ( result. is_err( ) ) ;
345
346
}
346
347
347
348
#[ test]
348
349
fn test_try_from_term_to_typerowrv ( ) {
349
- // Test successful conversion with Tuple
350
+ // Test successful conversion with List
350
351
let types = [ TypeRV :: from ( Type :: UNIT ) , TypeRV :: from ( bool_t ( ) ) ] ;
351
352
let type_args = types. iter ( ) . map ( |t| t. clone ( ) . into ( ) ) . collect ( ) ;
352
- let term = TypeArg :: Tuple ( type_args) ;
353
+ let term = TypeArg :: List ( type_args) ;
353
354
let result = TypeRowRV :: try_from ( term) ;
354
355
assert ! ( result. is_ok( ) ) ;
355
356
@@ -366,10 +367,10 @@ mod test {
366
367
let term = Term :: from ( type_row) ;
367
368
368
369
match term {
369
- Term :: Tuple ( elems) => {
370
+ Term :: List ( elems) => {
370
371
assert_eq ! ( elems. len( ) , 2 ) ;
371
372
}
372
- _ => panic ! ( "Expected Term::Tuple " ) ,
373
+ _ => panic ! ( "Expected Term::List " ) ,
373
374
}
374
375
}
375
376
@@ -380,10 +381,10 @@ mod test {
380
381
let term = Term :: from ( type_row_rv) ;
381
382
382
383
match term {
383
- TypeArg :: Tuple ( elems) => {
384
+ TypeArg :: List ( elems) => {
384
385
assert_eq ! ( elems. len( ) , 2 ) ;
385
386
}
386
- _ => panic ! ( "Expected Term::Tuple " ) ,
387
+ _ => panic ! ( "Expected Term::List " ) ,
387
388
}
388
389
}
389
390
}
0 commit comments