## TopicAdmin

# Struct TopicAdmin

Source

    pub struct TopicAdmin { /* private fields */ }

Expand description

Implements a client for the Cloud Pub/Sub API.

## §Example

    let client = TopicAdmin::builder().build().await?;
    // use `client` to make requests to the Cloud Pub/Sub API.

## §Service Description

The service that an application uses to manipulate topics.

## §Configuration

To configure `TopicAdmin` use the `with_*` methods in the type returned by builder(). The default configuration should work for most applications. Common configuration changes include

- with_endpoint(): by default this client uses the global default endpoint (`https://pubsub.googleapis.com`). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default.
- with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.

## §Pooling and Cloning

`TopicAdmin` holds a connection pool internally, it is advised to create one and the reuse it. You do not need to wrap `TopicAdmin` in an Rc or Arc to reuse it, because it already uses an `Arc` internally.

## Implementations§

Source§

### impl TopicAdmin

Source

#### pub fn builder() -> ClientBuilder

Returns a builder for TopicAdmin.

    let client = TopicAdmin::builder().build().await?;

Source

#### pub fn from_stub<T>(stub: T) -> Self
where T: TopicAdmin + 'static,

Creates a new client from the provided stub.

The most common case for calling this function is in tests mocking the client’s behavior.

Source

#### pub fn create_topic(&self) -> CreateTopic

Creates the given topic with the given name. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

Source

#### pub fn update_topic(&self) -> UpdateTopic

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

Source

#### pub fn get_topic(&self) -> GetTopic

Gets the configuration of a topic.

Source

#### pub fn list_topics(&self) -> ListTopics

Lists matching topics.

Source

#### pub fn list_topic_subscriptions(&self) -> ListTopicSubscriptions

Lists the names of the attached subscriptions on this topic.

Source

#### pub fn list_topic_snapshots(&self) -> ListTopicSnapshots

Lists the names of the snapshots on this topic. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.

Source

#### pub fn delete_topic(&self) -> DeleteTopic

Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their `topic` field is set to `_deleted-topic_`.

Source

#### pub fn detach_subscription(&self) -> DetachSubscription

Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.

## Trait Implementations§

Source§

### impl Clone for TopicAdmin

Source§

#### fn clone(&self) -> TopicAdmin

Returns a duplicate of the value. Read more
1.0.0 · Source§

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
Source§

### impl Debug for TopicAdmin

Source§

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

## Auto Trait Implementations§

§

### impl Freeze for TopicAdmin

§

### impl !RefUnwindSafe for TopicAdmin

§

### impl Send for TopicAdmin

§

### impl Sync for TopicAdmin

§

### impl Unpin for TopicAdmin

§

### impl !UnwindSafe for TopicAdmin

## Blanket Implementations§

Source§

### impl<T> Any for T
where T: 'static + ?Sized,

Source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
Source§

### impl<T> Borrow<T> for T
where T: ?Sized,

Source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

### impl<T> CloneToUninit for T
where T: Clone,

Source§

#### unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (`clone_to_uninit`)
Performs copy-assignment from `self` to `dest`. Read more
Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
Source§

### impl<T, U> Into<U> for T
where U: From<T>,

Source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

§

### impl<T> IntoRequest<T> for T

§

#### fn into_request(self) -> Request<T>

Wrap the input message `T` in a `tonic::Request`
§

### impl<L> LayerExt<L> for L

§

#### fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [`Layered`].
§

### impl<T> PolicyExt for T
where T: ?Sized,

§

#### fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new `Policy` that returns [`Action::Follow`] only if `self` and `other` return `Action::Follow`. Read more
§

#### fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new `Policy` that returns [`Action::Follow`] if either `self` or `other` returns `Action::Follow`. Read more
Source§

### impl<T> ToOwned for T
where T: Clone,

Source§

#### type Owned = T

The resulting type after obtaining ownership.
Source§

#### fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

#### fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

#### type Error = Infallible

The type returned in the event of a conversion error.
Source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more