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

New feature: Allow Configurator::into_builder() to convert into a corresponding builder #4967

Closed
1 task done
Xuanwo opened this issue Aug 6, 2024 · 0 comments · Fixed by #4968
Closed
1 task done
Labels
enhancement New feature or request

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Aug 6, 2024

Feature Description

pub trait Configurator: Serialize + DeserializeOwned + Debug + 'static {
/// Deserialize from an iterator.
///
/// This API is provided by opendal, developer should not implement it.
fn from_iter(iter: impl IntoIterator<Item = (String, String)>) -> Result<Self> {
let cfg = ConfigDeserializer::new(iter.into_iter().collect());
Self::deserialize(cfg).map_err(|err| {
Error::new(ErrorKind::ConfigInvalid, "failed to deserialize config").set_source(err)
})
}
/// Convert this configuration into a service builder.
fn into_builder(self) -> impl Builder;
}

Configurator::into_builder now returns impl Builder, resulting in the absence of its type information. This prohibits us from parsing the config into S3Config and then converting S3Config into S3Builder. Consequently, users are unable to add more settings for the HTTP client.

Problem and Solution

Let's introduce Builder as an associated type within Configurator.

Additional Context

No response

Are you willing to contribute to the development of this feature?

  • Yes, I am willing to contribute to the development of this feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant