pub struct ImageInstrument { /* private fields */ }
Expand description
Struct help in encoding image from file/url to base64 string
§Examples
use rust_anticaptcha::instruments::image_instrument::ImageInstrument;
let image_instrument = ImageInstrument::new();
Implementations§
Source§impl ImageInstrument
impl ImageInstrument
Sourcepub fn read_image_file(&self, file_path: String) -> String
pub fn read_image_file(&self, file_path: String) -> String
Method read image file and return base64 string
§Arguments
file_path
- path to image on local system
§Examples
use rust_anticaptcha::instruments::image_instrument::ImageInstrument;
let image_instrument = ImageInstrument::new();
let base64_str = image_instrument.read_image_file("files/captcha-image.jpg".to_string());
§Returns
Method return image as base64 string
Sourcepub async fn read_image_link(&self, file_url: String) -> String
pub async fn read_image_link(&self, file_url: String) -> String
Method read image file from link and return base64 string
§Arguments
file_url
- image URL
§Examples
use rust_anticaptcha::instruments::image_instrument::ImageInstrument;
let image_instrument = ImageInstrument::new();
let base64_str = image_instrument.read_image_link("https://some-file-url.jpg".to_string());
§Returns
Method return image as base64 string
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageInstrument
impl RefUnwindSafe for ImageInstrument
impl Send for ImageInstrument
impl Sync for ImageInstrument
impl Unpin for ImageInstrument
impl UnwindSafe for ImageInstrument
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