pub struct StableDiffusionBotBuilder { /* private fields */ }
Expand description
Struct that builds a StableDiffusionBot instance.
Implementations§
source§impl StableDiffusionBotBuilder
impl StableDiffusionBotBuilder
sourcepub fn new(
api_key: String,
allowed_users: Vec<i64>,
sd_api_url: String,
api_type: ApiType,
allow_all_users: bool,
) -> Self
pub fn new( api_key: String, allowed_users: Vec<i64>, sd_api_url: String, api_type: ApiType, allow_all_users: bool, ) -> Self
Constructor that returns a new StableDiffusionBotBuilder instance.
sourcepub fn db_path(self, path: Option<String>) -> Self
pub fn db_path(self, path: Option<String>) -> Self
Builder function that sets the path of the storage database for the bot.
§Arguments
path
- An optionalString
representing the path to the storage database.
§Examples
ⓘ
let builder = StableDiffusionBotBuilder::new(api_key, allowed_users, sd_api_url, allow_all_users);
let bot = builder.db_path(Some("database.sqlite".to_string())).build().await.unwrap();
sourcepub fn txt2img_defaults(self, request: Txt2ImgRequest) -> Self
pub fn txt2img_defaults(self, request: Txt2ImgRequest) -> Self
Builder function that sets the defaults for text to image requests.
§Arguments
request
- ATxt2ImgRequest
representing the default settings for text to image conversion.
§Examples
let builder = StableDiffusionBotBuilder::new(api_key, allowed_users, sd_api_url, api_type, allow_all_users);
let bot = builder.txt2img_defaults(Txt2ImgRequest::default()).build().await.unwrap();
sourcepub fn clear_txt2img_defaults(self) -> Self
pub fn clear_txt2img_defaults(self) -> Self
Builder function that clears the defaults for text to image requests.
sourcepub fn img2img_defaults(self, request: Img2ImgRequest) -> Self
pub fn img2img_defaults(self, request: Img2ImgRequest) -> Self
Builder function that sets the defaults for image to image requests.
§Arguments
request
- AnImg2ImgRequest
representing the default settings for image to image conversion.
§Examples
let builder = StableDiffusionBotBuilder::new(api_key, allowed_users, sd_api_url, api_type, allow_all_users);
let bot = builder.img2img_defaults(Img2ImgRequest::default()).build().await.unwrap();
sourcepub fn clear_img2img_defaults(self) -> Self
pub fn clear_img2img_defaults(self) -> Self
Builder function that clears the defaults for image to image requests.
pub fn comfyui_config(self, _: ComfyUIConfig) -> Self
sourcepub async fn build(self) -> Result<StableDiffusionBot>
pub async fn build(self) -> Result<StableDiffusionBot>
Consumes the builder and builds a StableDiffusionBot
instance.
§Examples
let builder = StableDiffusionBotBuilder::new(api_key, allowed_users, sd_api_url, api_type, allow_all_users);
let bot = builder.build().await.unwrap();
Auto Trait Implementations§
impl Freeze for StableDiffusionBotBuilder
impl RefUnwindSafe for StableDiffusionBotBuilder
impl Send for StableDiffusionBotBuilder
impl Sync for StableDiffusionBotBuilder
impl Unpin for StableDiffusionBotBuilder
impl UnwindSafe for StableDiffusionBotBuilder
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