Struct webex::types::GlobalId

source ·
pub struct GlobalId { /* private fields */ }
Expand description

This type is used to hold the ID of a message, room, person etc. It is created from a certain resource type to make it impossible to use a person ID to fetch a message, or vice versa.

Implementations§

source§

impl GlobalId

source

pub fn new(type_: GlobalIdType, id: String) -> Result<Self, Error>

Create a new GlobalId, with an ID type as well as an API ID (which can be either old UUID-style, or new base64 URI style).

source

pub fn new_with_cluster( type_: GlobalIdType, id: String, cluster: Option<&str> ) -> Result<Self, Error>

Given an ID and a possible cluster, generate a new geo-ID. Will fail if given a GlobalIdType that doesn’t correspond to a particular type (message, room, etc.)

Arguments
  • type_: GlobalIdType - the type of the ID being constructed
  • id: String - the ID, either old (UUID) or new (base64 geo-ID)
  • cluster: Option<&str> - cluster for geo-ID. Only used if the ID is an old-style UUID. Will default to "us" if not given and can’t be determined from the ID - this should work for most requests.
Errors
  • ErrorKind::Msg if:
    • the ID type is GlobalIdType::Unknown.
    • the ID is a base64 geo-ID that does not follow the format ciscospark://[cluster]/[type]/[id].
    • the ID is a base64 geo-ID and the type does not match the given type.
    • the ID is a base64 geo-ID and the cluster does not match the given cluster.
    • the ID is neither a UUID or a base64 geo-id.
source

pub fn new_with_cluster_unchecked( type_: GlobalIdType, id: String, cluster: Option<&str> ) -> Self

Given an ID and a possible cluster, generate a new geo-ID. Skips all checks. (If something wrong is passed, for example a GlobalIdType::Unknown, this will silently produce a bad ID that will always return a 404 from the API.)

source

pub fn id(&self) -> &str

Returns the base64 geo-ID as a &str for use in API requests.

source

pub fn check_type(&self, expected_type: GlobalIdType) -> Result<(), Error>

Check if type is the same as expected type

Trait Implementations§

source§

impl Clone for GlobalId

source§

fn clone(&self) -> GlobalId

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 GlobalId

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where U: Into<T>,

§

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>,

§

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