Skip to content

Commit

Permalink
rework runner iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
iapicca committed Sep 6, 2024
1 parent 6ea87a0 commit 224a850
Showing 1 changed file with 16 additions and 49 deletions.
65 changes: 16 additions & 49 deletions packages/yak_runner/lib/src/extension/iterable_run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,78 +6,45 @@ import 'run.dart';
extension IterableNullaryToResultNullaryX<T extends Object>
on Iterable<Nullary<T>> {
/// returns Iterable<ResultNullary<T>> from Iterable<Nullary<T>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<ResultNullary<T>> get run sync* {
for (final function in this) {
yield function.run;
}
}
Iterable<ResultNullary<T>> get run =>
[for (final function in this) function.run];

/// returns Iterable<VoidResultNullary> from Iterable<Nullary<T>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<VoidResultNullary> get runVoid sync* {
for (final function in this) {
yield function.runVoid;
}
}
Iterable<VoidResultNullary> get runVoid =>
[for (final function in this) function.runVoid];
}

extension IterableUnaryToResultUnaryX<T extends Object, S extends Object>
on Iterable<Unary<T, S>> {
/// returns Iterable<ResultNullary<T>> from Iterable<Unary<T, S>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<ResultUnary<T, S>> get run sync* {
for (final function in this) {
yield function.run;
}
}
Iterable<ResultUnary<T, S>> get run =>
[for (final function in this) function.run];
}

extension IterableUnaryToResultUnaryVoidX<T, S> on Iterable<Unary<T, S>> {
/// returns Iterable<VoidResultUnary<S>> from Iterable<Unary<T, S>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<VoidResultUnary<S>> get runVoid sync* {
for (final function in this) {
yield function.runVoid;
}
}
Iterable<VoidResultUnary<S>> get runVoid =>
[for (final function in this) function.runVoid];
}

extension IterableNullaryToResultNullaryAsyncX<T extends Object>
on Iterable<NullaryFutureOr<T>> {
/// returns Iterable<ResultNullary<T>> from Iterable<Nullary<T>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<ResultNullaryAsync<T>> get runAsync sync* {
for (final function in this) {
yield function.runAsync;
}
}
Iterable<ResultNullaryAsync<T>> get runAsync =>
[for (final function in this) function.runAsync];

/// returns Iterable<VoidResultNullary> from Iterable<Nullary<T>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<VoidResultNullaryAsync> get runVoidAsync sync* {
for (final function in this) {
yield function.runVoidAsync;
}
}
Iterable<VoidResultNullaryAsync> get runVoidAsync =>
[for (final function in this) function.runVoidAsync];
}

extension IterableUnaryToResultUnaryAsyncX<T extends Object, S extends Object>
on Iterable<UnaryFutureOr<T, S>> {
/// returns Iterable<ResultNullary<T>> from Iterable<Unary<T, S>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<ResultUnaryAsync<T, S>> get runAsync sync* {
for (final function in this) {
yield function.runAsync;
}
}
Iterable<ResultUnaryAsync<T, S>> get runAsync =>
[for (final function in this) function.runAsync];

/// returns Iterable<VoidResultUnary<S>> from Iterable<Unary<T, S>>
/// TODO REWORK ITERATOR https://github.com/yakforward-ou/yak_packages/issues/238
Iterable<VoidResultUnaryAsync<S>> get runVoidAsync sync* {
for (final function in this) {
yield function.runVoidAsync;
}
}
Iterable<VoidResultUnaryAsync<S>> get runVoidAsync =>
[for (final function in this) function.runVoidAsync];
}

0 comments on commit 224a850

Please sign in to comment.