601ec251f8
This patch adds support for multiple rustdoc output formats to the test suite. This is a preparation for adding support for rustdoc’s JSON output.
143 lines
3.2 KiB
Plaintext
143 lines
3.2 KiB
Plaintext
---
|
||
source: tests/output.rs
|
||
expression: "get_stdout(&[item])"
|
||
---
|
||
log Struct log::Metadata rusty-man
|
||
|
||
SYNOPSIS
|
||
pub struct Metadata<'a> { /* fields omitted */ }
|
||
|
||
DESCRIPTION
|
||
Metadata about a log message.
|
||
|
||
# Use
|
||
|
||
`Metadata` structs are created when users of the library use logging macros.
|
||
|
||
They are consumed by implementations of the `Log` trait in the `enabled` method.
|
||
|
||
`Record`s use `Metadata` to determine the log message's severity and target.
|
||
|
||
Users should use the `log_enabled!` macro in their code to avoid constructing expensive log
|
||
messages.
|
||
|
||
# Examples
|
||
|
||
ⓘThis code runs with edition 2018
|
||
use log::{Record, Level, Metadata};
|
||
struct MyLogger;
|
||
impl log::Log for MyLogger {
|
||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||
metadata.level() <= Level::Info
|
||
}
|
||
fn log(&self, record: &Record) {
|
||
if self.enabled(record.metadata()) {
|
||
println!("{} - {}", record.level(), record.args());
|
||
}
|
||
}
|
||
fn flush(&self) {}
|
||
}
|
||
|
||
METHODS
|
||
impl<'a> Metadata<'a>
|
||
builder
|
||
pub fn builder() -> MetadataBuilder<'a>
|
||
|
||
Returns a new builder.
|
||
|
||
level
|
||
pub fn level(&self) -> Level
|
||
|
||
The verbosity level of the message.
|
||
|
||
target
|
||
pub fn target(&self) -> &'a str
|
||
|
||
The name of the target of the directive.
|
||
|
||
IMPLEMENTATIONS
|
||
Trait Implementations
|
||
Clone
|
||
impl<'a> Clone for Metadata<'a>
|
||
|
||
Debug
|
||
impl<'a> Debug for Metadata<'a>
|
||
|
||
Eq
|
||
impl<'a> Eq for Metadata<'a>
|
||
|
||
Hash
|
||
impl<'a> Hash for Metadata<'a>
|
||
|
||
Ord
|
||
impl<'a> Ord for Metadata<'a>
|
||
|
||
PartialEq
|
||
impl<'a> PartialEq<Metadata<'a>> for Metadata<'a>
|
||
|
||
PartialOrd
|
||
impl<'a> PartialOrd<Metadata<'a>> for Metadata<'a>
|
||
|
||
StructuralEq
|
||
impl<'a> StructuralEq for Metadata<'a>
|
||
|
||
StructuralPartialEq
|
||
impl<'a> StructuralPartialEq for Metadata<'a>
|
||
|
||
Auto Trait Implementations
|
||
RefUnwindSafe
|
||
impl<'a> RefUnwindSafe for Metadata<'a>
|
||
|
||
Send
|
||
impl<'a> Send for Metadata<'a>
|
||
|
||
Sync
|
||
impl<'a> Sync for Metadata<'a>
|
||
|
||
Unpin
|
||
impl<'a> Unpin for Metadata<'a>
|
||
|
||
UnwindSafe
|
||
impl<'a> UnwindSafe for Metadata<'a>
|
||
|
||
Blanket Implementations
|
||
Any
|
||
impl<T> Any for T
|
||
where
|
||
T: 'static + ?Sized,
|
||
|
||
Borrow
|
||
impl<T> Borrow<T> for T
|
||
where
|
||
T: ?Sized,
|
||
|
||
BorrowMut
|
||
impl<T> BorrowMut<T> for T
|
||
where
|
||
T: ?Sized,
|
||
|
||
From
|
||
impl<T> From<T> for T
|
||
|
||
Into
|
||
impl<T, U> Into<U> for T
|
||
where
|
||
U: From<T>,
|
||
|
||
ToOwned
|
||
impl<T> ToOwned for T
|
||
where
|
||
T: Clone,
|
||
|
||
TryFrom
|
||
impl<T, U> TryFrom<U> for T
|
||
where
|
||
U: Into<T>,
|
||
|
||
TryInto
|
||
impl<T, U> TryInto<U> for T
|
||
where
|
||
U: TryFrom<T>,
|
||
|
||
|