MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / combine_errors

Function combine_errors

crates/data-structures/src/error_stream.rs:516–543  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

514
515 #[test]
516 fn combine_errors() {
517 type ResultTuple = (Result<i32>, Result<String>, Result<u8>);
518 let tuple_1: ResultTuple = (Ok(1), Ok("hi".into()), Ok(3));
519 assert_eq!(tuple_1.combine_errors(), Ok((1, "hi".into(), 3)));
520
521 let tuple_2: ResultTuple = (Err(MyError::A(1).into()), Ok("hi".into()), Ok(3));
522 assert_eq!(tuple_2.combine_errors(), Err(MyError::A(1).into()));
523
524 let tuple_3: ResultTuple = (Err(MyError::A(1).into()), Err(MyError::A(2).into()), Ok(3));
525 assert_eq!(
526 tuple_3.combine_errors(),
527 Err(ErrorStream(smallvec::smallvec![MyError::A(1), MyError::A(2)]))
528 );
529
530 let tuple_4: ResultTuple = (
531 Err(MyError::A(1).into()),
532 Err(MyError::A(2).into()),
533 Err(MyError::A(3).into()),
534 );
535 assert_eq!(
536 tuple_4.combine_errors(),
537 Err(ErrorStream(smallvec::smallvec![
538 MyError::A(1),
539 MyError::A(2),
540 MyError::A(3)
541 ]))
542 );
543 }
544
545 #[test]
546 fn collect_all_errors() {

Callers

nothing calls this directly

Calls 3

AFunction · 0.85
OkFunction · 0.50
ErrFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…