pub struct ProviderId(/* private fields */);Expand description
Unique identifier for an LLM provider (format: ip_<uuid>)
Implementations§
Source§impl ProviderId
impl ProviderId
Sourcepub fn parse(s: impl AsRef<str>) -> Result<Self, IdError>
pub fn parse(s: impl AsRef<str>) -> Result<Self, IdError>
Parse an ID from a string, validating format
§Security
Failed parse attempts are logged when the telemetry feature is enabled.
This provides security monitoring for potential attack attempts.
Sourcepub fn parse_flexible(s: impl AsRef<str>) -> Result<Self, IdError>
pub fn parse_flexible(s: impl AsRef<str>) -> Result<Self, IdError>
Parse an ID accepting both current (underscore) and legacy (hyphen) formats
This method provides backward compatibility during migration periods when both ID formats may exist in the system (e.g., database, logs, external APIs).
§Format Support
- Current format (underscore):
prefix_uuid(e.g.,agent_abc123) - Legacy format (hyphen):
prefix-uuid(e.g.,agent-abc123)
The legacy format is automatically normalized to the current underscore format.
§Security
Failed parse attempts are logged when the telemetry feature is enabled,
regardless of which format was attempted.
§Production Migration
Use this method when:
- Reading IDs from databases that contain legacy format
- Deserializing IDs from old API responses or config files
- Processing IDs from external systems during migration
Once migration is complete, prefer parse() for strict validation.
§Example
use iron_types::AgentId;
// Current format
let id1 = AgentId::parse_flexible("agent_550e8400-e29b-41d4-a716-446655440000").unwrap();
// Legacy format (auto-normalized)
let id2 = AgentId::parse_flexible("agent-550e8400-e29b-41d4-a716-446655440000").unwrap();
// Both produce same normalized ID
assert_eq!(id1.as_str(), "agent_550e8400-e29b-41d4-a716-446655440000");
assert_eq!(id2.as_str(), "agent_550e8400-e29b-41d4-a716-446655440000");Trait Implementations§
Source§impl AsRef<str> for ProviderId
impl AsRef<str> for ProviderId
Source§impl Clone for ProviderId
impl Clone for ProviderId
Source§fn clone(&self) -> ProviderId
fn clone(&self) -> ProviderId
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProviderId
impl Debug for ProviderId
Source§impl<'de> Deserialize<'de> for ProviderId
impl<'de> Deserialize<'de> for ProviderId
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ProviderId
impl Display for ProviderId
Source§impl From<ProviderId> for String
impl From<ProviderId> for String
Source§fn from(id: ProviderId) -> Self
fn from(id: ProviderId) -> Self
Converts to this type from the input type.
Source§impl FromStr for ProviderId
impl FromStr for ProviderId
Source§impl Hash for ProviderId
impl Hash for ProviderId
Source§impl PartialEq for ProviderId
impl PartialEq for ProviderId
Source§impl Serialize for ProviderId
impl Serialize for ProviderId
Source§impl TryFrom<String> for ProviderId
impl TryFrom<String> for ProviderId
impl Eq for ProviderId
impl StructuralPartialEq for ProviderId
Auto Trait Implementations§
impl Freeze for ProviderId
impl RefUnwindSafe for ProviderId
impl Send for ProviderId
impl Sync for ProviderId
impl Unpin for ProviderId
impl UnwindSafe for ProviderId
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)