forked from KokaKiwi/boitalettres
doc: Add doc draft with simple example
This commit is contained in:
parent
59c7ff0fec
commit
40c680fa1f
3 changed files with 25 additions and 1 deletions
22
doc/draft.md
Normal file
22
doc/draft.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Just Enough Doc
|
||||||
|
|
||||||
|
## Rum `simple` example
|
||||||
|
|
||||||
|
This example is meant to show basic service-based IMAP server with boitalettres library.
|
||||||
|
|
||||||
|
- [Source code](../examples/simple.rs)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cargo run --example simple
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Basic python testing script](../scripts/test_imap.py)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ python scripts/test_imap.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
- [`imap-codec`](https://docs.rs/imap-codec): IMAP protocol model+encoder/decoder
|
||||||
|
- [`tower`](https://docs.rs/tower): Service-based request handling library
|
|
@ -26,7 +26,7 @@ async fn main() -> eyre::Result<()> {
|
||||||
});
|
});
|
||||||
|
|
||||||
let server = Server::new(incoming).serve(make_service);
|
let server = Server::new(incoming).serve(make_service);
|
||||||
let _ = server.await;
|
let _ = server.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,9 @@ mod service;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum Error<A> {
|
pub enum Error<A> {
|
||||||
|
#[error("Error occured when accepting new connections")]
|
||||||
Accept(#[source] A),
|
Accept(#[source] A),
|
||||||
|
#[error("Error occured on service creation")]
|
||||||
MakeService(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
|
MakeService(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue