Skip to main content

ImageHost

Trait ImageHost 

Source
pub trait ImageHost: Send + Sync {
    // Required methods
    fn sd_base_url(&self) -> String;
    fn gateway_url(&self) -> String;
    fn gateway_token(&self) -> Option<String>;
    fn start_local_engine(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + '_>>;
}
Expand description

Narrow host seam for image generation: the couplings the crate cannot own because they read Core config/sidecar state (the local sd-server base-url, the Gateway url + token, and lazy-starting the off-by-default sd.cpp sidecar). Core implements this in apps/core/src/image_host.rs.

Required Methods§

Source

fn sd_base_url(&self) -> String

Base URL the local sd-server media engine serves on ({base}/v1/...).

Source

fn gateway_url(&self) -> String

Base URL of the Gateway ({base}/v1/images/generations).

Source

fn gateway_token(&self) -> Option<String>

The Gateway bearer token slot (never a raw provider API key). None when unset — the request is still sent, unauthenticated.

Source

fn start_local_engine( &self, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + '_>>

Lazily start the (off-by-default) local media engine so text-to-image works out of the box once the sd-server binary + model are installed. Best-effort: on failure the subsequent proxy returns a clear “install from the Store first” error. Returns a boxed Send future so the crate’s dispatch future stays Send for the axum handler.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§