Crate octicons

source ·
Expand description

All official GitHub Octicons available for use in your Rust code. Designed for use in Rust server side templating code, such as maud templates. Each icon is available as a named static instance of struct that implements Display. The path or polygon data for that Octicon is also available as a static variable if you want to build your own svg elements.

If you do not like the default configuration, clone the static variable and use builder functions to customize it. The value and the presence of the svg attributes in the rendered output can both be configured.

Example

use octicons;

println!("{}",
    octicons::ARROW_DOWN.clone()
        .xmlns(Some("http://www.w3.org/2000/svg"))
        .width(32)
        .height(32)
        .fill(Some("#ff0"))
        .aria_label(Some("hi"))
        .class(Some("right left"))
);

// Path data
println!("{}", octicons::ARROW_DOWN_PATH);
Maud Example
html! {
    (PreEscaped(&octicons::DASH.to_string()))
}

Structs

  • Structure for Octicon configuration.

Enums

Statics