Skip to main content

FoundryLocalManager

Struct FoundryLocalManager 

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

Primary entry point for interacting with Foundry Local.

Obtain a handle with FoundryLocalManager::create. While at least one handle is alive, every caller shares the same instance.

Implementations§

Source§

impl FoundryLocalManager

Source

pub fn create( config: FoundryLocalConfig, ) -> Result<Arc<Self>, FoundryLocalError>

Initialise the SDK and return a shared handle to the manager.

While at least one handle is alive — this Arc, or any Model, client, or session derived from it, each of which keeps the native manager alive — every call returns a handle to the same native manager and the config passed to later calls is ignored. If the Arc returned here is dropped while a derived handle is still alive, a subsequent call rebuilds a lightweight wrapper around the still-live native manager rather than creating a second one (the core permits only one). Once every handle is gone, the next call performs a fresh initialisation from the new config.

Teardown runs via Drop when the final handle is released — not via a process-exit hook — so the native manager (and its EP unregistration) shuts down while the engine / ORT runtime is still alive. This matches the C++ SDK’s local-Manager semantics and avoids the WebGPU ReleaseEpFactory teardown throw (ORT #29206).

Source

pub fn catalog(&self) -> &Catalog

Access the model catalog.

Source

pub fn shutdown(&self) -> Result<(), FoundryLocalError>

Begin a graceful shutdown of the local engine.

Stops the web service, prevents new model loads, stops existing sessions, and unloads models. Idempotent and safe to call from any thread.

Calling this is optional: the native manager is released automatically when the last handle is dropped. Use it when you want to deterministically wind the engine down before releasing the handle. After calling shutdown, the manager should not be used for further inference.

Source

pub fn urls(&self) -> Result<Vec<String>, FoundryLocalError>

URLs that the local web service is listening on.

Empty until Self::start_web_service has been called.

Source

pub async fn start_web_service(&self) -> Result<(), FoundryLocalError>

Start the local web service.

The listening URLs are stored internally and can be retrieved via Self::urls after this method returns.

Source

pub async fn stop_web_service(&self) -> Result<(), FoundryLocalError>

Stop the local web service.

Source

pub fn discover_eps(&self) -> Result<Vec<EpInfo>, FoundryLocalError>

Discover available execution providers and their registration status.

Source

pub async fn download_and_register_eps( &self, names: Option<&[&str]>, ) -> Result<EpDownloadResult, FoundryLocalError>

Download and register execution providers.

If names is None or empty, all available EPs are downloaded. Otherwise only the named EPs are downloaded and registered.

Source

pub async fn download_and_register_eps_with_progress<F>( &self, names: Option<&[&str]>, progress_callback: F, ) -> Result<EpDownloadResult, FoundryLocalError>
where F: FnMut(&str, f64) + Send + 'static,

Download and register execution providers, reporting per-EP progress.

If names is None or empty, all available EPs are downloaded. Otherwise only the named EPs are downloaded and registered.

progress_callback receives (ep_name, percent) where percent ranges from 0.0 to 100.0 as each EP downloads.

Source

pub fn download_and_register_eps_builder(&self) -> EpDownloadBuilder<'_>

Configure and run execution provider downloads with a builder.

Use this for call sites that need names, progress, cancellation, or future download options.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more