Enum rsbadges::Style[][src]

pub enum Style {
    Plastic(Badge),
    Flat(Badge),
    FlatSquare(Badge),
    ForTheBadge(Badge),
    Social(Badge),
}

A badge container used to format and generate a badge SVG.

As the Badge struct holds generic badge data, the Style enum instructs how to generate that data into a badge SVG. There are currently five Styles: Plastic, Flat, FlatSquare, ForTheBadge, and Social. This naming follows the convention set by Shields.io.

Once a Style object has been instantiated, a badge can be created using the generate_svg function.

Examples

use rsbadges::{Badge, Style};
let badge = Badge {
    label_text: String::from("Custom_label"),
    msg_text: String::from("Custom_msg"),
    ..Badge::default()
};
// Create a plastic badge using the data created above.
let badge_style = Style::Plastic(badge);
let badge_svg = badge_style.generate_svg();
// Save this to file with rsbadges::save_svg

Variants

Plastic(Badge)

The "plastic" badge style

Flat(Badge)

The "flat" badge style

FlatSquare(Badge)

The "flat square" badge style

ForTheBadge(Badge)

The "for the badge" badge style

Social(Badge)

The "social" badge style

Implementations

impl Style[src]

pub fn generate_svg(&self) -> Result<String, BadgeError>[src]

Generates an SVG from the badge data in the chosen badge style.

Badges are lazily evaluated; that is, the data in the Badge struct is not verified until a badge is generated using this function.

Errors

Since this is where data verification takes place, a number of errors are possible:

See BadgeError for a full description of each.

Trait Implementations

impl Debug for Style[src]

Auto Trait Implementations

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> 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>,