Struct ksoft::images::Images [−][src]
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]
&self,
tag: impl ToString,
nsfw: bool
) -> HttpResult<Image, ImageError>
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]
&self,
subreddit: impl ToString,
remove_nsfw: bool,
span: SpanType
) -> HttpResult<RedditImage, ImageError>
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]
&self,
sf: impl ToString
) -> HttpResult<Image, ImageError>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,