[−][src]Struct ksoft::images::Images
Fields
http: Arc<HttpClient>
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
ⓘThis example is not tested
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
ⓘThis example is not tested
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
ⓘThis example is not tested
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
ⓘThis example is not tested
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
ⓘThis example is not tested
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 AsRef<str>
) -> HttpResult<Image, ImageError>
[src]
&'_ self,
sf: impl AsRef<str>
) -> HttpResult<Image, ImageError>
Gets an image using its Snowflake
Example
ⓘThis example is not tested
if let Ok(res) = client.images.get_image("i-8ta8p52f-27").await {
pub async fn get_tag<'_>(&'_ self, tag: impl AsRef<str>) -> Result<TagList>
[src]
Get a tag using its name
Example
ⓘThis example is not tested
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
ⓘThis example is not tested
if let Ok(nsfw) = client.images.random_nsfw(true).await { //do something with the image }
Auto Trait Implementations
impl !RefUnwindSafe for Images
[src]
impl Send for Images
[src]
impl Sync for Images
[src]
impl Unpin for Images
[src]
impl !UnwindSafe for Images
[src]
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>,