pub struct NixWrite<W> {
pub inner: W,
}
Expand description
A wrapper around a std::io::Write
, adding support for the nix wire format.
Fields§
§inner: W
Implementations§
Source§impl<W: Write> NixWrite<W>
impl<W: Write> NixWrite<W>
Sourcepub fn write_string(&mut self, s: &[u8]) -> Result<()>
pub fn write_string(&mut self, s: &[u8]) -> Result<()>
Write a “string” (really, a byte buffer) to the wire.
Sourcepub fn write_nix(&mut self, data: &impl Serialize) -> Result<()>
pub fn write_nix(&mut self, data: &impl Serialize) -> Result<()>
Write any serializable type to the wire.
Warning: don’t call this with [u8]
data: that will (attempt to)
serialize a sequence of u8
s, and then panic because the nix wire
protocol only supports 64-bit integers. If you want to write a byte
buffer, use NixWrite::write_string
instead.
Auto Trait Implementations§
impl<W> Freeze for NixWrite<W>where
W: Freeze,
impl<W> RefUnwindSafe for NixWrite<W>where
W: RefUnwindSafe,
impl<W> Send for NixWrite<W>where
W: Send,
impl<W> Sync for NixWrite<W>where
W: Sync,
impl<W> Unpin for NixWrite<W>where
W: Unpin,
impl<W> UnwindSafe for NixWrite<W>where
W: UnwindSafe,
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