pub struct CharDevice<'a> { /* private fields */ }
Expand description
Providing regular device operation for non-block device
Implementations§
Source§impl<'a> CharDevice<'a>
impl<'a> CharDevice<'a>
Sourcepub fn new(device: &'a mut Device) -> Result<Self>
pub fn new(device: &'a mut Device) -> Result<Self>
Create a CharDevice for reading and writing non-block device.
If device
is DeviceType::RT_Device_Class_Block,
the method will return RtError::NoSys
.
Trait Implementations§
Source§impl Read for CharDevice<'_>
impl Read for CharDevice<'_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were
read. Read more
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::ReadError>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::ReadError>>
Read the exact number of bytes required to fill
buf
. Read moreSource§fn available_bytes(&self, _at_least: usize) -> bool
fn available_bytes(&self, _at_least: usize) -> bool
Hints whether there are at least
at_least
bytes available. Read moreSource§impl Seek for CharDevice<'_>
impl Seek for CharDevice<'_>
Source§impl Write for CharDevice<'_>
impl Write for CharDevice<'_>
Source§type WriteError = RtError
type WriteError = RtError
Value of this type is returned when
write()
fails. Read moreSource§type FlushError = RtError
type FlushError = RtError
Value of this type is returned when
flush()
fails.
In case of low-level writers flush often does nothing and therefore doesn’t return error,
so this type might be Void. Read moreSource§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this object, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their
destination. Read more
Source§fn size_hint(&mut self, _bytes: usize)
fn size_hint(&mut self, _bytes: usize)
Hints the writer how much bytes will be written after call to this function.
If the maximum amount of bytes to be written is known then it should be passed as argument.
If the maximum amount is unknown, then minimum should be passed. Read more
Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::WriteError>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::WriteError>
Attempts to write an entire buffer into this
Write
.Source§fn uses_size_hint(&self) -> bool
fn uses_size_hint(&self) -> bool
Reports to the caller whether size hint is actually used. This can prevent costly
computation of size hint that would be thrown away.
Auto Trait Implementations§
impl<'a> Freeze for CharDevice<'a>
impl<'a> RefUnwindSafe for CharDevice<'a>
impl<'a> !Send for CharDevice<'a>
impl<'a> !Sync for CharDevice<'a>
impl<'a> Unpin for CharDevice<'a>
impl<'a> !UnwindSafe for CharDevice<'a>
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