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

ResourceManager needs to implement BundleGenerator #281

Open
gregtatum opened this issue Nov 9, 2022 · 2 comments
Open

ResourceManager needs to implement BundleGenerator #281

gregtatum opened this issue Nov 9, 2022 · 2 comments
Labels
crate:fluent-resmgr enhancement help wanted We need help making decisions or writing PRs for this.

Comments

@gregtatum
Copy link
Member

impl Stream for BundleIter {
type Item = FluentBundleResult<FluentResource>;
fn poll_next(
self: std::pin::Pin<&mut Self>,
_cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
todo!()
}
}
impl BundleGenerator for ResourceManager {
type Resource = FluentResource;
type LocalesIter = std::vec::IntoIter<LanguageIdentifier>;
type Iter = BundleIter;
type Stream = BundleIter;
fn bundles_iter(&self, locales: Self::LocalesIter, res_ids: Vec<ResourceId>) -> Self::Iter {
BundleIter { locales, res_ids }
}
fn bundles_stream(
&self,
_locales: Self::LocalesIter,
_res_ids: Vec<ResourceId>,
) -> Self::Stream {
todo!()
}
}

@gregtatum gregtatum added enhancement help wanted We need help making decisions or writing PRs for this. labels Nov 9, 2022
@gregtatum
Copy link
Member Author

If the idea is that the user should implement these, then it needs to be documented as such.

@gregtatum
Copy link
Member Author

An example of this API appears to be faked in:

impl BundleGenerator for ResourceManager {
type Resource = FluentResource;
type LocalesIter = std::vec::IntoIter<LanguageIdentifier>;
type Iter = BundleIter;
type Stream = BundleIter;
fn bundles_iter(&self, locales: Self::LocalesIter, res_ids: Vec<ResourceId>) -> Self::Iter {
BundleIter { locales, res_ids }
}
fn bundles_stream(&self, locales: Self::LocalesIter, res_ids: Vec<ResourceId>) -> Self::Stream {
BundleIter { locales, res_ids }
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate:fluent-resmgr enhancement help wanted We need help making decisions or writing PRs for this.
Projects
None yet
Development

No branches or pull requests

2 participants