]>
git.proxmox.com Git - cargo.git/blob - vendor/env_logger/src/fmt/writer/termcolor/shim_impl.rs
3 use fmt
::{WriteStyle, Target}
;
5 pub(in ::fmt
::writer
) mod glob
{
9 pub(in ::fmt
::writer
) struct BufferWriter
{
13 pub(in ::fmt
) struct Buffer(Vec
<u8>);
16 pub(in ::fmt
::writer
) fn stderr(_is_test
: bool
, _write_style
: WriteStyle
) -> Self {
18 target
: Target
::Stderr
,
22 pub(in ::fmt
::writer
) fn stdout(_is_test
: bool
, _write_style
: WriteStyle
) -> Self {
24 target
: Target
::Stdout
,
28 pub(in ::fmt
::writer
) fn buffer(&self) -> Buffer
{
32 pub(in ::fmt
::writer
) fn print(&self, buf
: &Buffer
) -> io
::Result
<()> {
33 // This impl uses the `eprint` and `print` macros
34 // instead of using the streams directly.
35 // This is so their output can be captured by `cargo test`
36 let log
= String
::from_utf8_lossy(&buf
.0);
39 Target
::Stderr
=> eprint
!("{}", log
),
40 Target
::Stdout
=> print
!("{}", log
),
48 pub(in ::fmt
) fn clear(&mut self) {
52 pub(in ::fmt
) fn write(&mut self, buf
: &[u8]) -> io
::Result
<usize> {
57 pub(in ::fmt
) fn flush(&mut self) -> io
::Result
<()> {
62 pub(in ::fmt
) fn bytes(&self) -> &[u8] {