#[non_exhaustive]pub enum OutputDestination {
File(String),
Writer(Box<dyn Write>),
Stdout,
}Expand description
Output destination for HTML generation.
Specifies where the generated HTML content should be written.
§Examples
Writing HTML to a file:
use std::fs::File;
use html_generator::OutputDestination;
let output = OutputDestination::File("output.html".to_string());Writing HTML to an in-memory buffer:
use std::io::Cursor;
use html_generator::OutputDestination;
let buffer = Cursor::new(Vec::new());
let output = OutputDestination::Writer(Box::new(buffer));Writing HTML to standard output:
use html_generator::OutputDestination;
let output = OutputDestination::Stdout;Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
File(String)
Write output to a file at the specified path.
§Example
use html_generator::OutputDestination;
let output = OutputDestination::File("output.html".to_string());Writer(Box<dyn Write>)
Write output using a custom writer implementation.
This can be used for in-memory buffers, network streams, or other custom output destinations.
§Example
use std::io::Cursor;
use html_generator::OutputDestination;
let buffer = Cursor::new(Vec::new());
let output = OutputDestination::Writer(Box::new(buffer));Stdout
Write output to standard output (default).
This is useful for command-line tools and scripts.
§Example
use html_generator::OutputDestination;
let output = OutputDestination::Stdout;Trait Implementations§
Source§impl Debug for OutputDestination
Debug implementation for OutputDestination.
impl Debug for OutputDestination
Debug implementation for OutputDestination.
Source§impl Default for OutputDestination
Default implementation for OutputDestination.
impl Default for OutputDestination
Default implementation for OutputDestination.
Auto Trait Implementations§
impl !RefUnwindSafe for OutputDestination
impl !Send for OutputDestination
impl !Sync for OutputDestination
impl !UnwindSafe for OutputDestination
impl Freeze for OutputDestination
impl Unpin for OutputDestination
impl UnsafeUnpin for OutputDestination
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