pub struct Archive { /* private fields */ }Expand description
What the export export returns, as Archive::to_json, for a format whose manifest entry sets
output = "archive": files Hammer zips in the order they were added.
A path is relative, with / between its segments: not empty, not starting with /, no \, no
empty segment (so no // or trailing /), no . or .. segment, and not a path already added.
Adding a file with any other path fails, naming it, as Hammer would refuse the reply.
Implementations§
Source§impl Archive
impl Archive
Sourcepub fn text(
&mut self,
path: impl Into<String>,
text: impl Into<String>,
) -> Result<&mut Archive>
pub fn text( &mut self, path: impl Into<String>, text: impl Into<String>, ) -> Result<&mut Archive>
Adds text as the file at path, written as UTF-8.
Sourcepub fn bytes(
&mut self,
path: impl Into<String>,
bytes: &[u8],
) -> Result<&mut Archive>
pub fn bytes( &mut self, path: impl Into<String>, bytes: &[u8], ) -> Result<&mut Archive>
Adds bytes as the file at path.
Sourcepub fn base64(
&mut self,
path: impl Into<String>,
encoded: impl Into<String>,
) -> Result<&mut Archive>
pub fn base64( &mut self, path: impl Into<String>, encoded: impl Into<String>, ) -> Result<&mut Archive>
Adds the file at path whose bytes encoded holds as standard padded base64, passed on without
decoding it, for base64 a plugin kept itself; Hammer fails the export when it is not base64.
Sourcepub fn image(
&mut self,
path: impl Into<String>,
image: impl ArchiveImage,
) -> Result<&mut Archive>
pub fn image( &mut self, path: impl Into<String>, image: impl ArchiveImage, ) -> Result<&mut Archive>
Adds an image of Request::images as the file at path, named by its id: 5 or &image. Hammer
writes its bytes, so the reply carries none; an id it did not send fails the export.