Struct rsbadges::Badge[][src]

pub struct Badge {
    pub label_text: String,
    pub label_color: String,
    pub label_link: String,
    pub msg_text: String,
    pub msg_color: String,
    pub msg_link: String,
    pub logo: String,
    pub embed_logo: bool,
    pub badge_link: String,
    pub badge_title: String,
    pub label_title: String,
    pub msg_title: String,
}

Holds generic info about a badge.

The Badge struct holds all of the options that could be set for a badge SVG. It is meant to be as superficial as possible; errors are checked on the generation of the SVG itself, not the Badge object.

Since there are so many options, it’s recommended that one use the default() method during initialization to make the process less verbose:

let badge = Badge {
    label_text: String::from("Custom_label"),
    msg_text: String::from("Custom_msg"),
    ..Badge::default()
};

Fields

label_text: String

The text to show on the left side of the badge.

label_color: String

The background color of the left side of the badge.

This argument takes any valid CSS color code. See the CSS color picker for examples.

// All of these formats would work for `label_text`
let valid_rgb_color = String::from("rgb(40, 20, 50)");
let valid_hsl_color = String::from("hsl(15, 100%, 50%)");
let valid_hex_color = String::from("#00bfff");
let valid_html_color = String::from("white");
label_link: String

The url to redirect to when the left side of the badge is clicked.

msg_text: String

The text to show on the right side of the badge.

msg_color: String

The background color of the right side of the badge. See label_text for more info.

msg_link: String

The url to redirect to when the right side of the badge is clicked.

A URI reference to a logo to display in the badge. Must be in SVG format.

This argument will accept both logo URLs and local logo files. Visit https://simpleicons.org/ for a rich library of icons to choose from.

// Both of these options would work for `logo`
let logo_url = String::from("https://simpleicons.org/icons/rust.svg");
let logo_local = String::from("~/Downloads/rust.svg");

Include the specified logo data directly in the badge. This prevents a URL call whenever the SVG is loaded. Only works if logo is a HTTP/HTTPS URI or a valid file path.

When validating the logo, RSBadges looks for the file on your local machine, and if that fails, it makes an attempt to download.

Success in either case causes the logo’s data to be injected into the badge SVG directly. This means the logo can be seen regardless of the logo file being present or retrievable.

badge_link: String

The url to redirect to when any part of the badge is clicked. Overwrites –label-link and –msg-link.

badge_title: String

The title to associate with the entire badge. More info here.

label_title: String

The title to associate with the left side of the badge.

msg_title: String

The title to associate with the right side of the badge.

Trait Implementations

impl Clone for Badge[src]

impl Debug for Badge[src]

impl Default for Badge[src]

Auto Trait Implementations

impl RefUnwindSafe for Badge

impl Send for Badge

impl Sync for Badge

impl Unpin for Badge

impl UnwindSafe for Badge

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,