This is another approach for providing access to stdin/out/err via
libimagrt::runtime::Runtime.
The Runtime object does configure which output gets returned (stdout if
stdout is a tty, else stderr).
With this we can change libimagrt to read/write the store from/to
stdin/stdout without the user noticing that she does not write to stdout
but stderr.
Reading from stdin is not possible then, though.
This way we can control whether "out" output goes to stdout or stderr
without the user of the functionality knowing.
This is useful for later when we use libimagrt to automatically
read and write the store from and to stdout/in depending on whether we
are talking to a TTY or a pipe.
This patch rebuilds DiaryEntryIterator to be a wrapper around
StoreIdIterator and thus `Diary::entries()` to use `Store::entries` and
not `Store::retrieve_for_module()`.
The `Store::retrieve_for_module()` function is somehow buggy and loads
contents of the files into memory and _somehow_ causes the entries to be
rewritten without newlines.
This bug is fixed by moving away from `Store::retrieve_for_module()`.
Adapt libimagrt interface to export the functions we need to do this.
This is not that nice, but the best approach without rewriting large
parts of libimagrt.
Rewrite without regex crate.
The regex approach was broken. If the following _content_ was provided
in the entry:
foo
---
bar
The regex approach parsed the header until the "---" in the content.
This is, of course, not the way to do that.
Now, the parsing is implemented by hand. Should be faster as well,
though I don't care about this.
This fixes a severe bug.