pub struct BorrowedFdWriter<'fd> { /* private fields */ }
Expand description
A core::fmt::Writer
that writes to a file descriptor via direct syscalls.
Its core::fmt::Write
implementation retries if interrupted by a signal,
and returns errors if the file is closed or the write returns other errors
(including EWOULDBLOCK
). In such cases, partial writes can occur.
To format a message with Rust’s formatting:
use rustix::fd::AsFd;
use core::fmt::Write;
let (_reader_fd, writer_fd) = rustix::pipe::pipe().unwrap();
let mut writer = BorrowedFdWriter::new(writer_fd.as_fd());
let x = 42;
write!(&mut writer, "{x}").unwrap();
Implementations§
Source§impl<'fd> BorrowedFdWriter<'fd>
impl<'fd> BorrowedFdWriter<'fd>
pub fn new(fd: BorrowedFd<'fd>) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<'fd> Freeze for BorrowedFdWriter<'fd>
impl<'fd> RefUnwindSafe for BorrowedFdWriter<'fd>
impl<'fd> Send for BorrowedFdWriter<'fd>
impl<'fd> Sync for BorrowedFdWriter<'fd>
impl<'fd> Unpin for BorrowedFdWriter<'fd>
impl<'fd> UnwindSafe for BorrowedFdWriter<'fd>
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