fiscalprinter 1.0.2

A Fiscal Printer trait for implementation
Documentation
//  Struct for Printer Setup
#[derive(Debug)]
pub struct Setup {
    uuid: String, 
    printer_name: String,
}

impl BaseDocument for Setup {
    fn new(uuid: String, printer_name: String) -> Self {
        Setup { uuid: uuid, printer_name: printer_name }
    }

    fn get_uuid(&self) -> String {
        return self.uuid.clone();
    }

    fn get_printer_name(&self) -> String {
        return self.printer_name.clone();
    }
}

#[derive(Debug)]
pub struct PrinterResult {
    pub uuid: String, 
    pub printer_name: String,
    pub last_invoice_no: String, 
    pub last_credit_memo_no: String,
    pub last_debit_memo_no: String, 
    pub last_non_fiscal_no: String,
    pub last_closing_no: String,
}

impl PrinterResult {

    pub fn get_uuid(&self) -> String {
        return self.uuid.clone();
    }

    pub fn get_printer_name(&self) -> String {
        return self.printer_name.clone();
    }
}

//  Struct for Report
#[derive(Debug)]
pub struct Report {
    uuid: String, 
    printer_name: String,
}

impl BaseDocument for Report {
    fn new(uuid: String, printer_name: String) -> Self {
        Report { uuid: uuid, printer_name: printer_name }
    }

    fn get_uuid(&self) -> String {
        return self.uuid.clone();
    }

    fn get_printer_name(&self) -> String {
        return self.printer_name.clone();
    }
}

//  Struct for Document
#[derive(Debug)]
pub struct Document {
    uuid: String, 
    printer_name: String,
}

impl BaseDocument for Document {
    fn new(uuid: String, printer_name: String) -> Self {
        Document { uuid: uuid, printer_name: printer_name }
    }

    fn get_uuid(&self) -> String {
        return self.uuid.clone();
    }

    fn get_printer_name(&self) -> String {
        return self.printer_name.clone();
    }
}

pub trait FiscalPrinter {
    //  New Instance
    fn new() -> Self;
    //  Open specific port and return a instance
    fn open_port(&self, _port: String) -> bool;
    //  Send a command
    fn send_command(&self, _command: String) -> bool;
    //  Setup
    fn setup(&self, _setup: Setup) -> PrinterResult;
    //  Print Report
    fn print_report(&self, _report: Report) -> PrinterResult;
    //  Print Report
    fn print_document(&self, _document: Document) -> PrinterResult;
    //  Close port
    fn close_port(&self) -> bool;
}

pub trait BaseDocument {
    //  New Instance
    fn new(uuid: String, printer_name: String) -> Self;
    //  Implementation for UUID
    fn get_uuid(&self) -> String;
    //  Printer Name
    fn get_printer_name(&self) -> String;
}