pub struct View {
pub format: OutputFormat,
pub color: ColorMode,
pub quiet: bool,
}Expand description
How to present a model. JSON never contains ANSI.
Fields§
§format: OutputFormatPretty or JSON.
color: ColorModeANSI policy for pretty output.
quiet: boolSuppress successful pretty output.
Implementations§
Source§impl View
impl View
Sourcepub fn new(format: OutputFormat, color: ColorMode) -> Self
pub fn new(format: OutputFormat, color: ColorMode) -> Self
Build a view that prints successes.
Sourcepub fn show(self, value: &(impl Serialize + Render)) -> Result<()>
pub fn show(self, value: &(impl Serialize + Render)) -> Result<()>
JSON writes the model. Pretty writes Render::render_pretty.
Sourcepub fn show_pretty<T: Pretty>(self, value: &T) -> Result<()>
pub fn show_pretty<T: Pretty>(self, value: &T) -> Result<()>
JSON writes the model. Pretty renders Pretty::TEMPLATE against it.
Sourcepub fn show_template(self, value: &impl Serialize, template: &str) -> Result<()>
pub fn show_template(self, value: &impl Serialize, template: &str) -> Result<()>
JSON writes the model. Pretty renders template against it.
Sourcepub fn emit(self, value: &impl Serialize, pretty: &str) -> Result<()>
pub fn emit(self, value: &impl Serialize, pretty: &str) -> Result<()>
JSON writes value. Pretty writes pretty (already styled or plain).
Trait Implementations§
impl Copy for View
impl Eq for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl Freeze for View
impl RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl UnsafeUnpin for View
impl UnwindSafe for View
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