pub struct ProviderName(/* private fields */);Expand description
Strongly-typed LLM provider name.
ProviderName identifies a configured provider by its name field (e.g., "fast",
"quality", "ollama-local"). Names come from [[llm.providers]] name = "…" in the
TOML config; subsystems reference providers by this name via *_provider fields.
§Inner type: Arc<str>
The inner type is Arc<str>. Provider names are cloned widely across subsystem config
structs, metric labels, and log spans. Arc<str> makes all clones O(1).
§No Deref<Target=str>
ProviderName does not implement Deref<Target=str>. Use .as_str() for explicit
string conversion and .clone() to duplicate.
§Examples
use zeph_common::ProviderName;
let name = ProviderName::new("fast");
assert_eq!(name.as_str(), "fast");
assert_eq!(name, "fast");
// Clone is O(1) — Arc reference count increment only.
let name2 = name.clone();
assert_eq!(name, name2);Implementations§
Source§impl ProviderName
impl ProviderName
Sourcepub fn new(s: impl Into<Arc<str>>) -> ProviderName
pub fn new(s: impl Into<Arc<str>>) -> ProviderName
Construct a ProviderName from any value convertible to Arc<str>.
§Examples
use zeph_common::ProviderName;
let name = ProviderName::new("quality");
assert_eq!(name.as_str(), "quality");Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Return the inner string slice.
§Examples
use zeph_common::ProviderName;
let name = ProviderName::new("ollama-local");
assert_eq!(name.as_str(), "ollama-local");Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true when this is the empty sentinel (use the primary provider).
§Examples
use zeph_common::ProviderName;
assert!(ProviderName::default().is_empty());
assert!(!ProviderName::new("fast").is_empty());Sourcepub fn as_non_empty(&self) -> Option<&str>
pub fn as_non_empty(&self) -> Option<&str>
Return Some(&str) when non-empty, None for the empty sentinel.
§Examples
use zeph_common::ProviderName;
assert_eq!(ProviderName::default().as_non_empty(), None);
assert_eq!(ProviderName::new("fast").as_non_empty(), Some("fast"));Trait Implementations§
Source§impl AsRef<str> for ProviderName
impl AsRef<str> for ProviderName
Source§impl Borrow<str> for ProviderName
impl Borrow<str> for ProviderName
Source§impl Clone for ProviderName
impl Clone for ProviderName
Source§fn clone(&self) -> ProviderName
fn clone(&self) -> ProviderName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderName
impl Debug for ProviderName
Source§impl Default for ProviderName
impl Default for ProviderName
Source§fn default() -> ProviderName
fn default() -> ProviderName
Returns an empty ProviderName.
Exists solely for #[serde(default)] on optional fields. Do not use in
application code — an empty name will fail provider lookup.
Source§impl<'de> Deserialize<'de> for ProviderName
impl<'de> Deserialize<'de> for ProviderName
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProviderName, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ProviderName, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for ProviderName
impl Display for ProviderName
Source§impl From<&str> for ProviderName
impl From<&str> for ProviderName
Source§fn from(s: &str) -> ProviderName
fn from(s: &str) -> ProviderName
Source§impl From<String> for ProviderName
impl From<String> for ProviderName
Source§fn from(s: String) -> ProviderName
fn from(s: String) -> ProviderName
Source§impl FromStr for ProviderName
impl FromStr for ProviderName
Source§type Err = Infallible
type Err = Infallible
Source§fn from_str(s: &str) -> Result<ProviderName, <ProviderName as FromStr>::Err>
fn from_str(s: &str) -> Result<ProviderName, <ProviderName as FromStr>::Err>
s to return a value of this type. Read moreSource§impl Hash for ProviderName
impl Hash for ProviderName
Source§impl PartialEq<&str> for ProviderName
impl PartialEq<&str> for ProviderName
Source§impl PartialEq<ProviderName> for str
impl PartialEq<ProviderName> for str
Source§fn eq(&self, other: &ProviderName) -> bool
fn eq(&self, other: &ProviderName) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialEq<String> for ProviderName
impl PartialEq<String> for ProviderName
Source§impl PartialEq<str> for ProviderName
impl PartialEq<str> for ProviderName
Source§impl PartialEq for ProviderName
impl PartialEq for ProviderName
Source§fn eq(&self, other: &ProviderName) -> bool
fn eq(&self, other: &ProviderName) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ProviderName
impl Serialize for ProviderName
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ProviderName
impl StructuralPartialEq for ProviderName
Auto Trait Implementations§
impl Freeze for ProviderName
impl RefUnwindSafe for ProviderName
impl Send for ProviderName
impl Sync for ProviderName
impl Unpin for ProviderName
impl UnsafeUnpin for ProviderName
impl UnwindSafe for ProviderName
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.