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

feat: make HTTP provider optional #379

Merged
merged 8 commits into from
Mar 29, 2024

Conversation

leruaa
Copy link
Contributor

@leruaa leruaa commented Mar 23, 2024

Closes #199

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

pedantic nit

otherwise sounds reasonable to me

crates/provider/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm, pending @DaniPopes

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm too

@prestwich
Copy link
Member

@leruaa this has conflicts with #318 which was just merged. I can clean them up if you don't feel like you understand the code. let me know

@leruaa
Copy link
Contributor Author

leruaa commented Mar 26, 2024

I'll give a try

@leruaa
Copy link
Contributor Author

leruaa commented Mar 26, 2024

@prestwich I think the merge went fine

crates/provider/Cargo.toml Outdated Show resolved Hide resolved
crates/provider/Cargo.toml Outdated Show resolved Hide resolved
@@ -225,23 +226,25 @@ impl<L, N> ProviderBuilder<L, N> {
Ok(self.on_client(client))
}

/// Build this provider with an Reqwest HTTP transport.
#[cfg(feature = "reqwest")]
pub fn on_reqwest_http(self, url: url::Url) -> Result<L::Provider, TransportError>
where
L: ProviderLayer<RootProvider<N, BoxTransport>, N, BoxTransport>,
Copy link
Member

Choose a reason for hiding this comment

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

this is probably on me, but we should not box here, given the user has explicitly specified the transport type to be used. replace these BoxTransport usages with naming the Http type

Ok(self.on_client(client))
}

/// Build this provider with an Hyper HTTP transport.
#[cfg(feature = "hyper")]
pub fn on_hyper_http(self, url: url::Url) -> Result<L::Provider, TransportError>
where
L: ProviderLayer<RootProvider<N, BoxTransport>, N, BoxTransport>,
Copy link
Member

Choose a reason for hiding this comment

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

here too

Copy link
Member

@prestwich prestwich Mar 29, 2024

Choose a reason for hiding this comment

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

this may require reproducing generics from down the stack I think. if it gets ugly or annoying go ahead and skip this for hyper

@prestwich
Copy link
Member

actually I'm gonna go ahead and rebase and do this :)

@prestwich prestwich merged commit c8d9819 into alloy-rs:main Mar 29, 2024
17 checks passed
@leruaa leruaa deleted the http_transport_optional branch October 10, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Make HTTP provider optional, on by default
4 participants