mirror of https://github.com/zkat/miette.git
docs: add docs for handler options
This commit is contained in:
parent
e52996bdf4
commit
47e4d4d05c
21
README.md
21
README.md
|
|
@ -41,6 +41,7 @@ and such might not want.
|
|||
- [... in `main()`](#-in-main)
|
||||
- [... diagnostic code URLs](#-diagnostic-code-urls)
|
||||
- [... snippets](#-snippets)
|
||||
- [... handler options](#-handler-options)
|
||||
- [Acknowledgements](#acknowledgements)
|
||||
- [License](#license)
|
||||
|
||||
|
|
@ -353,6 +354,26 @@ pub struct MyErrorType {
|
|||
}
|
||||
```
|
||||
|
||||
### ... handler options
|
||||
|
||||
[MietteHandler] is the default handler, and is very customizable. In most
|
||||
cases, you can simply use [MietteHandlerOptions] to tweak its behavior instead
|
||||
of falling back to your own custom handler.
|
||||
|
||||
Usage is like so:
|
||||
|
||||
```rust
|
||||
miette::set_hook(|_| {
|
||||
MietteHandlerOpts::new()
|
||||
.terminal_links(true)
|
||||
.unicode(false)
|
||||
.context_lines(3)
|
||||
.build()
|
||||
})
|
||||
```
|
||||
|
||||
See the docs for [MietteHandlerOptions] for more details on what you can customize!
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
`miette` was not developed in a void. It owes enormous credit to various other projects and their authors:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,18 @@ use crate::ThemeStyles;
|
|||
|
||||
/**
|
||||
Create a custom [MietteHandler] from options.
|
||||
|
||||
## Example
|
||||
|
||||
```no_run
|
||||
miette::set_hook(|_| {
|
||||
MietteHandlerOpts::new()
|
||||
.terminal_links(true)
|
||||
.unicode(false)
|
||||
.context_lines(3)
|
||||
.build()
|
||||
})
|
||||
```
|
||||
*/
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct MietteHandlerOpts {
|
||||
|
|
|
|||
Loading…
Reference in New Issue