Importing Trait never used, but required?

error[E0599]: no method named `field_parser` found for type `&vx::Field<P>` in the current scope
   --> src/vx/
470 |                    let field_parser = field.field_parser();
    |                                             ^^^^^^^^^^^^
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `field_parser`, perhaps you need to implement it:
            candidate #1: `vx::FieldParser`

warning: unused import: `vx::FieldParser`
  --> src/vx/
11 | use vx::FieldParser;
   |     ^^^^^^^^^^^^^^^
   = note: #[warn(unused_imports)] on by default

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.

Looks like FieldParser isn’t implemented for &Field<P> according to the top message? If the trait isn’t implemented, you aren’t calling a method from it so the import is unused.

so I have defined

impl FieldParser for Field<P>

I even tried:

impl FieldParser for &Field<P>

That didn’t seem to work.

I ended up just de-referencing field.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.