mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
Add library and deadline documentation
This commit is contained in:
parent
8abb177984
commit
7d8858f57c
1 changed files with 36 additions and 0 deletions
|
@ -295,9 +295,45 @@ codec, this can be enabled by removing the video_codec and audio_codec configura
|
|||
|
||||
### Library API Changes
|
||||
|
||||
The library API for pict-rs has changed from 0.4. It now follows a "fluent programming" pattern of
|
||||
chaining methods to configure and launch the service from within another application. Documentation
|
||||
for the new library API can be found on [docs.rs](https://docs.rs/pict-rs)
|
||||
|
||||
For most cases, using pict-rs' `ConfigSource` as the entrypoint is recommended.
|
||||
|
||||
As a quick example,
|
||||
```rust
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
pict_rs::ConfigSource::memory(serde_json::json!({
|
||||
"server": {
|
||||
"address": "127.0.0.1:8080"
|
||||
},
|
||||
"repo": {
|
||||
"type": "sled",
|
||||
"path": "./sled-repo"
|
||||
},
|
||||
"store": {
|
||||
"type": "filesystem",
|
||||
"path": "./files"
|
||||
}
|
||||
}))
|
||||
.init::<&str>(None)?
|
||||
.run_on_localset()
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Reject Malformed Deadlines
|
||||
|
||||
pict-rs supports setting a request deadline with the `X-Request-Deadline` header, where the value is
|
||||
a unix timestamp in nanoseconds. In pict-rs 0.4, requests with deadlines that could not be parsed
|
||||
were treated as requests without deadlines. in pict-rs 0.5 a malformed deadline will cause the
|
||||
request to be rejected with a 400 Bad Request error.
|
||||
|
||||
|
||||
### Logging Verbosity
|
||||
|
||||
|
|
Loading…
Reference in a new issue