6dc75f0c5d
This patch adds tests for Rust 1.54.0, 1.55.0 and 1.56.0. To make the tests pass, we have to take care of some changes like more details elements and changed heading levels. To make it easier to generate the tests for new Rust versions, we also add two bash scripts that take care of that.
144 lines
3.2 KiB
Plaintext
144 lines
3.2 KiB
Plaintext
---
|
||
source: tests/output.rs
|
||
expression: "get_stdout(path, &[\"log::Metadata\"])"
|
||
|
||
---
|
||
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
|
||
|
||
ⓘ
|
||
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>,
|
||
|
||
|