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)
18async fn main() {
19 let client = FalClient::new(ClientCredentials::from_env());
20
21 let res = client
22 .run(
23 "fal-ai/stable-cascade",
24 serde_json::json!({
25 "prompt": "A large waterfall in the middle of a volcano, surrounded by lush greenery and children's playground equipment.",
26 }),
27 )
28 .await
29 .unwrap();
30
31 let output: Output = res.json::<Output>().await.unwrap();
32
33 let url = output.images[0].url.clone();
34 let filename = url.split('/').last().unwrap();
35
36 download_image(&url, format!("{}/{}", "images", filename).as_str())
37 .await
38 .unwrap();
39}
pub fn from_key(key: &str) -> Self
pub fn from_key_pair(key_id: &str, secret: &str) -> Self
Trait Implementations§
Source§impl Clone for ClientCredentials
impl Clone for ClientCredentials
Source§fn clone(&self) -> ClientCredentials
fn clone(&self) -> ClientCredentials
Returns a copy of the value. Read more
1.0.0 · 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 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