pub trait AsyncWriterExtwhere
Self: Sized,{
type Write: AsyncWrite;
Show 18 methods
// Required methods
fn open(
model: Model,
w: Self::Write,
) -> impl Future<Output = Result<Self, Error>>;
fn init(&mut self) -> impl Future<Output = Result<(), Error>>;
fn cut(&mut self) -> impl Future<Output = Result<(), Error>>;
fn set_unicode(&mut self) -> impl Future<Output = Result<(), Error>>;
fn character_set(
&mut self,
c: CharacterSet,
) -> impl Future<Output = Result<(), Error>>;
fn underline(
&mut self,
state: bool,
) -> impl Future<Output = Result<(), Error>>;
fn emphasize(
&mut self,
state: bool,
) -> impl Future<Output = Result<(), Error>>;
fn reverse(
&mut self,
state: bool,
) -> impl Future<Output = Result<(), Error>>;
fn double_strike(
&mut self,
state: bool,
) -> impl Future<Output = Result<(), Error>>;
fn justify(
&mut self,
alignment: Alignment,
) -> impl Future<Output = Result<(), Error>>;
fn feed(&mut self, count: u8) -> impl Future<Output = Result<(), Error>>;
fn speed(&mut self, speed: u8) -> impl Future<Output = Result<(), Error>>;
fn set_hri_position(
&mut self,
position: HriPosition,
) -> impl Future<Output = Result<(), Error>>;
fn print_image(
&mut self,
img: GrayImage,
) -> impl Future<Output = Result<(), Error>>;
fn print_image_unchecked(
&mut self,
img: GrayImage,
) -> impl Future<Output = Result<(), Error>>;
fn print_barcode(
&mut self,
barcode: Barcode,
) -> impl Future<Output = Result<(), Error>>;
fn write_command(
&mut self,
cmd: Command,
) -> impl Future<Output = Result<(), Error>>;
fn write_all(
&mut self,
buf: &[u8],
) -> impl Future<Output = Result<(), Error>>;
}tokio only.Expand description
Trait to add async epson methods.
Required Associated Types§
Sourcetype Write: AsyncWrite
type Write: AsyncWrite
Inner type of the Async writer
Required Methods§
Sourcefn open(
model: Model,
w: Self::Write,
) -> impl Future<Output = Result<Self, Error>>
fn open( model: Model, w: Self::Write, ) -> impl Future<Output = Result<Self, Error>>
Create a new Writer, wrapping the provided tokio::io::AsyncWrite.
Sourcefn set_unicode(&mut self) -> impl Future<Output = Result<(), Error>>
fn set_unicode(&mut self) -> impl Future<Output = Result<(), Error>>
Set unicode mode on the printer, if supported.
Sourcefn character_set(
&mut self,
c: CharacterSet,
) -> impl Future<Output = Result<(), Error>>
fn character_set( &mut self, c: CharacterSet, ) -> impl Future<Output = Result<(), Error>>
Set the specific CharacterSet to be used on bytes sent to the
printer. Some models do not support sets other than Raw, so
check your specific printer model.
Sourcefn underline(&mut self, state: bool) -> impl Future<Output = Result<(), Error>>
fn underline(&mut self, state: bool) -> impl Future<Output = Result<(), Error>>
If true, text printed after this command will be underlined. If false, it will remove an underline if one was set.
Sourcefn emphasize(&mut self, state: bool) -> impl Future<Output = Result<(), Error>>
fn emphasize(&mut self, state: bool) -> impl Future<Output = Result<(), Error>>
If true, emphasize the text printed after this command. if false, remove emphasis on the text.
Sourcefn reverse(&mut self, state: bool) -> impl Future<Output = Result<(), Error>>
fn reverse(&mut self, state: bool) -> impl Future<Output = Result<(), Error>>
If true, reverse the color of the text printed after this command. if false, return the colors to normal.
Sourcefn double_strike(
&mut self,
state: bool,
) -> impl Future<Output = Result<(), Error>>
fn double_strike( &mut self, state: bool, ) -> impl Future<Output = Result<(), Error>>
If true, double-strike the text printed after this command. If false, remove the double-strike.
Sourcefn justify(
&mut self,
alignment: Alignment,
) -> impl Future<Output = Result<(), Error>>
fn justify( &mut self, alignment: Alignment, ) -> impl Future<Output = Result<(), Error>>
Set the horizontal justification of the text printed after this command.
Sourcefn feed(&mut self, count: u8) -> impl Future<Output = Result<(), Error>>
fn feed(&mut self, count: u8) -> impl Future<Output = Result<(), Error>>
Feed the specified number of lines out of the printer.
Sourcefn speed(&mut self, speed: u8) -> impl Future<Output = Result<(), Error>>
fn speed(&mut self, speed: u8) -> impl Future<Output = Result<(), Error>>
Set the printer speed to the provided value.
Sourcefn set_hri_position(
&mut self,
position: HriPosition,
) -> impl Future<Output = Result<(), Error>>
fn set_hri_position( &mut self, position: HriPosition, ) -> impl Future<Output = Result<(), Error>>
Set the print position of HRI (Human Readable Interpretation) characters for barcodes.
Sourcefn print_image(
&mut self,
img: GrayImage,
) -> impl Future<Output = Result<(), Error>>
fn print_image( &mut self, img: GrayImage, ) -> impl Future<Output = Result<(), Error>>
Print a greyscale image.
Currently, this image must have a width that’s 8 bit aligned,
and the size may not be larger than a uint16 in height. The
width of the image is constrained by the underling printer model
provided to Self::open.
Sourcefn print_image_unchecked(
&mut self,
img: GrayImage,
) -> impl Future<Output = Result<(), Error>>
fn print_image_unchecked( &mut self, img: GrayImage, ) -> impl Future<Output = Result<(), Error>>
Print a grayscale image, without any model checks. This will let you do all sorts of invalid things. Don’t use this if you can avoid it, it may result in trash being printed.
Sourcefn print_barcode(
&mut self,
barcode: Barcode,
) -> impl Future<Output = Result<(), Error>>
fn print_barcode( &mut self, barcode: Barcode, ) -> impl Future<Output = Result<(), Error>>
Print a barcode.
The barcode will be printed according to the currently set HRI position.
Use set_hri_position to control the position of the human-readable text.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.