Struct replicate_rust::collection::Collection
source · pub struct Collection {
pub parent: Config,
}
Fields§
§parent: Config
Holds a reference to a Config struct, which contains the base url, auth token among other settings.
Implementations§
source§impl Collection
impl Collection
sourcepub fn get(
&self,
collection_slug: String
) -> Result<GetCollectionModels, Box<dyn Error>>
pub fn get( &self, collection_slug: String ) -> Result<GetCollectionModels, Box<dyn Error>>
Get a collection by slug.
Example
use replicate_rust::{Replicate, config::Config};
let config = Config::default();
let replicate = Replicate::new(config);
match replicate.collections.get(String::from("audio-generation")) {
Ok(result) => println!("Success : {:?}", result),
Err(e) => println!("Error : {}", e),
}
sourcepub fn list(&self) -> Result<ListCollectionModels, Box<dyn Error>>
pub fn list(&self) -> Result<ListCollectionModels, Box<dyn Error>>
List all collections present in Replicate.
Example
use replicate_rust::{Replicate, config::Config};
let config = Config::default();
let replicate = Replicate::new(config);
match replicate.collections.list() {
Ok(result) => println!("Success : {:?}", result),
Err(e) => println!("Error : {}", e),
}
Auto Trait Implementations§
impl RefUnwindSafe for Collection
impl Send for Collection
impl Sync for Collection
impl Unpin for Collection
impl UnwindSafe for Collection
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