pub struct Palette { /* private fields */ }
Implementations§
source§impl Palette
impl Palette
sourcepub fn color() -> Self
pub fn color() -> Self
Examples found in repository?
examples/diff.rs (line 20)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let mut args = std::env::args();
let _ = args.next().expect("expects `$ diff <old> <new>`");
let old_path = args.next().expect("expects `$ diff <old> <new>`");
let new_path = args.next().expect("expects `$ diff <old> <new>`");
if args.next().is_some() {
panic!("expects `$ diff <old> <new>`");
}
let old = snapbox::Data::text(std::fs::read_to_string(&old_path).unwrap());
let new = snapbox::Data::text(std::fs::read_to_string(&new_path).unwrap());
let mut output = String::new();
snapbox::report::write_diff(
&mut output,
&old,
&new,
Some(&old_path),
Some(&new_path),
snapbox::report::Palette::color(),
)
.unwrap();
println!("{output}");
}
pub fn plain() -> Self
pub fn always() -> Self
👎Deprecated since 0.4.9: Renamed to `Palette::color
pub fn never() -> Self
👎Deprecated since 0.4.9: Renamed to `Palette::plain
pub fn auto() -> Self
👎Deprecated since 0.4.9: Use
Palette::always
, auto
behavior is now implicitpub fn info<D: Display>(self, item: D) -> Styled<D>
pub fn warn<D: Display>(self, item: D) -> Styled<D>
pub fn error<D: Display>(self, item: D) -> Styled<D>
pub fn hint<D: Display>(self, item: D) -> Styled<D>
pub fn expected<D: Display>(self, item: D) -> Styled<D>
pub fn actual<D: Display>(self, item: D) -> Styled<D>
Trait Implementations§
impl Copy for Palette
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnwindSafe for Palette
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