pub fn rewrite_srcset<F>(srcset: &str, rewrite_url: F) -> Cow<'_, str>Expand description
srcset with each candidate URL replaced by what rewrite_url returns
for it; None keeps that URL as authored.
Only the URLs (see srcset_url_spans) change: descriptors, separators
and whitespace, newlines included, are kept byte for byte. When
rewrite_url returns None for every candidate the value is returned
borrowed, so callers can tell “nothing to do” without comparing strings.
Any Some, even one equal to the URL, rebuilds the value.
use mbr_core::url_path::rewrite_srcset;
let out = rewrite_srcset("a.png, b.png 2x", |url| (url == "b.png").then(|| "../b.png".into()));
assert_eq!(out, "a.png, ../b.png 2x");