pub struct PrintDataBuilder { /* private fields */ }
Expand description
Helps build a valid PrintData
Implementations§
Source§impl PrintDataBuilder
impl PrintDataBuilder
Sourcepub fn new() -> PrintDataBuilder
pub fn new() -> PrintDataBuilder
Creates a new print data builder
Sourcepub fn replacement<A: Into<String>, B: Into<String>>(
self,
target: A,
replacement: B,
) -> Self
pub fn replacement<A: Into<String>, B: Into<String>>( self, target: A, replacement: B, ) -> Self
Adds a replacement string
Replacement strings are a simple pattern matching replacement, where all matching instances of target
get replaces by replacement
let print_data = PrintDataBuilder::new()
// Instances of "%name%" will get replaced with "Carlos"
.replacement("%name%", "Carlos")
.build();
Note that there is no particular syntax for the target
string. "%name%"
is used in the example so that the word “name” (in case it appears in the text) is safe from this instruction.
pub fn add_duo_table<A: Into<String>>( self, name: A, rows: Vec<(String, String)>, ) -> Self
pub fn add_trio_table<A: Into<String>>( self, name: A, rows: Vec<(String, String, String)>, ) -> Self
pub fn add_quad_table<A: Into<String>>( self, name: A, rows: Vec<(String, String, String, String)>, ) -> Self
pub fn add_qr_code<A: Into<String>, B: Into<String>>( self, name: A, content: B, ) -> Self
pub fn build(self) -> PrintData
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PrintDataBuilder
impl RefUnwindSafe for PrintDataBuilder
impl Send for PrintDataBuilder
impl Sync for PrintDataBuilder
impl Unpin for PrintDataBuilder
impl UnwindSafe for PrintDataBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more