Skip to content

eof combinator is more constrained than necessary #1251

@meiomorphism

Description

@meiomorphism

(As seen in nom 6.0.x. It looks like this also applies to the eof! macro, though I haven't used that.)

When the eof combinator succeeds, it returns a copy of its input, with the return type IResult<I, I, E>. Unfortunately, this isn't actually useful data — it'll always be an empty slice, if I'm reading it right — and it adds the requirement that the input type implement Copy. If eof instead were to return IResult<I, (), E>, then the I: Copy restriction could be removed.

Unfortunately this would be a breaking change, and so would necessitate a major version bump; but it might be reasonable to deprecate it and direct users to an equivalent replacement function (end_of_input, perhaps?) until nom 7.

Edit: This isn't a huge issue for me, and probably won't be for anyone else — at the very least, alt already requires Clone, and fortunately Copy was only a derive away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions