Skip to main content

Service

Struct Service 

Source
pub struct Service { /* private fields */ }
Expand description

The endpoint of one service, which its generated clients send calls to.

Implementations§

Source§

impl Service

Source

pub fn client(&self) -> &Client

The client the service’s calls go through.

Source

pub fn base_url(&self) -> Option<&Url>

The base URL calls are sent to, such as https://pvs.origincloudapis.eu; None when the service’s shortcode can’t name a host.

Source§

impl Service

Source

pub fn relative_name( &self, field: &str, value: &str, services: &[&str], ) -> Result<String, Error>

The relative name value, the path field field of a call to this service, stands for: value itself, or the relative name of a full resource name it is. The generated clients call it, and send the relative name in the path and in the body alike.

services are the short codes of the services whose full names the field takes: the service of the type the field refers to, such as resourcemanager for a billing account’s parent (organizations/*), ANY_SERVICE for a field referring to any type, or none for this service’s own. A full name of one of them, such as //resourcemanager.origincloudapis.eu/organizations/o, stands for its relative name. A full name of another service, one with a regional or zonal host or an API version, a URN, a URL or a malformed full name is refused, naming the hosts the field takes; see FullName.

Source

pub fn path_value( &self, field: &str, value: &str, pattern: &str, services: &[&str], ) -> Result<String, Error>

value, the path field field of a call to this service, as the path segments of the request: its relative_name, checked against pattern and escaped as path_value does.

Source

pub async fn call<T: DeserializeOwned>( &self, request: Request, ) -> Result<T, Error>

Sends request, retrying it while that is safe and the answer allows it, and reads the answer as T.

Source

pub async fn call_http_body(&self, request: Request) -> Result<HttpBody, Error>

Sends request as call does, to a method answering with a file rather than JSON, and returns the file as it came.

Trait Implementations§

Source§

impl Clone for Service

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Service

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

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

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