[roll pigweed] pw_result: Add transform monadic operation

This CL adds a monadic operation to pw::Result<T> for `transform`. This
method takes a function, which will be invoked only if the pw::Result<T>
contains a value. If the pw::Result<T> contains a status, then that
status will be returned. This is useful for applying a function to a
Result and transforming the type.

 Result<int> ConvertStringToInteger(std::string_view);
 int MultiplyByTwo(int x) { return x * 2; }

 Result<int> x = ConvertStringToInteger("42")
                   .transform(MultiplyByTwo);

Original-Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/101348

https://pigweed.googlesource.com/pigweed/pigweed
pigweed Rolled-Commits: 9b7743e6e8faa10..b568966d401b1b3
Roller-URL: https://ci.chromium.org/b/8806177444648253713
Cq-Cl-Tag: roller-builder:pigweed-zephyr-roller
Cq-Cl-Tag: roller-bid:8806177444648253713
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: Idb356b49c135d7fe5660c6c4135a0752bc6ffcc5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/zephyr-integration/+/105754
Commit-Queue: Pigweed Integration Roller <pigweed-integration-roller@pigweed.google.com.iam.gserviceaccount.com>
Bot-Commit: Pigweed Integration Roller <pigweed-integration-roller@pigweed.google.com.iam.gserviceaccount.com>
1 file changed
tree: 3417305887b68e0dccb5de710fd93532d971b10c
  1. .gitmodules
  2. test.sh