Struct dagpirs::image::Image [−][src]
Image Manipulation Functions for async client.
Implementations
impl Image
[src]
pub fn new(http: Arc<Client>) -> Self
[src]
pub async fn image_process(
&self,
url: String,
manipulation: ImageManipulation
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
manipulation: ImageManipulation
) -> HttpResult<ImageResponse, String>
Sample Image Processing This example processes a URL and saves a format aware Image
Example
use dagpirs::{Client, Bytes}; // Only here the std fs is used, in prod for async use the tokio::fs; use std::fs; use std::io::Write; use tokio; #[tokio::main] async fn main() { let token = std::env::var("DAGPI_TOKEN").unwrap(); let c = Client::new(&token).unwrap(); if let Ok(i) = c.image.image_process("https://dagpi.xyz/dagpi.png".to_string(), dagpirs::models::ImageManipulation::Wanted).await { match i { Ok(im) => { let buff: Bytes = im.bytes; let mut f = fs::File::create(format!("wanted.{}", im.format)).unwrap(); f.write_all(buff.to_vec().as_slice()).unwrap(); }, Err(e) => panic!("{}", e) } } }
pub async fn image_process_text(
&self,
url: String,
text: String,
manipulation: ImageManipulationText
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
text: String,
manipulation: ImageManipulationText
) -> HttpResult<ImageResponse, String>
Process an image with text
pub async fn image_process_top_bottom(
&self,
url: String,
top_text: String,
bottom_text: String,
manipulation: ImageManipulationTopBottom
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
top_text: String,
bottom_text: String,
manipulation: ImageManipulationTopBottom
) -> HttpResult<ImageResponse, String>
Process and Image with both top and bottom text
pub async fn tweet(
&self,
url: String,
username: String,
text: String
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
username: String,
text: String
) -> HttpResult<ImageResponse, String>
Generate a realistic fake tweet
pub async fn yt(
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
Generate a realistic fake youtube comment
pub async fn discord_message(
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
username: String,
text: String,
dark: bool
) -> HttpResult<ImageResponse, String>
Generate a realistic fake discord message
pub async fn pride(
&self,
url: String,
flag: Pride
) -> HttpResult<ImageResponse, String>
[src]
&self,
url: String,
flag: Pride
) -> HttpResult<ImageResponse, String>
Put a pride flag overlay over an image from a selection of pride flags
Auto Trait Implementations
impl !RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl !UnwindSafe for Image
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>,