pub struct ProviderDeviceIdentity { /* private fields */ }Expand description
Immutable runtime-control-plane binding of a provider to one physical target.
The target identity is opaque to the runtime and is canonicalized by the
provider. It is not tenferro_tensor::DeviceId or tensor placement data.
This immutable provider/target pair is the durable identity carried by
runtime snapshots, execution locations, and transfer requests.
Because this value appears in structured diagnostics and debug output, it
accepts nonempty ASCII graphic text (no controls, whitespace, or Unicode
confusables). Providers that need byte-level or Unicode identities must
first canonicalize them into an escaped diagnostic-safe ASCII form.
Equality, ordering, and hashing include both the provider and target.
§Examples
use tenferro_runtime::{ProviderDeviceIdentity, ProviderId};
let identity = ProviderDeviceIdentity::new(ProviderId::new("tenferro.cuda")?, "device-0")?;
assert_eq!(identity.provider_id().as_str(), "tenferro.cuda");
assert_eq!(identity.target_identity(), "device-0");Implementations§
Source§impl ProviderDeviceIdentity
impl ProviderDeviceIdentity
Sourcepub fn new(
provider_id: ProviderId,
target_identity: impl Into<Arc<str>>,
) -> Result<Self, IdentityError>
pub fn new( provider_id: ProviderId, target_identity: impl Into<Arc<str>>, ) -> Result<Self, IdentityError>
Construct a provider binding from a validated provider and opaque target.
§Errors
Returns IdentityError with IdentityKind::ProviderTarget when the
provider-canonical target identity is empty or is not ASCII graphic
text. Target text is deliberately diagnostic-safe; opaque
provider-specific byte or Unicode identities must be encoded by the
provider before construction.
§Examples
use tenferro_runtime::{ProviderDeviceIdentity, ProviderId};
let identity = ProviderDeviceIdentity::new(
ProviderId::new("tenferro.cpu")?,
"host-0",
)?;
assert_eq!(identity.target_identity(), "host-0");Sourcepub fn provider_id(&self) -> &ProviderId
pub fn provider_id(&self) -> &ProviderId
Return the validated provider namespace.
§Examples
use tenferro_runtime::{ProviderDeviceIdentity, ProviderId};
let provider = ProviderId::new("tenferro.cpu")?;
let identity = ProviderDeviceIdentity::new(provider.clone(), "host-0")?;
assert_eq!(identity.provider_id(), &provider);Sourcepub fn target_identity(&self) -> &str
pub fn target_identity(&self) -> &str
Return the provider-canonical opaque target identity.
§Examples
use tenferro_runtime::{ProviderDeviceIdentity, ProviderId};
let identity = ProviderDeviceIdentity::new(ProviderId::new("tenferro.cpu")?, "host-0")?;
assert_eq!(identity.target_identity(), "host-0");Trait Implementations§
Source§impl Clone for ProviderDeviceIdentity
impl Clone for ProviderDeviceIdentity
Source§fn clone(&self) -> ProviderDeviceIdentity
fn clone(&self) -> ProviderDeviceIdentity
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 ProviderDeviceIdentity
impl Debug for ProviderDeviceIdentity
Source§impl Hash for ProviderDeviceIdentity
impl Hash for ProviderDeviceIdentity
Source§impl Ord for ProviderDeviceIdentity
impl Ord for ProviderDeviceIdentity
Source§fn cmp(&self, other: &ProviderDeviceIdentity) -> Ordering
fn cmp(&self, other: &ProviderDeviceIdentity) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ProviderDeviceIdentity
impl PartialEq for ProviderDeviceIdentity
Source§fn eq(&self, other: &ProviderDeviceIdentity) -> bool
fn eq(&self, other: &ProviderDeviceIdentity) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ProviderDeviceIdentity
impl PartialOrd for ProviderDeviceIdentity
impl Eq for ProviderDeviceIdentity
impl StructuralPartialEq for ProviderDeviceIdentity
Auto Trait Implementations§
impl Freeze for ProviderDeviceIdentity
impl RefUnwindSafe for ProviderDeviceIdentity
impl Send for ProviderDeviceIdentity
impl Sync for ProviderDeviceIdentity
impl Unpin for ProviderDeviceIdentity
impl UnsafeUnpin for ProviderDeviceIdentity
impl UnwindSafe for ProviderDeviceIdentity
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more