pub struct RenderedDocument { /* private fields */ }Expand description
A rendered DOCX document.
Wraps the generated ZIP bytes in memory, providing methods to write to a file or extract the raw bytes.
§Examples
let template = Template::from_path("template.docx")?;
let rendered = template.render(json!({"name": "Ada"}))?;
// Write to file
rendered.write_to_file("output.docx")?;
// Or get raw bytes
let bytes = rendered.as_bytes();Implementations§
Source§impl RenderedDocument
impl RenderedDocument
Sourcepub fn write_to_writer<W: Write>(self, writer: W) -> Result<()>
pub fn write_to_writer<W: Write>(self, writer: W) -> Result<()>
Write the rendered DOCX bytes to any Write sink.
Consumes the RenderedDocument.
§Errors
Returns an error if writing to the sink fails.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume the document and return the raw DOCX bytes.
Trait Implementations§
Source§impl AsRef<[u8]> for RenderedDocument
impl AsRef<[u8]> for RenderedDocument
Source§impl Debug for RenderedDocument
impl Debug for RenderedDocument
Source§impl From<RenderedDocument> for Vec<u8>
impl From<RenderedDocument> for Vec<u8>
Source§fn from(document: RenderedDocument) -> Self
fn from(document: RenderedDocument) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for RenderedDocument
impl Freeze for RenderedDocument
impl Move for RenderedDocument
impl RefUnwindSafe for RenderedDocument
impl Send for RenderedDocumentwhere
RawVecInner: Send,
impl Sync for RenderedDocumentwhere
RawVecInner: Sync,
impl Unpin for RenderedDocument
impl UnsafeUnpin for RenderedDocument
impl UnwindSafe for RenderedDocumentwhere
RawVecInner: 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