#
google_cloud_pubsub/generated/gapic_dataplane/stub/
dynamic.rs

    1// Copyright 2025 Google LLC
    2//
    3// Licensed under the Apache License, Version 2.0 (the "License");
    4// you may not use this file except in compliance with the License.
    5// You may obtain a copy of the License at
    6//
    7//     https://www.apache.org/licenses/LICENSE-2.0
    8//
    9// Unless required by applicable law or agreed to in writing, software
    10// distributed under the License is distributed on an "AS IS" BASIS,
    11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12// See the License for the specific language governing permissions and
    13// limitations under the License.
    14//
    15// Code generated by sidekick. DO NOT EDIT.
    16
    17/// A dyn-compatible, crate-private version of [super::Publisher].
    18#[async_trait::async_trait]
    19pub trait Publisher: std::fmt::Debug + Send + Sync {
    20    async fn publish(
    21        &self,
    22        req: crate::model::PublishRequest,
    23        options: gax::options::RequestOptions,
    24    ) -> crate::Result<gax::response::Response<crate::model::PublishResponse>>;
    25}
    26
    27/// All implementations of [super::Publisher] also implement [Publisher].
    28#[async_trait::async_trait]
    29impl<T: super::Publisher> Publisher for T {
    30    /// Forwards the call to the implementation provided by `T`.
    31    async fn publish(
    32        &self,
    33        req: crate::model::PublishRequest,
    34        options: gax::options::RequestOptions,
    35    ) -> crate::Result<gax::response::Response<crate::model::PublishResponse>> {
    36        T::publish(self, req, options).await
    37    }
    38}
    39
    40/// A dyn-compatible, crate-private version of [super::Subscriber].
    41#[async_trait::async_trait]
    42pub trait Subscriber: std::fmt::Debug + Send + Sync {
    43    async fn modify_ack_deadline(
    44        &self,
    45        req: crate::model::ModifyAckDeadlineRequest,
    46        options: gax::options::RequestOptions,
    47    ) -> crate::Result<gax::response::Response<()>>;
    48
    49    async fn acknowledge(
    50        &self,
    51        req: crate::model::AcknowledgeRequest,
    52        options: gax::options::RequestOptions,
    53    ) -> crate::Result<gax::response::Response<()>>;
    54}
    55
    56/// All implementations of [super::Subscriber] also implement [Subscriber].
    57#[async_trait::async_trait]
    58impl<T: super::Subscriber> Subscriber for T {
    59    /// Forwards the call to the implementation provided by `T`.
    60    async fn modify_ack_deadline(
    61        &self,
    62        req: crate::model::ModifyAckDeadlineRequest,
    63        options: gax::options::RequestOptions,
    64    ) -> crate::Result<gax::response::Response<()>> {
    65        T::modify_ack_deadline(self, req, options).await
    66    }
    67
    68    /// Forwards the call to the implementation provided by `T`.
    69    async fn acknowledge(
    70        &self,
    71        req: crate::model::AcknowledgeRequest,
    72        options: gax::options::RequestOptions,
    73    ) -> crate::Result<gax::response::Response<()>> {
    74        T::acknowledge(self, req, options).await
    75    }
    76}