pub struct Ipify {
pub t: Op,
pub endp: String,
}Expand description
The main API struct
Fields§
§t: OpCurrent type of operation
endp: StringEndpoint, different for every operation
Implementations§
Source§impl Ipify
API Implementation
impl Ipify
API Implementation
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new API instance client with the defaults
Example:
use ipify_rs::*;
let a = Ipify::new();
println!("{}", a.call());Sourcepub fn set(&self, op: Op) -> Self
pub fn set(&self, op: Op) -> Self
Specify the subsequent operation to perform on call()
Examples:
use ipify_rs::{Ipify, Op};
let mut a = Ipify::new();
a.set(Op::IPv6J);
println!("{}", a.call());Sourcepub fn call(self) -> String
pub fn call(self) -> String
Actually perform the API call
Example:
use ipify_rs::Ipify;
let r = Ipify::new().call();
println!("my ip = {}", r);Sourcepub async fn call_async(self) -> String
pub async fn call_async(self) -> String
Actually perform the API call (async version)
Example:
use ipify_rs::Ipify;
async {
let r = Ipify::new().call_async().await;
println!("my ip = {}", r);
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ipify
impl RefUnwindSafe for Ipify
impl Send for Ipify
impl Sync for Ipify
impl Unpin for Ipify
impl UnwindSafe for Ipify
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