Commit Graph

18 Commits

Author SHA1 Message Date
Sprite 2301fda307 Fix errors caused by sync locks crossing `await` in `cli::authenticate` 2023-01-20 16:55:26 -05:00
Matthias Beyer 02de9f5d32 Fix: Remove unused import
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 53447d1f48 Fix: Pass arguments in right order
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 5d445d2708 Fix clippy: Remove unnecessary Ok + ? operator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 88ba4c0894 Fix clippy: Remove unnecessary Ok + ? operator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 10:59:42 -05:00
Matthias Beyer 00c390f56b fixup! Add error variant for when not all bytes are written 2023-01-03 07:13:25 -05:00
D. Scott Boggs 1e4b2e0adb use serde_json's to_writer 2023-01-03 07:13:25 -05:00
Matthias Beyer dbbdb8e5c0 Add error variant for when not all bytes are written
cargo-clippy tells us that the `crate::helpers::json::to_writer` and
`crate::helpers::toml::to_writer` functions were implemented without
checking the return value of the `write()` function called inside.

That might lead to serious issues on the user site, if indeed not all
bytes were written.

This patch fixes the issue of the user not knowning about the issue by
introducing a new error variant and returning it in case of unfinished
writes.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2023-01-03 07:13:25 -05:00
Matthias Beyer c689b8390c Run cargo-fmt on whole codebase
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-29 07:14:00 -05:00
Matthias Beyer 963a3323ea Optimize: Remove clone() call
This patch makes the `Headers` helper type that is only used to be able
to implement Serialize on it only contain a reference to the actual
headers. This way we don't need to clone() the object returned by
`reqwest::Repsonse::headers()`.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2022-12-29 05:58:30 -05:00
D. Scott Boggs ed497d96d4 Improve remote error handling 2022-12-23 12:18:03 -05:00
D. Scott Boggs 2ec3bd42ec Rename elefren to mastodon-async 2022-12-23 12:18:03 -05:00
D. Scott Boggs c811f42054 misc fixups 2022-12-18 16:06:30 -05:00
D. Scott Boggs 648de8c8e5 Add read_response helper
This fixes a bug where a chunked response would be partially read and then hang forever waiting for another chunk, and adds additional debug logging to the request process.
2022-12-07 16:21:00 -05:00
D. Scott Boggs c9fc25a0c9 add logging 2022-12-07 15:58:28 -05:00
D. Scott Boggs e69d92f71e Update client to work asynchronously
- Use reqwest's async client
 - Convert items_iter() to a futures::Stream
 - make Mastodon client an Arc smart pointer, removing the need for OwnedPage.
 - remove MastodonClient and HttpSender traits; these can be re-added once async trait fns are stabilized
 - make EventStream a futures::Stream
2022-12-05 10:35:29 -05:00
D. Scott Boggs f054c7d805 Update Rust Edition; Update dependencies
Async needs added
2022-11-29 18:50:29 -05:00
D. Scott Boggs 96b16c62d9 initial state; elefren 0.22.0 2022-11-27 09:44:43 -05:00