Commit Graph

28 Commits

Author SHA1 Message Date
Dirkjan Ochtman 0729f03003 Change Response::Other to more closely match RFC grammar 2022-10-11 22:08:29 +02:00
Dirkjan Ochtman 9fa64dee7a Parse into ReplyCode 2022-10-11 22:08:29 +02:00
Dirkjan Ochtman a3f2cdc5c0 Use a ReplyCode enum for reply codes 2022-10-10 18:36:47 +02:00
Zeeshan Ali 78785279c6 Declare open-ended enum types as non-exhaustive
So that future variant additions don't require API break.
2022-10-07 18:21:10 +02:00
Zeeshan Ali 6c6fa0f2ff Add typed support for `SIZE` parameter (RFC 1870)
This also makes `Parameter` type an enum so future type support for
other parameters can be more easily added. Note that the enum is
non-exhaustive so that future variant addtions would not cause API
breaks.
2022-10-07 18:21:10 +02:00
Zeeshan Ali 1065b44eef Use a char instead of single-char string
Fixes a clippy warning:

```
warning: single-character string constant used as pattern
  --> src/utils.rs:11:46
   |
11 |         escaped = Cow::Owned(escaped.replace("\"", "\\\""));
   |                                              ^^^^ help: try using a `char` instead: `'\"'`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
```
2022-10-07 18:21:10 +02:00
Zeeshan Ali 7fa3ffdd1d Drop a redundant closure
Fixes a clippy warning:

```
warning: redundant closure
  --> src/parse/mod.rs:70:9
   |
70 |         |s| unescape_quoted(s),
   |         ^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `unescape_quoted`
   |
   = note: `#[warn(clippy::redundant_closure)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
```
2022-10-07 18:21:10 +02:00
Zeeshan Ali 10a0d4fc6b Replace into_iter calls with iter
Ran `clippy --fix` to autofix another warning but it did this as well
and I thought why not.
2022-10-07 18:21:10 +02:00
Zeeshan Ali d2ff4a1cff Simplify a string parsing line
This fixes a clippy warning but does even better than suggested:

```
warning: this call to `from_str_radix` can be replaced with a call to `str::parse`
   --> src/parse/response.rs:119:13
    |
119 |         |s| u16::from_str_radix(s, 10),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `s.parse::<u16>()`
    |
    = note: `#[warn(clippy::from_str_radix_10)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10
```
2022-10-07 18:21:10 +02:00
Damian Poddebniak c63bf04601 Reformat code 2021-07-20 21:51:44 +02:00
Damian Poddebniak 2d4ea2f9c4 Fix serialization of address in `Command::{Ehlo, Helo}`. Thanks `cargo fuzz`! 2021-05-24 17:49:18 +02:00
Damian Poddebniak fcd8ee93ff Try to create a useful `Response` struct. 2021-05-23 19:26:16 +02:00
Damian Poddebniak ad3a164d19 Merge `response` and `replies` modules. 2021-05-23 14:14:35 +02:00
Damian Poddebniak e9ddac2ec2 Change `Reply_code` to return u16. 2021-05-23 14:03:45 +02:00
Damian Poddebniak bffba030df Improve documentation. 2021-05-23 14:02:34 +02:00
Damian Poddebniak 21138c353b Introduce feature-gated `serde` dependency
* derive `serde::{Deserialize, Serialize}` for `Capability` and `AuthMechanism`.
2021-05-22 22:57:21 +02:00
Damian Poddebniak 7cac2a2903 Impl `EhloOkResp::{new, serialize}` 2021-05-22 22:56:45 +02:00
Damian Poddebniak 54a0311fc6 Implement `{Capability,AuthMechanism}::serialize`. 2021-05-22 22:31:49 +02:00
Damian Poddebniak 10f614edb6 Too much, sorry. 2021-05-22 21:30:53 +02:00
Damian Poddebniak a327db7285 Add `number` parser. 2021-05-15 19:26:20 +02:00
Damian Poddebniak f5f04ea5e3 Thanks Clippy! 2021-02-22 16:46:46 +01:00
Damian Poddebniak cc8551e357 Update to nom 6 2021-02-22 16:36:54 +01:00
Damian Poddebniak 75d09f91ec Implement Command::serialize 2020-12-04 15:04:06 +01:00
Damian Poddebniak facfa4d7ea Improve fields of Command enum. 2020-12-04 15:03:28 +01:00
Damian Poddebniak 3007f1a3ff Greeting Parser and Type 2020-08-10 16:48:29 +02:00
Damian Poddebniak a0375f5657 Simplified ehlo-ok-rsp ABNF 2020-08-10 15:54:37 +02:00
Damian Poddebniak d41e8118f3 EhloOkResp Parser + Type
* ehlo_ok_resp returns `EhloOkResp` now
* Converted some &[u8] parser to &str
* Added unit test
* Changed ehlo_line to accept "AUTH=LOGIN PLAIN" (note the "=")
2020-08-10 15:05:30 +02:00
Damian Poddebniak f3768f1321 "Initial" commit. 2020-08-06 16:25:02 +02:00