Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft sketch of ResolvedLocaleAdapter #4607

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sffc
Copy link
Member

@sffc sffc commented Feb 14, 2024

An example of a potential way to resolve #58

Fixes #3906
Depends on #4606
Depends on #4608

Comment on lines +260 to +261
self.langid
.as_tuple()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: we shouldn't implement this, even on DataLocale, due to the same reasons as discussed in #1215. We should instead implement Ord only on the private ResolvedLocaleInfo type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertbastian
Copy link
Member

robertbastian commented Mar 12, 2024

Another idea is to extend DataProvider with this method:

    /// Query the provider for data, returning an error if the data is not loadable.
    ///
    /// Conceptually returns `self.load(req).map(|_| ())`, but implementations might be able to
    /// provide more performant implementations.
    fn can_load(&self, req: DataRequest) -> Result<(), DataError> {
        self.load(req).map(|_| ())
    }

Using separate return types for separate functionality makes sense, as then the data payload that load returns doesn't have to be optional, reducing fallibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants