| Crates.io | fal-derive |
| lib.rs | fal-derive |
| version | 0.1.0 |
| created_at | 2025-03-09 07:08:51.525655+00 |
| updated_at | 2025-03-09 07:08:51.525655+00 |
| description | Macros for creating fal API endpoint functions |
| homepage | |
| repository | https://github.com/carlosdp/fal-rs |
| max_upload_size | |
| id | 1585220 |
| size | 7,300 |
Creates a custom endpoint function, compatible with the fal API.
use fal::prelude::*;
use serde::Deserialize;
#[derive(Deserialize)]
pub struct FalResponse {
pub images: Vec<File>,
}
#[endpoint(endpoint="fal-ai/flux/dev")]
pub fn flux_dev(prompt: String) -> FalResponse {}
// This endpoint function can now be used to call the fal endpoint:
#[tokio::main]
async fn main() {
let response = flux_dev("an horse riding an astronaut".to_owned())
.send()
.await
.unwrap();
println!("Generated image URL: {}", response.images[0].url);
}