another ref sheet for another iterator because clothes are rather fun to draw
#rain #world #rainworld #rainworld #art #fanart #digitalart #iterator #oc
#rain #world #rainworld #art #fanart #digitalart #iterator #oc
silly oc thing of some goons doing a pearl reading together, featuring a friend on discord
#rain #world #rainworld #rainworld #art #fanart #digitalart #iterator #iterators #oc #gift
#rain #world #rainworld #art #fanart #digitalart #iterator #iterators #oc #gift
45 min speedpaint of AAOO's can-side city, under an aurora. cause i thought it'd be pretty
#rain #world #rainworld #rainworld #art #fanart #digitalart #oc #iterator #can #environmental #city #aurora #environment
#rain #world #rainworld #art #fanart #digitalart #oc #iterator #can #environmental #city #aurora #environment
iterator of @shromp_ on twt, they're very cool (both iterator and owner) (also i didn't just forget to post this for like. 4 hours. oops)
#rain #world #rainworld #rainworld #art #fanart #digitalart #oc #iterator #iteratoroc
#rain #world #rainworld #art #fanart #digitalart #oc #iterator #iteratoroc
Ever wanted to use #Rust to manipulate images like iterators?
image
.map(to_rgb)
.filter(|r, g, b| b > 100)
.collect();
Well, I don't quite have that, but I do have a #monadic-ish library called #obraztam.
https://framagit.org/dcz/obraztam
It's #immutable-first, it has .map() and .zip() and it optimizes to #SIMD instructions. Can be easily parallelized even more.
I used it to detect #laser beams in the picture!
#rust #monadic #obraztam #immutable #simd #laser #graphics #monad #iterator
@zkat 😄 No worries 😉
Yeah, totally agree with you, it seems like magic, but I think it is important that we don't see things as magic, when there is a "simple" answer to it, so I've just looked it up.😄
It works (for `Result`), because of the following impl on `FromIterator<T>`:
And `FromIterator` is used by `collect()`:
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect
See, no magic, just one of the best type-systems in the world.🙂 :ferris: ❤️
#iterator #typesystem #rustlang #Rust
#Rust tip of the day: if you need an uncommon #iterator quickly, build it from a closure using `std::iter::from_fn`.
https://doc.rust-lang.org/std/iter/fn.from_fn.html
```
let mut count = 0;
let counter = std::iter::from_fn(move || {
count += 1;
if count < 6 {
Some(count)
} else {
None
}
});
```
Eine schöne Referenz auf Iteratoren in Trait Objects, findet sich hier: https://depth-first.com/articles/2020/06/22/returning-rust-iterators/
Die komplexeren Lösungen brauchte ich nicht (und führten in meiner Implementation auch nicht zu schönen Lösungen)
Trait Objects machen einiges etwas komplizierter in #Rust. Das fängt schon beim Debuggen an 😕
Und die Welt der #Iterator ist auch nicht so simpel, wenn man eben nicht nur auf einem Iterator lesen will, sondern eine Kette von Iteratoren hat. Wenn diese aber in Trait Objects weggekapselt sind (und unterschiedliche statische Typen haben), wird das eine echte Herausforderung.
Vermutlich ist es am einfachsten, für jedes Trait-Object einen eigenen Iterator zu implementieren.
Grübel...