Skip to main content

ProviderDeviceIdentity

Struct ProviderDeviceIdentity 

Source
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

Source

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");
Source

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);
Source

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

Source§

fn clone(&self) -> ProviderDeviceIdentity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProviderDeviceIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for ProviderDeviceIdentity

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ProviderDeviceIdentity

Source§

fn cmp(&self, other: &ProviderDeviceIdentity) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ProviderDeviceIdentity

Source§

fn eq(&self, other: &ProviderDeviceIdentity) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ProviderDeviceIdentity

Source§

fn partial_cmp(&self, other: &ProviderDeviceIdentity) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for ProviderDeviceIdentity

Source§

impl StructuralPartialEq for ProviderDeviceIdentity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSendSync for T
where T: Send + Sync,

§

impl<T> MaybeSync for T
where T: Sync,