Skip to content

New StringArray Iterator API should not include Option #1263

@ehuss

Description

@ehuss

In #1241, the StringArray iterator was changed from returning Option<&str> to Result<Option<&str>>. I think it should instead have been changed to Result<&str>. The inner Option is unnecessary because it should only ever be None if there is a bug in the iterator implementation. This results in an unnecessary unwrap for the caller. I think the iterator should be:

    type Item = Result<&'a str, Error>;
    fn next(&mut self) -> Option<Result<&'a str, Error>> {
        self.range.next().map(|i| self.arr.get(i).transpose().unwrap())
    }

cc @weihanglo @DanielEScherzer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions