doc: Add doc draft with simple example

This commit is contained in:
Jill 2022-05-10 17:42:56 +02:00
parent 59c7ff0fec
commit 40c680fa1f
Signed by untrusted user: KokaKiwi
GPG key ID: 09A5A2688F13FAC1
3 changed files with 25 additions and 1 deletions

22
doc/draft.md Normal file
View 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

View file

@ -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(())
} }

View file

@ -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>),
} }