Skip to main content

Image

Macro Image 

Source
macro_rules! Image {
    ($($key:ident = $val:expr),* $(,)?) => { ... };
}
Expand description

Responsive, lazily loaded image.

use next_rust_view::*;
let html = render_static(Image!(src = "/cat.jpg", width = 640, height = 480, alt = "A cat"));
assert!(html.starts_with(r#"<img src="/_next-rust/image?url=%2Fcat.jpg&amp;w=640&amp;q=75""#));
assert!(html.contains(r#"loading="lazy""#));