summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-10-25 18:39:28 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-10-25 21:28:26 +0200
commit1374e323a3692ed996650be448c1ea3fe122b207 (patch)
tree5c07325503a314fc1713df8250700abdf964a995
parentb5b516921698e2eca69bdef85f0760b952b6fa6b (diff)
Add post: Release announcement for resiter v0.4.0
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--content/blog/2019-10-25-resiter-040.md65
1 files changed, 65 insertions, 0 deletions
diff --git a/content/blog/2019-10-25-resiter-040.md b/content/blog/2019-10-25-resiter-040.md
new file mode 100644
index 0000000..a50cc01
--- /dev/null
+++ b/content/blog/2019-10-25-resiter-040.md
@@ -0,0 +1,65 @@
+---
+title: "resiter v0.4.0"
+date: "2019-10-25T21:45:40"
+tags: ["library", "resiter"]
+---
+
+This is a short release announcement. `resiter` was released in version `v0.4.0`
+earlier this day.
+
+
+## v0.4.0
+
+The changelog is rather minimal, as only one feature was added to the
+library: The iterator extension `map_inner_ok_or_else()`. But lets start at the
+beginning.
+
+If you have an `Result<Option<T>, E>>`, you often want to transform this
+structure in the following way:
+
+1. If there is an `Err(_)`, keep it
+1. If there is an `Ok(Some(_))`, unwrap the `Some(_)`
+1. If there is an `Ok(None)` you want to get a nice `Err(_)` for this.
+
+So you often end up with code like this:
+
+```rust
+object.and_then(|o| o.ok_or_else(|| do_something()))
+```
+
+This is not complicated and even convenient. But if you need to do this _all the
+time_, it gets tiresome and is of course not easy to read if it appears all the
+time.
+It is way less complicated, though, to just do
+
+```rust
+object.inner_ok_or_else(|| do_something())
+```
+
+Easy, right?
+
+Now, if you have an `Iterator<Item = Result<Option<T>, E>>`, you need to apply
+this function to each element:
+
+```rust
+iter.map(|e| e.inner_ok_or_else(|| do_something())).collect::<Result<_>>()
+```
+
+for example. Ugly to read, right? So that's what the new feature does, it helps
+you doing that without writing the above ugly thing:
+
+```rust
+iter.map_inner_ok_or_else(|| do_something()).collect::<Result<_>>()
+```
+
+
+## v0.3.0
+
+(There was no post about 0.3.0, so here goes a short note)
+
+Before that there was a v0.3.0 release, which was entirely written by
+[Dawid](https://dpc.pw/). Thank you a lot for that!
+The changelog for that is a lot longer than the v0.4.0 changelog, it ships a lot
+of awesome features, make sure to
+[check it out](http://git.imag-pim.org/resiter/commit/?id=c576d2ec71625ca94cd27da76b6e9536c52d9114)!
+