Skip to main content

EpContextRegistry

Struct EpContextRegistry 

Source
pub struct EpContextRegistry { /* private fields */ }
Expand description

Registry mapping an EPContext node’s source key → the EpId that owns it (docs/ORT2.md §55.6).

EPs register the source key(s) they accept; dispatch (claim) is a pure lookup. There are no hardcoded vendor names here — the keys come entirely from each EP’s ExecutionProvider::context_source_keys.

§Duplicate keys are rejected (reject-duplicate-key)

register returns EpError::DuplicateContextSource if a source key is already claimed by another EP, rather than silently overwriting (last-writer-wins) it. Rationale: two EPs claiming the same source is a configuration error (the model would dispatch ambiguously), and silently dropping one binding would make which EP restores a context depend on registration order — a non-deterministic, hard-to-debug failure at load. A registrant re-declaring the same (key, ep) binding is idempotent and accepted (it is not a conflict).

Implementations§

Source§

impl EpContextRegistry

Source

pub fn new() -> Self

An empty registry.

Source

pub fn register(&mut self, ep: EpId, source_keys: &[String]) -> Result<()>

Declare that ep accepts each key in source_keys for EPContext dispatch. Keys come from the EP’s own config/data (§55.6), never hardcoded here.

§Errors

Returns EpError::DuplicateContextSource if any key is already registered to a different EP (reject-duplicate-key). Re-registering the same (key, ep) binding is idempotent. On error, keys processed before the conflict remain registered (the caller should treat a duplicate as a fatal configuration error).

Source

pub fn claim(&self, source: Option<&str>) -> Option<EpId>

Look up the EP that owns a node’s source attribute (§55.6).

A pure lookup: None source (attribute absent) or a source matching no registered EP both yield None — the node is unclaimed. The session turns an unclaimed node into a clear EpError::NoEpForContext rather than guessing.

Source

pub fn len(&self) -> usize

Number of registered source keys.

Source

pub fn is_empty(&self) -> bool

Whether no source keys are registered.

Trait Implementations§

Source§

impl Clone for EpContextRegistry

Source§

fn clone(&self) -> EpContextRegistry

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 EpContextRegistry

Source§

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

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

impl Default for EpContextRegistry

Source§

fn default() -> EpContextRegistry

Returns the “default value” for a type. Read more

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
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> 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.