Skip to content

Type coercion for Input in 8.0.0 #1799

Open
@IpFruion

Description

@IpFruion

Problem

When upgrading from 7.* to 8.0.0 I noticed that tag(b"hello") now produces an error.

the trait `Input` is not implemented for `&[u8; 5]`

This is due to the shift from the InputLength trait being implemented for tag in 7.* https://docs.rs/nom/7.1.3/nom/bytes/complete/fn.tag.html

To tag must implement Input in 8.0.0: https://docs.rs/nom/8.0.0/nom/bytes/complete/fn.tag.html

Interim Solution

A way to fix this in the interim is to coerce the type into &[u8] which Input is implemented for. i.e. tag(b"hello" as &[u8]).

Possible Fix

Implement Input for &[u8; N] for any const N: usize

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions