pub struct Aliyun<'a> { /* private fields */ }
Expand description
aliyun sms
Implementations
sourceimpl<'a> Aliyun<'a>
impl<'a> Aliyun<'a>
sourcepub fn new(access_key_id: &'a str, access_secret: &'a str) -> Self
pub fn new(access_key_id: &'a str, access_secret: &'a str) -> Self
init access key 初始化密钥
use sms::aliyun::Aliyun;
let aliyun = Aliyun::new("xxxx", "xxxx");
sourcepub async fn send_sms(
&self,
phone_numbers: &'a str,
sign_name: &'a str,
template_code: &'a str,
template_param: &'a str
) -> Result<HashMap<String, String>, Box<dyn Error>>
pub async fn send_sms(
&self,
phone_numbers: &'a str,
sign_name: &'a str,
template_code: &'a str,
template_param: &'a str
) -> Result<HashMap<String, String>, Box<dyn Error>>
send_sms 发送短信
use sms::aliyun::Aliyun;
use rand::prelude::*;
let aliyun = Aliyun::new("xxxx", "xxxx");
let mut rng = rand::thread_rng();
let code = format!(
r#"{{"code":"{}","product":"EchoLi"}}"#,
rng.gen_range(1000..=9999)
);
let resp = aliyun
.send_sms("18888888888", "登录验证", "SMS_123456", code.as_str())
.await
.unwrap();
println!("{:?}", resp);
Auto Trait Implementations
impl<'a> RefUnwindSafe for Aliyun<'a>
impl<'a> Send for Aliyun<'a>
impl<'a> Sync for Aliyun<'a>
impl<'a> Unpin for Aliyun<'a>
impl<'a> UnwindSafe for Aliyun<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more