I think this would be better API than providing raw nom parsers. I tried to implement it but ran into some snags which I briefly mentioned on Discord. Capturing here because it's probably a better venue:
If we implement a generic Response::from_bytes() API I don't think we can easily keep the Greeting and Ehlo variants
because those are really just more specific cases of Reply_lines/Other. I would be inclined to simplify Response to just be what Response::Other is now, it could provide as_greeting() and as_ehlo() methods instead that handle further parsing? The question here is if the connection state is allowed to influence parsing; IMO it's better to keep these separate where possible.
I think this would be better API than providing raw nom parsers. I tried to implement it but ran into some snags which I briefly mentioned on Discord. Capturing here because it's probably a better venue:
If we implement a generic
Response::from_bytes()API I don't think we can easily keep theGreetingandEhlovariantsbecause those are really just more specific cases of
Reply_lines/Other. I would be inclined to simplifyResponseto just be whatResponse::Otheris now, it could provideas_greeting()andas_ehlo()methods instead that handle further parsing? The question here is if the connection state is allowed to influence parsing; IMO it's better to keep these separate where possible.