Struct ksoft::images::Images[][src]

pub struct Images { /* fields omitted */ }

Implementations

impl Images[src]

pub fn new(http_client: Arc<HttpClient>) -> Self[src]

pub async fn random_image(
    &self,
    tag: impl ToString,
    nsfw: bool
) -> HttpResult<Image, ImageError>
[src]

Gets a random image based in a given tag

Example

if let Ok(res) = client.images.random_image("doge", false).await {
    match res {
        Ok(image) => {
            //do something with the image
        },
        Err(why) => {
            //do something with the <ImageError> struct
        }
    }
}

pub async fn random_meme(&self) -> Result<RedditImage>[src]

Gets a random meme from reddit

Example

if let Ok(meme) = client.images.random_meme().await {
    //do something here
}

pub async fn random_aww(&self) -> Result<RedditImage>[src]

Gets a random cute image

Example

if let Ok(aww) = client.images.random_aww().await {
    //do something with the image
}

pub async fn random_reddit(
    &self,
    subreddit: impl ToString,
    remove_nsfw: bool,
    span: SpanType
) -> HttpResult<RedditImage, ImageError>
[src]

Gets a random post from a given subreddit

Example

if let Ok(res) = client.images.random_reddit("Technology", true, SpanType::Day).await {
    match res {
        Ok(red) => {
            //do something with the reddit image
        },
        Err(why) => {
            //do something with the <ImageError> struct
        }
    }
}

pub async fn random_wikihow(&self, nsfw: bool) -> Result<WikiHowImage>[src]

Gets a random WikiHow image

Example

if let Ok(wiki_image) = client.images.random_wikihow(false).await {
    //do something with the image
}

pub async fn get_tags(&self) -> Result<TagList>[src]

Gets a list of all tags available

Example

if let Ok(tags) = client.images.get_tags().await { //do something with all tags }

pub async fn get_image(
    &self,
    sf: impl ToString
) -> HttpResult<Image, ImageError>
[src]

Gets an image using its Snowflake

Example

if let Ok(res) = client.images.get_image("i-8ta8p52f-27").await {

pub async fn get_tag(&self, tag: impl ToString) -> Result<TagList>[src]

Get a tag using its name

Example

if let Ok(tag) = client.images.get_tag("doge").await {
    //do something with the tag
}

pub async fn random_nsfw(&self, gifs: bool) -> Result<RedditImage>[src]

Get a random NSFW image

Example

if let Ok(nsfw) = client.images.random_nsfw(true).await {
    //do something with the image
}

Auto Trait Implementations

impl !RefUnwindSafe for Images

impl Send for Images

impl Sync for Images

impl Unpin for Images

impl !UnwindSafe for Images

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]