pub struct DiffusionClient { /* private fields */ }Expand description
The client used to interact with the diffusion.to API
Implementations§
Source§impl DiffusionClient
impl DiffusionClient
pub fn new(key: String) -> Result<Self>
Sourcepub async fn request_image(&self, request: ImageRequest) -> Result<ImageToken>
pub async fn request_image(&self, request: ImageRequest) -> Result<ImageToken>
Request an image be created, using the given request to fill out the parameters for the API image to create. It returns a token that can then be used to check the status of the image and received the image when complete.
Sourcepub async fn check_status(&self, token: ImageToken) -> Result<DiffusionImage>
pub async fn check_status(&self, token: ImageToken) -> Result<DiffusionImage>
Check the status of the image using the token received from
a request_image() call
Sourcepub async fn check_and_wait(
&self,
token: ImageToken,
max_wait_time: Option<Duration>,
) -> Result<DiffusionImage>
pub async fn check_and_wait( &self, token: ImageToken, max_wait_time: Option<Duration>, ) -> Result<DiffusionImage>
Check the status of the image and wait for a maximum amount of time for the image
to complete before returning the image response. This method will continue to poll
every five seconds until either the image has been completed or the max time is hit.
If None is passed for maximum time, then the method will poll indefinitely until the
image is complete.
Auto Trait Implementations§
impl Freeze for DiffusionClient
impl !RefUnwindSafe for DiffusionClient
impl Send for DiffusionClient
impl Sync for DiffusionClient
impl Unpin for DiffusionClient
impl !UnwindSafe for DiffusionClient
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