pub struct StableDiffusionBotBuilder { /* private fields */ }
Expand description

Struct that builds a StableDiffusionBot instance.

Implementations§

source§

impl StableDiffusionBotBuilder

source

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.

source

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 optional String 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();
source

pub fn txt2img_defaults(self, request: Txt2ImgRequest) -> Self

Builder function that sets the defaults for text to image requests.

§Arguments
  • request - A Txt2ImgRequest 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();
source

pub fn clear_txt2img_defaults(self) -> Self

Builder function that clears the defaults for text to image requests.

source

pub fn img2img_defaults(self, request: Img2ImgRequest) -> Self

Builder function that sets the defaults for image to image requests.

§Arguments
  • request - An Img2ImgRequest 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();
source

pub fn clear_img2img_defaults(self) -> Self

Builder function that clears the defaults for image to image requests.

source

pub fn comfyui_config(self, _: ComfyUIConfig) -> Self

source

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§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsAny for T
where T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Get a reference to dyn Any.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Erasable for T

§

unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>

Unerase this erased pointer. Read more
§

const ACK_1_1_0: bool = true

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more