Skip to content

use an opaque type for values yielded by TimeZoneNameIter #221

@BurntSushi

Description

@BurntSushi

Specifically, this iterator: https://docs.rs/jiff/latest/jiff/tz/struct.TimeZoneNameIter.html

Currently, it always yields a String. But this is somewhat restrictive and requires alloc. I think we should also parameterize it over a lifetime borrowed from the originating TimeZoneDatabase. And then add an as_str<'a>(&'a self) -> &'a str method (specifically with a lifetime attached to the value yielded and not the TimeZoneDatabase, so as to permit Cow shenanigans or an owned representation internally). I think this is perhaps overly restrictive, but it is maximally flexible from an API evolution perspective.

I will probably keep the API alloc-only for jiff 0.2, so there won't be any immediate improvement here. But it at least gives us a chance to evolve it in semver compatible ways should the need arise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeIssues that require a breaking change for resolution.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions