Mercurial > lbo > hg > async-google-apis
changeset 206:23d41bfb0081
remove DerefAuth, make methods that don't mutate self immutable
author | Daniel Boline <ddboline@gmail.com> |
---|---|
date | Mon, 22 Feb 2021 16:16:04 -0500 |
parents | ec212287e4a3 |
children | 3fda41657f19 |
files | generate/templates.py |
diffstat | 1 files changed, 4 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/generate/templates.py Mon Feb 22 16:09:02 2021 -0500 +++ b/generate/templates.py Mon Feb 22 16:16:04 2021 -0500 @@ -20,20 +20,6 @@ use async_google_apis_common::*; -#[cfg(feature = "multi-thread")] -pub trait DerefAuth: std::ops::Deref<Target=Authenticator> + Send + Sync {} - -#[cfg(feature = "multi-thread")] -impl<T> DerefAuth for T -where T: std::ops::Deref<Target=Authenticator> + Send + Sync {} - -#[cfg(not(feature = "multi-thread"))] -pub trait DerefAuth: std::ops::Deref<Target=Authenticator> {} - -#[cfg(not(feature = "multi-thread"))] -impl<T> DerefAuth for T -where T: std::ops::Deref<Target=Authenticator> {} - ''' # Dict contents -- @@ -218,7 +204,7 @@ NormalMethodTmpl = ''' /// {{{description}}} pub async fn {{{name}}}( - &mut self, params: &{{{param_type}}} + &self, params: &{{{param_type}}} {{#in_type}}, req: &{{{in_type}}}{{/in_type}}) -> Result<{{{out_type}}}> { let rel_path = {{{rel_path_expr}}}; @@ -266,7 +252,7 @@ /// /// This method is a variant of `{{{name}}}()`, taking data for upload. It performs a multipart upload. pub async fn {{{name}}}_upload( - &mut self, params: &{{{param_type}}}, {{#in_type}}req: &{{{in_type}}},{{/in_type}} data: hyper::body::Bytes) -> Result<{{out_type}}> { + &self, params: &{{{param_type}}}, {{#in_type}}req: &{{{in_type}}},{{/in_type}} data: hyper::body::Bytes) -> Result<{{out_type}}> { let rel_path = {{{simple_rel_path_expr}}}; let path = self.format_path(rel_path.as_str()); @@ -316,7 +302,7 @@ /// of data to the API. The result of this call will be returned by the `ResumableUpload` method /// you choose for the upload. pub async fn {{{name}}}_resumable_upload<'client>( - &'client mut self, params: &{{{param_type}}}, {{#in_type}}req: &{{{in_type}}}{{/in_type}}) -> Result<ResumableUpload<'client, {{{out_type}}}>> { + &'client self, params: &{{{param_type}}}, {{#in_type}}req: &{{{in_type}}}{{/in_type}}) -> Result<ResumableUpload<'client, {{{out_type}}}>> { let rel_path = {{{resumable_rel_path_expr}}}; let path = self.format_path(rel_path.as_str()); @@ -369,7 +355,7 @@ /// /// This method potentially downloads data. See documentation of `Download`. pub async fn {{{name}}}<'a>( - &'a mut self, params: &{{{param_type}}}, {{#in_type}}req: &'a {{{in_type}}}{{/in_type}}) + &'a self, params: &{{{param_type}}}, {{#in_type}}req: &'a {{{in_type}}}{{/in_type}}) -> Result<Download<'a, {{{download_in_type}}}, {{{out_type}}}>> { let rel_path = {{{rel_path_expr}}};