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: impl From<Http1|Http2> for auto::Builder #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seanmonstar
Copy link
Member

The motivation is I wanted a way to get back to the main Builder, and this seemed to do it. Does it make sense?

cc @davidpdrsn @programatik29

@martinetd
Copy link
Contributor

Note on this: builder.http() returns Http2Builder so using into() immediately after it works, but setting any option will return a &mut Http2Builder which we cannot get back from, so I'm not sure how useful that is in practice unless we also make the methods not take refs.

Either way the Http[12]Builder only take a mut ref to Builder, so it's possible to change http2 options and go back which I hadn't realized in #113 ; so something like this works:

                    let mut builder = auto::Builder::new(TokioExecutor::new());
    
                    builder
                        .http2()
                        .max_header_list_size(4096);
        
                    builder
                        .serve_connection_with_upgrades(stream, service_fn(hello))
                        .await;

It's a bit less pretty than just chaining operators, but that means there probably isn't any hard need for this.

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.

4 participants