Skip to content

Option to implement std::convert::AsRef for Field? #5819

@chmp

Description

@chmp

I am maintaining the serde_arrow crate. Initially I used &[Field] in my signatures, but more recently switched to the more idiomatic &[FieldRef]. I could cover both signatures with a generic F: AsRef<Field>, if arrow were to implement std::convert::AsRef<Field> for Field.

I recognize that this is a convenience feature for a single crate, but as it is easy to implement, I wanted to give it a shot :)

Required impl:

impl std::convert::AsRef<Field> for Field{
    fn as_ref(&self) -> &Field{
        self
    }
}

Context: the Rust docs contain a section on implementing AsRef for you own types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions