pub struct FileEntry {
pub contents: String,
pub contents_base64: Option<String>,
pub mode: Option<u32>,
}Fields§
§contents: StringFile contents, for text files. UTF-8. Mutually exclusive with
Self::contents_base64 — when the base64 field is set the
renderer writes those bytes and ignores this string.
contents_base64: Option<String>Base64-encoded raw bytes, for binary files (images, fonts,
audio). None for ordinary text files; when Some, the
renderer base64-decodes it and writes the resulting bytes
verbatim (so a PNG survives the JSON wire, which can’t carry
arbitrary bytes in a string). Carried as base64 rather than a
Vec<u8> so the PluginRequest / PluginResponse JSON
envelope stays valid UTF-8 across the subprocess boundary.
First consumer: whisker-asset, which bundles arbitrary
(often binary) app assets into the generated native projects.
mode: Option<u32>POSIX mode bits. None → engine default (0o644).
Implementations§
Source§impl FileEntry
impl FileEntry
Sourcepub fn binary(bytes: &[u8]) -> Self
pub fn binary(bytes: &[u8]) -> Self
A binary file: bytes are base64-encoded into
Self::contents_base64 so they survive the JSON envelope.
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>>
pub fn to_bytes(&self) -> Result<Vec<u8>>
Decode this entry to the raw bytes the renderer should write.
Returns the base64-decoded bytes when Self::contents_base64
is set, otherwise the UTF-8 Self::contents as bytes.