pub struct Txt2ImgRequest {
pub positive_prompt: String,
pub negative_prompt: String,
pub checkpoint: String,
pub width: u32,
pub height: u32,
pub steps: u32,
pub cfg_scale: f64,
pub sampler: String,
pub scheduler: String,
pub seed: i64,
pub batch_size: u32,
pub filename_prefix: String,
}Expand description
Builder for a txt2img ComfyUI workflow.
Constructs a standard 7-node pipeline: CheckpointLoader → CLIP encoders → KSampler → VAEDecode → SaveImage.
§Example
use comfyui_rs::Txt2ImgRequest;
let (workflow, seed) = Txt2ImgRequest::new("a cat in space", "dreamshaper_8.safetensors")
.negative("lowres, blurry")
.size(512, 768)
.steps(25)
.cfg_scale(7.5)
.build();
assert!(seed >= 0);
assert!(workflow.get("1").is_some()); // CheckpointLoader nodeFields§
§positive_prompt: String§negative_prompt: String§checkpoint: String§width: u32§height: u32§steps: u32§cfg_scale: f64§sampler: String§scheduler: String§seed: i64§batch_size: u32§filename_prefix: StringImplementations§
Source§impl Txt2ImgRequest
impl Txt2ImgRequest
Sourcepub fn new(prompt: impl Into<String>, checkpoint: impl Into<String>) -> Self
pub fn new(prompt: impl Into<String>, checkpoint: impl Into<String>) -> Self
Create a new request with a prompt and checkpoint. Uses sensible defaults for all other parameters (512x768, 25 steps, cfg 7.5, dpmpp_2m/karras).
Sourcepub fn sampler(self, sampler: impl Into<String>) -> Self
pub fn sampler(self, sampler: impl Into<String>) -> Self
Set the sampler algorithm (e.g. “euler”, “dpmpp_2m”, “dpmpp_sde”).
Sourcepub fn scheduler(self, scheduler: impl Into<String>) -> Self
pub fn scheduler(self, scheduler: impl Into<String>) -> Self
Set the noise scheduler (e.g. “normal”, “karras”, “exponential”).
Sourcepub fn batch_size(self, size: u32) -> Self
pub fn batch_size(self, size: u32) -> Self
Set the batch size (number of images per generation).
Sourcepub fn filename_prefix(self, prefix: impl Into<String>) -> Self
pub fn filename_prefix(self, prefix: impl Into<String>) -> Self
Set the output filename prefix in ComfyUI.
Trait Implementations§
Source§impl Clone for Txt2ImgRequest
impl Clone for Txt2ImgRequest
Source§fn clone(&self) -> Txt2ImgRequest
fn clone(&self) -> Txt2ImgRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Txt2ImgRequest
impl RefUnwindSafe for Txt2ImgRequest
impl Send for Txt2ImgRequest
impl Sync for Txt2ImgRequest
impl Unpin for Txt2ImgRequest
impl UnsafeUnpin for Txt2ImgRequest
impl UnwindSafe for Txt2ImgRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more