}
/// awaitable version of `poll_position`.
-async fn seq_read_position<T: SeqRead + ?Sized>(
- input: &mut T,
-) -> Option<io::Result<u64>> {
+async fn seq_read_position<T: SeqRead + ?Sized>(input: &mut T) -> Option<io::Result<u64>> {
poll_fn(|cx| unsafe { Pin::new_unchecked(&mut *input).poll_position(cx) }).await
}
Ok(Some(self.entry.take()))
} else {
- io_bail!(
- "expected pxar entry of type 'Entry', got: {}",
- header,
- );
+ io_bail!("expected pxar entry of type 'Entry', got: {}", header,);
}
}
let header = format::Header::with_content_size(htype, data.len() as u64);
header.check_header_size()?;
- seq_write_struct(
- &mut *output,
- header,
- )
- .await?;
+ seq_write_struct(&mut *output, header).await?;
seq_write_all(output, data).await
}
let header = format::Header::with_content_size(htype, 1 + data.len() as u64);
header.check_header_size()?;
- seq_write_struct(
- &mut *output,
- header,
- )
- .await?;
+ seq_write_struct(&mut *output, header).await?;
seq_write_all(&mut *output, data).await?;
seq_write_all(output, &[0u8]).await
}
let header = format::Header::with_content_size(format::PXAR_PAYLOAD, file_size);
header.check_header_size()?;
- seq_write_struct(
- &mut self.output,
- header,
- )
- .await?;
+ seq_write_struct(&mut self.output, header).await?;
let payload_data_offset = seq_write_position(&mut self.output).await?;
}
if self.content_size() > self.max_content_size() {
- io_bail!("invalid content size ({} > {}) of entry with {}", self.content_size(), self.max_content_size(), self);
+ io_bail!(
+ "invalid content size ({} > {}) of entry with {}",
+ self.content_size(),
+ self.max_content_size(),
+ self
+ );
}
Ok(())
}
unsafe fn ignore_drop(_: *const ()) {}
-pub const MAX_PATH_LEN:u64 = 4 * 1024;
+pub const MAX_PATH_LEN: u64 = 4 * 1024;
// let's play it safe
-pub const MAX_FILENAME_LEN:u64 = MAX_PATH_LEN;
+pub const MAX_FILENAME_LEN: u64 = MAX_PATH_LEN;
// name + attr
-pub const MAX_XATTR_LEN:u64 = 255 + 64*1024;
+pub const MAX_XATTR_LEN: u64 = 255 + 64 * 1024;
pub fn validate_filename(name: &[u8]) -> io::Result<()> {
if name.is_empty() {