Skip to main content

vc_runtime/
stub.rs

1//! Stub runtime backend.
2
3use crate::{
4    BackendKind, RuntimeBackend, RuntimeInput, RuntimeResult, RuntimeStatus, RUNTIME_SCHEMA_VERSION,
5};
6use anyhow::Result;
7use std::path::Path;
8
9pub struct StubBackend;
10
11impl StubBackend {
12    pub fn new() -> Self {
13        Self
14    }
15}
16
17impl Default for StubBackend {
18    fn default() -> Self {
19        Self::new()
20    }
21}
22
23impl RuntimeBackend for StubBackend {
24    fn execute(&self, input: &RuntimeInput, _output_dir: &Path) -> Result<RuntimeResult> {
25        let metadata = &input.vc_output.metadata;
26        let _prompt = &input.vc_output.prompt;
27
28        Ok(RuntimeResult {
29            runtime_schema_version: RUNTIME_SCHEMA_VERSION,
30            status: RuntimeStatus::Stub,
31            backend: BackendKind::Stub,
32            compiler_schema_version: input.vc_output.schema_version,
33            seed: 0,
34            image_path: None,
35            image_hash: None,
36            input_prompt_hash: metadata.prompt_hash.to_hex(),
37            model: None,
38            width: 0,
39            height: 0,
40            steps: 0,
41            cfg: 0.0,
42            sampler: String::new(),
43            started_at: None,
44            finished_at: None,
45            duration_ms: None,
46        })
47    }
48}