Struct escpos_rust::PrintDataBuilder
source · 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 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