AsyncWriterExt

Trait AsyncWriterExt 

Source
pub trait AsyncWriterExt
where 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>>;
}
Available on crate feature tokio only.
Expand description

Trait to add async epson methods.

Required Associated Types§

Source

type Write: AsyncWrite

Inner type of the Async writer

Required Methods§

Source

fn open( model: Model, w: Self::Write, ) -> impl Future<Output = Result<Self, Error>>

Create a new Writer, wrapping the provided tokio::io::AsyncWrite.

Source

fn init(&mut self) -> impl Future<Output = Result<(), Error>>

initialize the epson printer

Source

fn cut(&mut self) -> impl Future<Output = Result<(), Error>>

cut the printer paper

Source

fn set_unicode(&mut self) -> impl Future<Output = Result<(), Error>>

Set unicode mode on the printer, if supported.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn justify( &mut self, alignment: Alignment, ) -> impl Future<Output = Result<(), Error>>

Set the horizontal justification of the text printed after this command.

Source

fn feed(&mut self, count: u8) -> impl Future<Output = Result<(), Error>>

Feed the specified number of lines out of the printer.

Source

fn speed(&mut self, speed: u8) -> impl Future<Output = Result<(), Error>>

Set the printer speed to the provided value.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn write_command( &mut self, cmd: Command, ) -> impl Future<Output = Result<(), Error>>

Send a raw command to the Epson printer.

Source

fn write_all(&mut self, buf: &[u8]) -> impl Future<Output = Result<(), Error>>

Write the full buffer buf to the underlying socket.

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.

Implementors§

Source§

impl<WriteT> AsyncWriterExt for Writer<WriteT>
where WriteT: Unpin + Send + AsyncWrite,

Source§

type Write = WriteT