Enum fal_rust::client::ClientCredentials
source · pub enum ClientCredentials {
Key(String),
FromEnv(String),
KeyPair(String, String),
}
Variants§
Implementations§
source§impl ClientCredentials
impl ClientCredentials
sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Examples found in repository?
examples/stable_diffusion.rs (line 19)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
async fn main() {
let client = FalClient::new(ClientCredentials::from_env());
let res = client
.run(
"fal-ai/stable-cascade",
serde_json::json!({
"prompt": "A large waterfall in the middle of a volcano, surrounded by lush greenery and children's playground equipment.",
}),
)
.await
.unwrap();
let output: Output = res.json::<Output>().await.unwrap();
let url = output.images[0].url.clone();
let filename = url.split('/').last().unwrap();
download_image(&url, format!("{}/{}", "images", filename).as_str())
.await
.unwrap();
}
pub fn from_key(key: &str) -> Self
pub fn from_key_pair(key_id: &str, secret: &str) -> Self
Auto Trait Implementations§
impl Freeze for ClientCredentials
impl RefUnwindSafe for ClientCredentials
impl Send for ClientCredentials
impl Sync for ClientCredentials
impl Unpin for ClientCredentials
impl UnwindSafe for ClientCredentials
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