pub struct PrintService { /* private fields */ }Expand description
Struct to manage the printing service, including printer handling and job processing.
Implementations§
Source§impl PrintService
impl PrintService
Sourcepub async fn send_to_printer(
&self,
printer_name: &str,
data: &[u8],
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn send_to_printer( &self, printer_name: &str, data: &[u8], ) -> Result<(), Box<dyn Error + Send + Sync>>
Envía datos raw a la impresora usando printer.print() directamente
Sourcepub async fn open_drawer(&self, printer_name: &str) -> (i32, String)
pub async fn open_drawer(&self, printer_name: &str) -> (i32, String)
Función específica para abrir cajón (wrapper más semántico)
Sourcepub async fn _find_printer(&self, printer_name: &str) -> Option<Printer>
pub async fn _find_printer(&self, printer_name: &str) -> Option<Printer>
Trait Implementations§
Source§impl Clone for PrintService
impl Clone for PrintService
Source§impl Service for PrintService
impl Service for PrintService
Source§fn run<'life0, 'async_trait>(
&'life0 self,
action: Value,
_write: WebSocketWrite,
) -> Pin<Box<dyn Future<Output = (i32, String)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
action: Value,
_write: WebSocketWrite,
) -> Pin<Box<dyn Future<Output = (i32, String)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes a print service action based on the provided JSON input.
§Arguments
action- A JSON value containing the action details._write- AWebSocketWrite(unused in this implementation).
§Returns
A tuple containing:
i32- Status code (0 for success, 1 for failure).String- A descriptive message about the action result. If the action takes longer than 2 seconds, returns an asynchronous processing message.
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Converts the service instance into a dyn Any reference.
§Returns
A reference to dyn Any for dynamic type checks.
Source§fn stop_service(&self)
fn stop_service(&self)
Stops the print service, performing any necessary cleanup tasks.
Source§fn get_version(&self) -> String
fn get_version(&self) -> String
Retrieves the current version of the PrintService.
§Returns
A String containing the version of the service.
Auto Trait Implementations§
impl Freeze for PrintService
impl !RefUnwindSafe for PrintService
impl Send for PrintService
impl Sync for PrintService
impl Unpin for PrintService
impl !UnwindSafe for PrintService
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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