pub struct ProviderRegion<T: Clone + Debug> {
pub name: RegionName,
pub provider: String,
pub region: String,
pub config: T,
}Expand description
A cloud provider and geographic region.
§Example
use chroma_types::{ProviderRegion, RegionName};
let region = ProviderRegion::new(
RegionName::new("aws-us-east-1").unwrap(),
"aws",
"us-east-1",
(),
);
assert_eq!(region.name().as_str(), "aws-us-east-1");
assert_eq!(region.provider(), "aws");
assert_eq!(region.region(), "us-east-1");Fields§
§name: RegionNameThe unique name for this provider-region combination.
provider: StringThe cloud provider (e.g., “aws”, “gcp”).
region: StringThe region within the provider (e.g., “us-east-1”, “europe-west1”).
config: TAdditional per-region data.
Implementations§
Source§impl<T: Clone + Debug> ProviderRegion<T>
impl<T: Clone + Debug> ProviderRegion<T>
Sourcepub fn new(
name: RegionName,
provider: impl Into<String>,
region: impl Into<String>,
config: T,
) -> Self
pub fn new( name: RegionName, provider: impl Into<String>, region: impl Into<String>, config: T, ) -> Self
Creates a new provider region.
§Example
use chroma_types::{ProviderRegion, RegionName};
let region = ProviderRegion::new(
RegionName::new("gcp-europe-west1").unwrap(),
"gcp",
"europe-west1",
(),
);Sourcepub fn name(&self) -> &RegionName
pub fn name(&self) -> &RegionName
Returns the unique name for this provider-region combination.
Sourcepub fn region(&self) -> &str
pub fn region(&self) -> &str
Returns the region within the provider (e.g., “us-east-1”, “europe-west1”).
Sourcepub fn cast<U, F>(self, f: F) -> ProviderRegion<U>
pub fn cast<U, F>(self, f: F) -> ProviderRegion<U>
Transforms this provider region into a new type by applying a function to the config.
Sourcepub fn try_cast<U, E, F>(self, f: F) -> Result<ProviderRegion<U>, E>
pub fn try_cast<U, E, F>(self, f: F) -> Result<ProviderRegion<U>, E>
Transforms this provider region into a new type by applying a fallible function to the config.
§Errors
Returns an error if the transformation function returns an error.
Sourcepub async fn try_cast_async<U, E, F, R>(
self,
f: F,
) -> Result<ProviderRegion<U>, E>
pub async fn try_cast_async<U, E, F, R>( self, f: F, ) -> Result<ProviderRegion<U>, E>
Transforms this provider region into a new type by applying an async fallible function to the config.
§Errors
Returns an error if the transformation function returns an error.
Trait Implementations§
Source§impl<T: Clone + Clone + Debug> Clone for ProviderRegion<T>
impl<T: Clone + Clone + Debug> Clone for ProviderRegion<T>
Source§fn clone(&self) -> ProviderRegion<T>
fn clone(&self) -> ProviderRegion<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, T> Deserialize<'de> for ProviderRegion<T>
impl<'de, T> Deserialize<'de> for ProviderRegion<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T> Serialize for ProviderRegion<T>
impl<T> Serialize for ProviderRegion<T>
impl<T: Eq + Clone + Debug> Eq for ProviderRegion<T>
impl<T: Clone + Debug> StructuralPartialEq for ProviderRegion<T>
Auto Trait Implementations§
impl<T> Freeze for ProviderRegion<T>where
T: Freeze,
impl<T> RefUnwindSafe for ProviderRegion<T>where
T: RefUnwindSafe,
impl<T> Send for ProviderRegion<T>where
T: Send,
impl<T> Sync for ProviderRegion<T>where
T: Sync,
impl<T> Unpin for ProviderRegion<T>where
T: Unpin,
impl<T> UnwindSafe for ProviderRegion<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.