pub trait ImageGenProvider: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ImageGenRequest,
) -> Pin<Box<dyn Future<Output = Result<ImageGenResult, ImageGenError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A text-to-image provider.
Implementations resolve their own credentials and base URL at construction
time (see OpenAiImageProvider::new). Callers inject an already-resolved
(base_url, api_key, image_dir) so the module stays unit-testable with
mocks — credential resolution is the tool layer’s job.
Required Methods§
Sourcefn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ImageGenRequest,
) -> Pin<Box<dyn Future<Output = Result<ImageGenResult, ImageGenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 ImageGenRequest,
) -> Pin<Box<dyn Future<Output = Result<ImageGenResult, ImageGenError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate images. The result’s images[].url are always fetchable URLs
— b64-only providers persist locally and return a served URL.
req.model MUST be set; the caller resolves a config default first.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".