From 63acdfaab9f9bda714ee3d21c44c7e30549569f8 Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Sat, 23 Feb 2019 14:32:02 +0100 Subject: [PATCH] Make docs formatting consistent (no explicit word wrap) --- docs/qtpromise/exceptions/canceled.md | 7 ++++--- docs/qtpromise/exceptions/timeout.md | 3 +-- docs/qtpromise/exceptions/undefined.md | 3 +-- docs/qtpromise/helpers/attempt.md | 9 ++------- docs/qtpromise/helpers/each.md | 8 ++------ docs/qtpromise/helpers/filter.md | 12 +++--------- docs/qtpromise/helpers/map.md | 11 +++-------- docs/qtpromise/qpromise/constructor.md | 4 +--- docs/qtpromise/qpromise/filter.md | 12 +++--------- docs/qtpromise/qpromise/map.md | 11 +++-------- docs/qtpromise/qpromise/then.md | 8 ++------ 11 files changed, 25 insertions(+), 63 deletions(-) diff --git a/docs/qtpromise/exceptions/canceled.md b/docs/qtpromise/exceptions/canceled.md index b42347a..f46fb3f 100644 --- a/docs/qtpromise/exceptions/canceled.md +++ b/docs/qtpromise/exceptions/canceled.md @@ -6,9 +6,7 @@ title: QPromiseCanceledException *Since: 0.1.0* -This exception is thrown for promise created from a [`QFuture`](../qtconcurrent.md) -which has been canceled (e.g. using [`QFuture::cancel()`](http://doc.qt.io/qt-5/qfuture.html#cancel)). -Note that QtPromise doesn't support promise cancelation yet. For example: +This exception is thrown for promise created from a [`QFuture`](../qtconcurrent.md) which has been canceled (e.g. using [`QFuture::cancel()`](http://doc.qt.io/qt-5/qfuture.html#cancel)), for example: ```cpp auto output = qPromise(future) @@ -17,3 +15,6 @@ auto output = qPromise(future) }); ``` +::: tip NOTE +QtPromise doesn't support promise cancelation (yet?) +::: diff --git a/docs/qtpromise/exceptions/timeout.md b/docs/qtpromise/exceptions/timeout.md index 725c2f6..582d625 100644 --- a/docs/qtpromise/exceptions/timeout.md +++ b/docs/qtpromise/exceptions/timeout.md @@ -6,8 +6,7 @@ title: QPromiseTimeoutException *Since: 0.2.0* -This is the default exception thrown when reaching the time limit when using -the [`QPromise::timeout()`](../qpromise/timeout.md) method, for example: +This is the default exception thrown when reaching the time limit when using the [`QPromise::timeout()`](../qpromise/timeout.md) method, for example: ```cpp QPromise input = {...} diff --git a/docs/qtpromise/exceptions/undefined.md b/docs/qtpromise/exceptions/undefined.md index fb6ecae..79718d3 100644 --- a/docs/qtpromise/exceptions/undefined.md +++ b/docs/qtpromise/exceptions/undefined.md @@ -6,8 +6,7 @@ title: QPromiseUndefinedException *Since: 0.5.0* -This exception is thrown when rejecting a promise with no explicit reason, for -example: +This exception is thrown when rejecting a promise with no explicit reason, for example: ```cpp QPromise promise([](const QPromiseResolve& resolve, const QPromiseReject& reject) { diff --git a/docs/qtpromise/helpers/attempt.md b/docs/qtpromise/helpers/attempt.md index 50ef77c..b603303 100644 --- a/docs/qtpromise/helpers/attempt.md +++ b/docs/qtpromise/helpers/attempt.md @@ -13,14 +13,9 @@ QtPromise::attempt(Functor functor, Args...) -> QPromise // - Functor: Function(Args...) -> R | QPromise ``` -Calls `functor` immediately and returns a promise fulfilled with the value returned by -`functor`. Any synchronous exceptions will be turned into rejections on the returned -promise. This is a convenient method that can be used instead of handling both synchronous -and asynchronous exception flows. +Calls `functor` immediately and returns a promise fulfilled with the value returned by `functor`. Any synchronous exceptions will be turned into rejections on the returned promise. This is a convenient method that can be used instead of handling both synchronous and asynchronous exception flows. -The type `R` of the `output` promise depends on the type returned by the `functor` function. -If `functor` returns a promise (or `QFuture`), the `output` promise is delayed and will be -resolved by the returned promise. +The type `R` of the `output` promise depends on the type returned by the `functor` function. If `functor` returns a promise (or `QFuture`), the `output` promise is delayed and will be resolved by the returned promise. ```cpp QPromise download(const QUrl& url); diff --git a/docs/qtpromise/helpers/each.md b/docs/qtpromise/helpers/each.md index 91e03b6..eaabdff 100644 --- a/docs/qtpromise/helpers/each.md +++ b/docs/qtpromise/helpers/each.md @@ -14,13 +14,9 @@ QtPromise::each(Sequence values, Functor functor) -> QPromise> // - Functor: Function(T value, int index) -> void | QPromise ``` -Calls the given `functor` on each element in `values` then resolves to the original sequence -unmodified. If `functor` throws, `output` is rejected with the new exception. - -If `functor` returns a promise (or `QFuture`), the `output` promise is delayed until all the -promises are resolved. If any of the promises fail, `output` immediately rejects with the error -of the promise that rejected, whether or not the other promises are resolved. +Calls the given `functor` on each element in `values` then resolves to the original sequence unmodified. If `functor` throws, `output` is rejected with the new exception. +If `functor` returns a promise (or `QFuture`), the `output` promise is delayed until all the promises are resolved. If any of the promises fail, `output` immediately rejects with the error of the promise that rejected, whether or not the other promises are resolved. ```cpp auto output = QtPromise::each(QVector{ diff --git a/docs/qtpromise/helpers/filter.md b/docs/qtpromise/helpers/filter.md index 5628ea6..dd317f5 100644 --- a/docs/qtpromise/helpers/filter.md +++ b/docs/qtpromise/helpers/filter.md @@ -14,14 +14,9 @@ QtPromise::filter(Sequence values, Filterer filterer) -> QPromise // - Filterer: Function(T value, int index) -> bool ``` -Iterates over `values` and [filters the sequence](https://en.wikipedia.org/wiki/Filter_%28higher-order_function%29) -to another using the given `filterer` function. If `filterer` returns `true`, a copy of the item -is put in the `output` sequence, otherwise, the item will not appear in `output`. If `filterer` -throws, `output` is rejected with the new exception. +Iterates over `values` and [filters the sequence](https://en.wikipedia.org/wiki/Filter_%28higher-order_function%29) to another using the given `filterer` function. If `filterer` returns `true`, a copy of the item is put in the `output` sequence, otherwise, the item will not appear in `output`. If `filterer` throws, `output` is rejected with the new exception. -If `filterer` returns a promise (or `QFuture`), the `output` promise is delayed until all the -promises are resolved. If any of the promises fail, `output` immediately rejects with the error -of the promise that rejected, whether or not the other promises are resolved. +If `filterer` returns a promise (or `QFuture`), the `output` promise is delayed until all the promises are resolved. If any of the promises fail, `output` immediately rejects with the error of the promise that rejected, whether or not the other promises are resolved. ```cpp auto output = QtPromise::filter(QVector{ @@ -45,8 +40,7 @@ output.then([](const QVector& res) { ``` ::: tip NOTE -The order of the output sequence values is guarantee to be the same as the original -sequence, regardless of completion order of the promises returned by `filterer`. +The order of the output sequence values is guarantee to be the same as the original sequence, regardless of completion order of the promises returned by `filterer`. ::: See also: [`QPromise::filter`](../qpromise/filter.md) diff --git a/docs/qtpromise/helpers/map.md b/docs/qtpromise/helpers/map.md index 46b2b0d..489deec 100644 --- a/docs/qtpromise/helpers/map.md +++ b/docs/qtpromise/helpers/map.md @@ -14,13 +14,9 @@ QtPromise::map(Sequence values, Mapper mapper) -> QPromise> // - Mapper: Function(T value, int index) -> R | QPromise ``` -Iterates over `values` and [maps the sequence](https://en.wikipedia.org/wiki/Map_%28higher-order_function%29) -to another using the given `mapper` function. The type returned by `mapper` determines the type -of the `output` promise. If `mapper` throws, `output` is rejected with the new exception. +Iterates over `values` and [maps the sequence](https://en.wikipedia.org/wiki/Map_%28higher-order_function%29) to another using the given `mapper` function. The type returned by `mapper` determines the type of the `output` promise. If `mapper` throws, `output` is rejected with the new exception. -If `mapper` returns a promise (or `QFuture`), the `output` promise is delayed until all the -promises are resolved. If any of the promises fails, `output` immediately rejects with the -error of the promise that rejected, whether or not the other promises are resolved. +If `mapper` returns a promise (or `QFuture`), the `output` promise is delayed until all the promises are resolved. If any of the promises fails, `output` immediately rejects with the error of the promise that rejected, whether or not the other promises are resolved. ```cpp auto output = QtPromise::map(QVector{ @@ -44,8 +40,7 @@ output.then([](const QVector& res) { ``` ::: tip NOTE -The order of the output sequence values is guarantee to be the same as the original -sequence, regardless of completion order of the promises returned by `mapper`. +The order of the output sequence values is guarantee to be the same as the original sequence, regardless of completion order of the promises returned by `mapper`. ::: See also: [`QPromise::map`](../qpromise/map.md) diff --git a/docs/qtpromise/qpromise/constructor.md b/docs/qtpromise/qpromise/constructor.md index dcd8961..1e5f51e 100644 --- a/docs/qtpromise/qpromise/constructor.md +++ b/docs/qtpromise/qpromise/constructor.md @@ -40,9 +40,7 @@ QPromise promise([](const auto& resolve, const auto& reject) { *Since: 0.5.0* -While not recommended because it makes tracking errors more difficult, it's also -possible to reject a promise without explicit reason, in which case, a built-in -[`QPromiseUndefinedException`](../exceptions/undefined.md) is thrown: +While not recommended because it makes tracking errors more difficult, it's also possible to reject a promise without explicit reason, in which case, a built-in [`QPromiseUndefinedException`](../exceptions/undefined.md) is thrown: ```cpp QPromise promise([](const QPromiseResolve& resolve, const QPromiseReject& reject) { diff --git a/docs/qtpromise/qpromise/filter.md b/docs/qtpromise/qpromise/filter.md index a8d8577..c596e02 100644 --- a/docs/qtpromise/qpromise/filter.md +++ b/docs/qtpromise/qpromise/filter.md @@ -18,14 +18,9 @@ QPromise>::filter(Filter filterer) -> QPromise> This method only applies to promise with sequence value. ::: -Iterates over all the promise values (i.e. `Sequence`) and [filters the sequence](https://en.wikipedia.org/wiki/Filter_%28higher-order_function%29) -to another using the given `filterer` function. If `filterer` returns `true`, a copy of the item -is put in the `output` sequence, otherwise, the item will not appear in `output`. If `filterer` -throws, `output` is rejected with the new exception. +Iterates over all the promise values (i.e. `Sequence`) and [filters the sequence](https://en.wikipedia.org/wiki/Filter_%28higher-order_function%29) to another using the given `filterer` function. If `filterer` returns `true`, a copy of the item is put in the `output` sequence, otherwise, the item will not appear in `output`. If `filterer` throws, `output` is rejected with the new exception. -If `filterer` returns a promise (or `QFuture`), the `output` promise is delayed until all the -promises are resolved. If any of the promises fail, `output` immediately rejects with the error -of the promise that rejected, whether or not the other promises are resolved. +If `filterer` returns a promise (or `QFuture`), the `output` promise is delayed until all the promises are resolved. If any of the promises fail, `output` immediately rejects with the error of the promise that rejected, whether or not the other promises are resolved. ```cpp QPromise> input = {...} @@ -48,8 +43,7 @@ output.then([](const QList& res) { ``` ::: tip NOTE -The order of the output sequence values is guarantee to be the same as the original -sequence, regardless of completion order of the promises returned by `filterer`. +The order of the output sequence values is guarantee to be the same as the original sequence, regardless of completion order of the promises returned by `filterer`. ::: See also: [`QtPromise::filter`](../helpers/filter.md) diff --git a/docs/qtpromise/qpromise/map.md b/docs/qtpromise/qpromise/map.md index 35832b2..f7aee34 100644 --- a/docs/qtpromise/qpromise/map.md +++ b/docs/qtpromise/qpromise/map.md @@ -18,13 +18,9 @@ QPromise>::map(Mapper mapper) -> QPromise> This method only applies to promise with sequence value. ::: -Iterates over all the promise values (i.e. `Sequence`) and [maps the sequence](https://en.wikipedia.org/wiki/Map_%28higher-order_function%29) -to another using the given `mapper` function. The type returned by `mapper` determines the type -of the `output` promise. If `mapper` throws, `output` is rejected with the new exception. +Iterates over all the promise values (i.e. `Sequence`) and [maps the sequence](https://en.wikipedia.org/wiki/Map_%28higher-order_function%29) to another using the given `mapper` function. The type returned by `mapper` determines the type of the `output` promise. If `mapper` throws, `output` is rejected with the new exception. -If `mapper` returns a promise (or `QFuture`), the `output` promise is delayed until all the -promises are resolved. If any of the promises fails, `output` immediately rejects with the -error of the promise that rejected, whether or not the other promises are resolved. +If `mapper` returns a promise (or `QFuture`), the `output` promise is delayed until all the promises are resolved. If any of the promises fails, `output` immediately rejects with the error of the promise that rejected, whether or not the other promises are resolved. ```cpp QPromise> input = {...} @@ -50,8 +46,7 @@ output.then([](const QVector& res) { ``` ::: tip NOTE -The order of the output sequence values is guarantee to be the same as the original -sequence, regardless of completion order of the promises returned by `mapper`. +The order of the output sequence values is guarantee to be the same as the original sequence, regardless of completion order of the promises returned by `mapper`. ::: This function is provided for convenience and is similar to: diff --git a/docs/qtpromise/qpromise/then.md b/docs/qtpromise/qpromise/then.md index b55ad52..c5cf9ff 100644 --- a/docs/qtpromise/qpromise/then.md +++ b/docs/qtpromise/qpromise/then.md @@ -24,9 +24,7 @@ auto output = input.then([](int res) { ``` ::: tip NOTE -`onRejected` handler is optional, in which case `output` will be rejected with -the same reason as `input`. Also note that it's recommended to use the -[`fail`](fail.md) shorthand to handle errors. +`onRejected` handler is optional, in which case `output` will be rejected with the same reason as `input`. Also note that it's recommended to use the [`fail`](fail.md) shorthand to handle errors. ::: The type `` of the `output` promise depends on the return type of the `onFulfilled` handler: @@ -44,9 +42,7 @@ output.then([](const QString& res) { ``` ::: tip NOTE -Only `onFulfilled` can change the promise type, `onRejected` **must** return the -same type as `onFulfilled`. That also means if `onFulfilled` is `nullptr`, -`onRejected` must return the same type as the `input` promise. +Only `onFulfilled` can change the promise type, `onRejected` **must** return the same type as `onFulfilled`. That also means if `onFulfilled` is `nullptr`, `onRejected` must return the same type as the `input` promise. ::: ```cpp