pub struct PrinterClass<'d, D: Driver<'d>> { /* private fields */ }Expand description
USB Printer Device class.
Implementations§
Source§impl<'d, D: Driver<'d>> PrinterClass<'d, D>
impl<'d, D: Driver<'d>> PrinterClass<'d, D>
Sourcepub fn new(
builder: &mut Builder<'d, D>,
state: &'d mut State<'d>,
config: Config<'d>,
) -> Self
pub fn new( builder: &mut Builder<'d, D>, state: &'d mut State<'d>, config: Config<'d>, ) -> Self
Create a new USB Printer device class.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, EndpointError>
Read incoming print job data sent by the USB host.
Sourcepub async fn write(&mut self, buf: &[u8]) -> Result<(), EndpointDisabledError>
pub async fn write(&mut self, buf: &[u8]) -> Result<(), EndpointDisabledError>
Write status or response data back to the USB host.
Sourcepub fn set_port_status(&self, status: PortStatus)
pub fn set_port_status(&self, status: PortStatus)
Update the printer port status returned by GET_PORT_STATUS.
Sourcepub fn check_soft_reset(&self) -> bool
pub fn check_soft_reset(&self) -> bool
Check if the host issued a SOFT_RESET request, clearing the flag.
Sourcepub fn split(self) -> (PrinterReader<'d, D>, PrinterWriter<'d, D>)
pub fn split(self) -> (PrinterReader<'d, D>, PrinterWriter<'d, D>)
Split into independent reader and writer halves.
Trait Implementations§
Source§impl<'d, D: Driver<'d>> ErrorType for PrinterClass<'d, D>
Available on crate feature embedded-io only.
impl<'d, D: Driver<'d>> ErrorType for PrinterClass<'d, D>
Available on crate feature
embedded-io only.Source§type Error = PrinterError
type Error = PrinterError
Error type of all the IO operations on this type.
Source§impl<'d, D: Driver<'d>> Read for PrinterClass<'d, D>
Available on crate feature embedded-io only.
impl<'d, D: Driver<'d>> Read for PrinterClass<'d, D>
Available on crate feature
embedded-io only.Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf. Read moreSource§impl<'d, D: Driver<'d>> Write for PrinterClass<'d, D>
Available on crate feature embedded-io only.
impl<'d, D: Driver<'d>> Write for PrinterClass<'d, D>
Available on crate feature
embedded-io only.Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Auto Trait Implementations§
impl<'d, D> Forget for PrinterClass<'d, D>
impl<'d, D> Freeze for PrinterClass<'d, D>
impl<'d, D> Move for PrinterClass<'d, D>
impl<'d, D> RefUnwindSafe for PrinterClass<'d, D>
impl<'d, D> Send for PrinterClass<'d, D>
impl<'d, D> Sync for PrinterClass<'d, D>
impl<'d, D> Unpin for PrinterClass<'d, D>
impl<'d, D> UnsafeUnpin for PrinterClass<'d, D>
impl<'d, D> UnwindSafe for PrinterClass<'d, D>
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