Skip to main content

StyledPixel

Trait StyledPixel 

Source
pub trait StyledPixel: Pixel {
    // Required method
    fn from_hex(hex: &str) -> Self;
}
Expand description

A Pixel constructible from a CSS-style hex color string ("#rrggbb" or "#rgb"), used by Renderer::template to apply a QrTemplate.

Implemented for the owned, styled backends (image RGB/RGBA, EPS, PDF, ANSI). The borrowing backends (svg::Color, html::Color) are not StyledPixel because their color borrows from the input and can’t be stored generically; apply those colors manually instead.

Required Methods§

Source

fn from_hex(hex: &str) -> Self

Builds a pixel from a hex color string, falling back to black on an unparseable value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§