lnicola / sd-notify

Apache License 2.0
45 stars 6 forks source link

Return a fd iterator from listen_fds #4

Closed lnicola closed 3 years ago

lnicola commented 3 years ago

Fixes #3

lnicola commented 3 years ago

r? @hug-dev r? @g2p

lnicola commented 3 years ago

Just for my Rust knowledge, as I have never done that before, what is the advantage of returning an impl Iter<...> instead of let's say a Vec?

Not much, it simply avoids an allocation and better matches APIs like env::args(). The caller can call .collect(), but it might not need to.

lnicola commented 3 years ago

Thanks, released and published.