Struct badge_maker::BadgeBuilder
source · [−]pub struct BadgeBuilder { /* private fields */ }
Expand description
Constructs a Badge with given options. Message is the only required field.
Each field has a variant that is the field()
for constructing with
absolute rust safety. Those fields also have alternate field_parse()
methods for 3rd party use that wants to rely on the library for
parsing and validation of the fields.
Example
use badge_maker::BadgeBuilder;
let badge = BadgeBuilder::new()
.label("example")
.message("badge")
.color_parse("success")
.build()?;
println!("{}", badge.svg());
Implementations
sourceimpl BadgeBuilder
impl BadgeBuilder
pub fn new() -> Self
pub fn label(&mut self, label: &str) -> &mut Self
pub fn message(&mut self, message: &str) -> &mut Self
pub fn label_color_parse(&mut self, label_color: &str) -> &mut Self
pub fn label_color(&mut self, color: Color) -> &mut Self
pub fn color_parse(&mut self, color: &str) -> &mut Self
pub fn color<Col: Into<Color>>(&mut self, color: Col) -> &mut Self
pub fn style_parse(&mut self, style: &str) -> &mut Self
pub fn style(&mut self, style: Style) -> &mut Self
pub fn link(&mut self, link: &str) -> &mut Self
pub fn logo(&mut self, logo: Logo) -> &mut Self
pub fn logo_url(&mut self, url: &str) -> &mut Self
👎 Deprecated since 0.2.2:
Set the logo instead
pub fn logo_width(&mut self, width: usize) -> &mut Self
👎 Deprecated since 0.2.2:
Set the logo instead
pub fn logo_padding(&mut self, padding: isize) -> &mut Self
👎 Deprecated since 0.2.2:
Set the logo instead
pub fn link_left(&mut self, link: &str) -> &mut Self
pub fn link_right(&mut self, link: &str) -> &mut Self
pub fn build(&self) -> Result<Badge, Error>
Trait Implementations
sourceimpl Default for BadgeBuilder
impl Default for BadgeBuilder
sourcefn default() -> BadgeBuilder
fn default() -> BadgeBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for BadgeBuilder
impl Send for BadgeBuilder
impl Sync for BadgeBuilder
impl Unpin for BadgeBuilder
impl UnwindSafe for BadgeBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more