{{! Copyright (c) Meta Platforms, Inc. and affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. }} {{#service:docs?}} #[doc = {{service:docs}}] {{/service:docs?}} pub trait {{service:rust_name}}: {{! }}{{#service:extends}}{{service:client_package}}::{{service:rust_name}} + {{/service:extends}}{{! }}::std::marker::Send {{>lib/block}}{{! }}{{#service:rustFunctions}} {{#function:docs?}} #[doc = {{function:docs}}] {{/function:docs?}} {{^function:starts_interaction?}}{{^function:sink?}} fn {{function:rust_name}}( &self, {{#function:args}} arg_{{field:name}}: {{>lib/arg}}, {{/function:args}} ) -> {{>lib/client_return_type}}; {{/function:sink?}}{{/function:starts_interaction?}}{{#function:starts_interaction?}} fn {{function:rust_name}}( &self, ) -> ::std::result::Result<{{! }}{{program:crate}}::client::{{service:snake}}::{{function:interaction_name}}Client, {{! }}::anyhow::Error>; {{/function:starts_interaction?}}{{/service:rustFunctions}} } pub trait {{service:rust_name}}Ext: {{service:rust_name}}{{! }}{{#service:extends}} + {{service:client_package}}::{{service:rust_name}}Ext{{/service:extends}} where T: ::fbthrift::Transport, {{>lib/block}} {{#service:rustFunctions}} {{#function:docs?}} #[doc = {{function:docs}}] {{/function:docs?}} {{^function:starts_interaction?}}{{^function:sink?}} fn {{function:rust_name}}_with_rpc_opts( &self, {{#function:args}} arg_{{field:name}}: {{>lib/arg}}, {{/function:args}} rpc_options: T::RpcOptions, ) -> {{>lib/client_return_type}}; {{/function:sink?}}{{/function:starts_interaction?}} {{/service:rustFunctions}} {{^service:extendedClients}} fn transport(&self) -> &T; {{/service:extendedClients}} } #[allow(deprecated)]{{! `dependencies` modules are deprecated other than for packagePrefix to use }} impl<'a, S> {{service:rust_name}} for S where S: ::std::convert::AsRef, {{#service:extendedClients}} {{#extendedService:service}} S: {{extendedService:packagePrefix}}::{{service:rust_name}}, {{/extendedService:service}} {{/service:extendedClients}} S: ::std::marker::Send, { {{#service:rustFunctions}} {{^function:starts_interaction?}}{{^function:sink?}} fn {{function:rust_name}}( &self,{{! }}{{#function:args}} arg_{{field:name}}: {{>lib/arg}},{{! }}{{/function:args}} ) -> {{>lib/client_return_type}} { self.as_ref().{{function:rust_name}}( {{#function:args}} arg_{{field:name}}, {{/function:args}} ) } {{/function:sink?}}{{/function:starts_interaction?}}{{#function:starts_interaction?}} fn {{function:rust_name}}( &self, ) -> ::std::result::Result<{{! }}{{program:crate}}::client::{{service:snake}}::{{function:interaction_name}}Client, {{! }}::anyhow::Error> { self.as_ref().{{function:rust_name}}() } {{/function:starts_interaction?}}{{/service:rustFunctions}} } #[allow(deprecated)]{{! `dependencies` modules are deprecated other than for packagePrefix to use }} impl<'a, S, T> {{service:rust_name}}Ext for S where S: ::std::convert::AsRef + ::std::convert::AsRef + 'a>, {{#service:extendedClients}} {{#extendedService:service}} S: {{extendedService:packagePrefix}}::{{service:rust_name}} + {{extendedService:packagePrefix}}::{{service:rust_name}}Ext, {{/extendedService:service}} {{/service:extendedClients}} S: ::std::marker::Send + ::fbthrift::help::GetTransport, T: ::fbthrift::Transport, { {{#service:rustFunctions}} {{^function:starts_interaction?}}{{^function:sink?}} fn {{function:rust_name}}_with_rpc_opts( &self,{{! }}{{#function:args}} arg_{{field:name}}: {{>lib/arg}},{{! }}{{/function:args}} rpc_options: T::RpcOptions, ) -> {{>lib/client_return_type}} { >>::as_ref(self).{{function:rust_name}}_with_rpc_opts( {{#function:args}} arg_{{field:name}}, {{/function:args}} rpc_options, ) } {{/function:sink?}}{{/function:starts_interaction?}} {{/service:rustFunctions}} {{^service:extendedClients}} fn transport(&self) -> &T { ::fbthrift::help::GetTransport::transport(self) } {{/service:extendedClients}} }