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>>) -> Self
pub fn new(s: impl Into<Arc<str>>) -> Self
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§impl<'de> Deserialize<'de> for ProviderName
impl<'de> Deserialize<'de> for ProviderName
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 Display for ProviderName
impl Display for ProviderName
Source§impl From<&str> for ProviderName
impl From<&str> for ProviderName
Source§impl From<String> for ProviderName
impl From<String> for ProviderName
Source§impl FromStr for ProviderName
impl FromStr for ProviderName
Source§impl Hash for ProviderName
impl Hash for ProviderName
Source§impl PartialEq<&str> for ProviderName
impl PartialEq<&str> for ProviderName
Source§impl PartialEq<ProviderName> for String
impl PartialEq<ProviderName> for String
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<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 ==.