Check readme codeblock (#325)

This commit is contained in:
Félix Saparelli 2022-06-16 23:18:31 +00:00
parent 5c2c80a6e0
commit d79a080ad1
2 changed files with 17 additions and 4 deletions

View File

@ -19,13 +19,13 @@ _The library which powers [Watchexec CLI](https://watchexec.github.io) and other
## Quick start
```rust
```rust ,no_run
use miette::{IntoDiagnostic, Result};
use watchexec::{
Watchexec,
action::{Action, Outcome},
config::{InitConfig, RuntimeConfig},
handler::PrintDebug,
handler::{Handler as _, PrintDebug},
};
#[tokio::main]
@ -64,13 +64,20 @@ async fn main() -> Result<()> {
Outcome::both(Outcome::Clear, Outcome::Start),
));
Ok::<(), std::io::Error>(())
Ok(())
// (not normally required! ignore this when implementing)
as std::result::Result<_, MietteStub>
}
});
let _ = we.main().await.into_diagnostic()?;
we.reconfigure(runtime);
we.main().await.into_diagnostic()?;
Ok(())
}
// ignore this! it's stuff to make the above code get checked by cargo doc tests!
struct YourConfigFormat; impl YourConfigFormat { async fn load_from_file(_: &str) -> std::result::Result<Self, MietteStub> { Ok(Self) } fn apply(&self, _: &mut RuntimeConfig) {} } use miette::Diagnostic; use thiserror::Error; #[derive(Debug, Error, Diagnostic)] #[error("stub")] struct MietteStub;
```

View File

@ -116,3 +116,9 @@ mod watchexec;
#[doc(inline)]
pub use crate::watchexec::{ErrorHook, Watchexec};
#[doc(hidden)]
pub mod readme_doc_check {
#[doc = include_str!("../README.md")]
pub struct Readme;
}