Skip to content

plan using into_future for services #520

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

Closed
wants to merge 14 commits into from

Conversation

cataggar
Copy link
Member

@cataggar cataggar commented Nov 16, 2021

This attempts to follow #510 for services by:

  • using a Client that can Clone
  • using a Builder for the operation
  • implement a into_future on the Builder

It is also using new type pattern for other sub-clients.

  • Where do the scopes go?
  • use Pipeline::send instead of HttpClient directly

})
}

pub struct Client(pub(crate) super::Client);
Copy link
Member Author

Choose a reason for hiding this comment

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

Follow new type pattern for modules.

@yoshuawuyts
Copy link
Contributor

yoshuawuyts commented Nov 16, 2021

Where do the scopes go?

I'm not sure what a scope is; can you elaborate?

@cataggar
Copy link
Member Author

With the pipeline, the user-agent header is set:

user-agent: azsdk-rust-mgmt_vmware/0.1.0 (1.56.0; windows; x86_64)

Thanks @heaths! Can you verify the above is correct? Looks find to me.

@heaths
Copy link
Member

heaths commented Nov 17, 2021

Yep, looks good. Thanks!

@cataggar cataggar requested a review from bmc-msft November 18, 2021 16:15
#[derive(Clone)]
pub struct Builder<'a> {
pub(crate) client: crate::operations::Client,
pub(crate) name: &'a str,
Copy link
Contributor

Choose a reason for hiding this comment

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

If the Builder takes a lifetime, references can be passed in.

}

impl<'a> Builder<'a> {
pub fn into_future(self) -> futures::future::BoxFuture<'a, std::result::Result<models::OperationList, Error>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

But then the future is limited to that lifetime. Is that okay or do we want a 'static lifetime?

Copy link
Member Author

Choose a reason for hiding this comment

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

For #527, I left the parameters in Builder as owned so that the BoxFuture lifetime is 'static.

@cataggar
Copy link
Member Author

#527 is ready for review.

@cataggar cataggar closed this Nov 28, 2021
@cataggar cataggar deleted the services_into_future branch November 28, 2021 01:05
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.

5 participants