-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
My last comment in the relevant issue, to be discussed here. |
@@ -97,6 +97,9 @@ pub enum AttributeValue<'a> { | |||
index: Option<u32>, | |||
data: Option<&'a [u8]>, | |||
}, | |||
Bodystructure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the surrounding style, single-element variants shouldn't be tuple variants.
@@ -621,6 +629,18 @@ mod tests { | |||
} | |||
} | |||
|
|||
#[test] | |||
fn bodystructure() { | |||
const RESPONSE: &[u8] = b"* 15 FETCH (BODYSTRUCTURE (\"TEXT\" \"PLAIN\" (\"CHARSET\" \"iso-8859-1\") NIL NIL \"QUOTED-PRINTABLE\" 1315 42 NIL NIL NIL NIL))\r\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure lines are no longer than 99 characters.
match parse_response(RESPONSE) { | ||
IResult::Done(_, Response::Fetch(_, attrs)) => { | ||
let body = &attrs[0]; | ||
assert!(if let &AttributeValue::Bodystructure { .. } = body { true } else { false }, "body = {:?}", body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't very easy to grok. It's a fairly long expression with a sizable amount of complexity, all on a single line. It would probably be better to just assign the boolean to a local variable, then assert!()
that.
@djc: thanks for your comments. But note that this is not a submission for review, see opening post and WIP (work-in-progress) in title. I’m aware of the issues you mention. What would be most helpful is some guidance on how to write the combinators themselves. I’ll get back to it it soon again. |
Ah yes, sorry for the eager review. I think my comment from #15 should help decide how to write the combinators? |
Update: I haven’t spent more time on this yet. I’ve prioritized other dev work since. I’ll keep you informed about my progress! |
I'm closing this PR, since I haven't been able to spend time on this for a while now. |
Publication of very early state, just to make reviewing and collaboration easier. The
bodystructure
test still fails.