1use thiserror::Error;
5
6#[cfg(feature = "async")]
7pub mod asynchronous;
8mod blocking;
9pub mod parser;
10
11pub use blocking::*;
13
14const BLKSIZE: usize = 512;
15
16enum State {
17 Send,
18 SendAgain,
19 Recv,
20}
21
22#[derive(Debug, Error)]
23pub enum Error {
24 #[error("Bad filename (not a valid CString)")]
25 BadFilename,
26 #[error("Socket IO error - `{0}`")]
27 SocketIo(std::io::Error),
28 #[error("Timeout while trying to complete transaction")]
29 Timeout,
30 #[error("Failed to parse incoming packet - `{0}`")]
31 Parse(parser::Error),
32 #[error("The packet we got back was unexpected")]
33 UnexpectedPacket(parser::Packet),
34 #[error("The protocol itself gave us an error with code `{code:?}`and msg `{msg}`")]
35 Protocol {
36 code: parser::ErrorCode,
37 msg: String,
38 },
39}