pub enum PrivateOrExternalService {
    Private(PrivateService),
    External(ExternalService),
}
Expand description

Defines an abstraction over either a private service, or an external service.

Variants§

§

Private(PrivateService)

It’s a private service.

§

External(ExternalService)

It’s an external service.

Implementations§

source§

impl PrivateOrExternalService

source

pub fn is_private(&self) -> bool

Returns whether this is a private service or not.

Returns

True if it is, false if it is an external service.

source

pub fn private(&self) -> &PrivateService

Provides access to the internal PrivateService object, assuming this is one.

Returns

A reference to the internal PrivateService object.

Panics

This function panics if we were not a Private service.

source

pub fn private_mut(&mut self) -> &mut PrivateService

Provides mutable access to the internal PrivateService object, assuming this is one.

Returns

A mutable reference to the internal PrivateService object.

Panics

This function panics if we were not a Private service.

source

pub fn into_private(self) -> PrivateService

Returns the internal PrivateService object, assuming this is one.

Returns

The internal PrivateService object. This consumes self.

Panics

This function panics if we were not a Private service.

source

pub fn try_private(&self) -> Option<&PrivateService>

Provides access to the internal PrivateService object, assuming this is one.

Returns

A reference to the internal PrivateService object if this is a PrivateOrExternalService::Private, or else None.

source

pub fn try_private_mut(&mut self) -> Option<&mut PrivateService>

Provides mutable access to the internal PrivateService object, assuming this is one.

Returns

A mutable reference to the internal PrivateService object if this is a PrivateOrExternalService::Private, or else None.

source

pub fn try_into_private(self) -> Option<PrivateService>

Returns the internal PrivateService object, assuming this is one.

Returns

The internal PrivateService object if this is a PrivateOrExternalService::Private, or else None. This consumes self.

source

pub fn is_external(&self) -> bool

Returns whether this is an external service or not.

Returns

True if it is, false if it is a private service.

source

pub fn external(&self) -> &ExternalService

Provides access to the internal ExternalService object, assuming this is one.

Returns

A reference to the internal ExternalService object.

Panics

This function panics if we were not an External service.

source

pub fn external_mut(&mut self) -> &mut ExternalService

Provides mutable access to the internal ExternalService object, assuming this is one.

Returns

A mutable reference to the internal ExternalService object.

Panics

This function panics if we were not an External service.

source

pub fn into_external(self) -> ExternalService

Returns the internal ExternalService object, assuming this is one.

Returns

The internal ExternalService object. This consumes self.

Panics

This function panics if we were not an External service.

source

pub fn try_external(&self) -> Option<&ExternalService>

Provides access to the internal ExternalService object, assuming this is one.

Returns

A reference to the internal ExternalService object if this is a PrivateOrExternalService::External, or else None.

source

pub fn try_external_mut(&mut self) -> Option<&mut ExternalService>

Provides mutable access to the internal ExternalService object, assuming this is one.

Returns

A mutable reference to the internal ExternalService object if this is a PrivateOrExternalService::External, or else None.

source

pub fn try_into_external(self) -> Option<ExternalService>

Returns the internal ExternalService object, assuming this is one.

Returns

The internal ExternalService object if this is a PrivateOrExternalService::External, or else None. This consumes self.

source

pub fn address(&self) -> &Address

Provides access to the internal (private) address that services can connect to.

Returns

A reference to the internal Address-object.

source

pub fn address_mut(&mut self) -> &mut Address

Provides mutable access to the internal (private) address that services can connect to.

Returns

A mutable reference to the internal Address-object.

source

pub fn into_address(self) -> Address

Returns the internal (private) address that services can connect to.

Returns

The internal Address-object. This consumes self.

Trait Implementations§

source§

impl Clone for PrivateOrExternalService

source§

fn clone(&self) -> PrivateOrExternalService

Returns a copy 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 PrivateOrExternalService

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for PrivateOrExternalService

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl EnumDebug for PrivateOrExternalService

source§

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

Formats this enum as its variant name. Read more
source§

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

Formats this enum so that it writes the name of it. Read more
§

fn variant(&self) -> EnumDebugFormatter<'_, Self>

Returns a formatter for this enum that writes its variant name. Read more
source§

impl Serialize for PrivateOrExternalService

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for Twhere T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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 Twhere U: From<T>,

const: unstable · 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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

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

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,