Skip to main content

Badge

Struct Badge 

Source
pub struct Badge;
Expand description

Entry point for badge builder API.

This struct acts as a namespace for the builder pattern. Use Badge::style to start building a badge.

§Example

use shields::{BadgeStyle};
use shields::builder::Badge;

let svg = Badge::style(BadgeStyle::Flat)
    .label("build")
    .message("passing")
    .build();
assert!(svg.contains("passing"));

Implementations§

Source§

impl Badge

Source

pub fn style(style: BadgeStyle) -> BadgeBuilder<'static>

Creates a new BadgeBuilder with the specified style.

§Arguments
  • style - The badge style to use.
§Returns

A BadgeBuilder for further configuration.

§Example
use shields::{BadgeStyle};
use shields::builder::Badge;

let builder = Badge::style(BadgeStyle::Flat);
Source

pub fn flat() -> BadgeBuilder<'static>

Creates a builder for a BadgeStyle::Flat badge.

§Example
use shields::builder::Badge;
let svg = Badge::flat().label("build").message("passing").build();
assert!(svg.contains("passing"));
Source

pub fn flat_square() -> BadgeBuilder<'static>

Creates a builder for a BadgeStyle::FlatSquare badge.

Source

pub fn plastic() -> BadgeBuilder<'static>

Creates a builder for a BadgeStyle::Plastic badge.

Source

pub fn social() -> BadgeBuilder<'static>

Creates a builder for a BadgeStyle::Social badge.

Source

pub fn for_the_badge() -> BadgeBuilder<'static>

Creates a builder for a BadgeStyle::ForTheBadge badge.

Auto Trait Implementations§

§

impl Freeze for Badge

§

impl RefUnwindSafe for Badge

§

impl Send for Badge

§

impl Sync for Badge

§

impl Unpin for Badge

§

impl UnsafeUnpin for Badge

§

impl UnwindSafe for Badge

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.