Skip to content

size_hint should be able to return a lower bound that is infinite #18751

Closed
@vks

Description

@vks

Taken from the standard library:

impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
    [...]
    #[inline]
    fn size_hint(&self) -> (uint, Option<uint>) {
        (uint::MAX, None) // Too bad we can't specify an infinite lower bound
    }
}

Some iterators are infinite, size_hint should be able to return (None, None) for that. This warrants changing the type signature to (Option<uint>, Option<uint>).

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