pub struct PrinterOptions { /* private fields */ }Expand description
Printer options
Implementations§
Source§impl PrinterOptions
impl PrinterOptions
Sourcepub fn new(
page_code: Option<PageCode>,
debug_mode: Option<DebugMode>,
characters_per_line: u8,
) -> Self
pub fn new( page_code: Option<PageCode>, debug_mode: Option<DebugMode>, characters_per_line: u8, ) -> Self
Create a new printer options instance
use escpos::printer_options::PrinterOptions;
use escpos::utils::{DebugMode, PageCode};
let options = PrinterOptions::new(Some(PageCode::PC437), Some(DebugMode::Hex), 44);
assert_eq!(options.get_page_code().unwrap(), PageCode::PC437);
assert_eq!(options.get_debug_mode().unwrap(), DebugMode::Hex);
assert_eq!(options.get_characters_per_line(), 44);Sourcepub fn get_page_code(&self) -> Option<PageCode>
pub fn get_page_code(&self) -> Option<PageCode>
Get the code page
Sourcepub fn page_code(&mut self, page_code: Option<PageCode>)
pub fn page_code(&mut self, page_code: Option<PageCode>)
Set the code page
use escpos::printer_options::PrinterOptions;
use escpos::utils::PageCode;
let mut printer_options = PrinterOptions::default();
printer_options.page_code(Some(PageCode::PC858));
assert_eq!(printer_options.get_page_code().unwrap(), PageCode::PC858);Sourcepub fn get_characters_per_line(&self) -> u8
pub fn get_characters_per_line(&self) -> u8
Get the number of characters per line
Sourcepub fn characters_per_line(&mut self, characters_per_line: u8)
pub fn characters_per_line(&mut self, characters_per_line: u8)
Set the number of characters per line
use escpos::printer_options::PrinterOptions;
let mut printer_options = PrinterOptions::default();
printer_options.characters_per_line(48);
assert_eq!(printer_options.get_characters_per_line(), 48);Sourcepub fn get_debug_mode(&self) -> Option<DebugMode>
pub fn get_debug_mode(&self) -> Option<DebugMode>
Get the debug mode
Sourcepub fn debug_mode(&mut self, debug_mode: Option<DebugMode>)
pub fn debug_mode(&mut self, debug_mode: Option<DebugMode>)
Set the debug mode
use escpos::printer_options::PrinterOptions;
use escpos::utils::DebugMode;
let mut printer_options = PrinterOptions::default();
printer_options.debug_mode(Some(DebugMode::Dec));
assert_eq!(printer_options.get_debug_mode().unwrap(), DebugMode::Dec);Trait Implementations§
Source§impl Clone for PrinterOptions
impl Clone for PrinterOptions
Source§fn clone(&self) -> PrinterOptions
fn clone(&self) -> PrinterOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrinterOptions
impl Debug for PrinterOptions
Source§impl Default for PrinterOptions
impl Default for PrinterOptions
Source§fn default() -> Self
fn default() -> Self
Create a default printer options instance
use escpos::printer_options::PrinterOptions;
use escpos::utils::{DebugMode, PageCode, DEFAULT_CHARACTERS_PER_LINE};
let options = PrinterOptions::default();
assert_eq!(options.get_page_code(), None);
assert_eq!(options.get_debug_mode(), None);
assert_eq!(options.get_characters_per_line(), DEFAULT_CHARACTERS_PER_LINE);Auto Trait Implementations§
impl Freeze for PrinterOptions
impl RefUnwindSafe for PrinterOptions
impl Send for PrinterOptions
impl Sync for PrinterOptions
impl Unpin for PrinterOptions
impl UnsafeUnpin for PrinterOptions
impl UnwindSafe for PrinterOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().