pub struct WxOpenDefaultConfig { /* private fields */ }Expand description
开放平台默认配置存储(内存实现)。
Implementations§
Source§impl WxOpenDefaultConfig
impl WxOpenDefaultConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
构建默认配置(Java 以无参构造 + setter 装配,Rust 提供同名语义的 便捷构造;字段默认 None/0/1000/5,与 Java 字段默认值一致)。
Sourcepub fn set_component_app_id(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_component_app_id(&mut self, v: impl Into<String>) -> &mut Self
设置第三方平台 appid。
Sourcepub fn set_component_app_secret(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_component_app_secret(&mut self, v: impl Into<String>) -> &mut Self
设置第三方平台 appsecret。
Sourcepub fn set_component_token(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_component_token(&mut self, v: impl Into<String>) -> &mut Self
设置消息校验 Token。
Sourcepub fn set_component_aes_key(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_component_aes_key(&mut self, v: impl Into<String>) -> &mut Self
设置消息加解密 Key。
Sourcepub fn set_component_verify_ticket(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_component_verify_ticket(&mut self, v: impl Into<String>) -> &mut Self
设置推送的 verify ticket。
Sourcepub fn set_http_proxy_host(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_http_proxy_host(&mut self, v: impl Into<String>) -> &mut Self
设置 HTTP 代理主机。
Sourcepub fn set_http_proxy_port(&mut self, v: i32) -> &mut Self
pub fn set_http_proxy_port(&mut self, v: i32) -> &mut Self
设置 HTTP 代理端口。
Sourcepub fn set_http_proxy_username(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_http_proxy_username(&mut self, v: impl Into<String>) -> &mut Self
设置 HTTP 代理用户名。
Sourcepub fn set_http_proxy_password(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_http_proxy_password(&mut self, v: impl Into<String>) -> &mut Self
设置 HTTP 代理密码。
Sourcepub fn set_retry_sleep_millis(&mut self, v: i32) -> &mut Self
pub fn set_retry_sleep_millis(&mut self, v: i32) -> &mut Self
设置 HTTP 请求重试间隔(毫秒)。
Sourcepub fn set_max_retry_times(&mut self, v: i32) -> &mut Self
pub fn set_max_retry_times(&mut self, v: i32) -> &mut Self
设置 HTTP 请求最大重试次数。
Sourcepub fn set_api_host_url(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_api_host_url(&mut self, v: impl Into<String>) -> &mut Self
设置自定义 API 主机地址(对应 Java setApiHostUrl(String))。
Sourcepub fn set_access_token_url(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_access_token_url(&mut self, v: impl Into<String>) -> &mut Self
设置自定义获取 accessToken 地址(对应 Java setAccessTokenUrl(String))。
Sourcepub fn api_host_url(&self) -> Option<String>
pub fn api_host_url(&self) -> Option<String>
自定义 API 主机地址(对应 Java getApiHostUrl())。
Sourcepub fn access_token_url(&self) -> Option<String>
pub fn access_token_url(&self) -> Option<String>
自定义获取 accessToken 地址(对应 Java getAccessTokenUrl())。
Sourcepub fn effective_api_host_url(&self) -> String
pub fn effective_api_host_url(&self) -> String
根据配置获取实际应使用的 API 主机地址(对应 Java
getEffectiveApiHostUrl():自定义 apiHostUrl 优先,否则默认
https://api.weixin.qq.com)。
Trait Implementations§
Source§impl Debug for WxOpenDefaultConfig
impl Debug for WxOpenDefaultConfig
Source§impl Default for WxOpenDefaultConfig
impl Default for WxOpenDefaultConfig
Source§impl WxOpenConfigStorage for WxOpenDefaultConfig
impl WxOpenConfigStorage for WxOpenDefaultConfig
Source§fn component_app_id(&self) -> Option<String>
fn component_app_id(&self) -> Option<String>
第三方平台 appid(对应 Java
getComponentAppId())。Source§fn set_component_app_id(&self, component_app_id: &str)
fn set_component_app_id(&self, component_app_id: &str)
设置第三方平台 appid(对应 Java
setComponentAppId(String))。Source§fn component_app_secret(&self) -> Option<String>
fn component_app_secret(&self) -> Option<String>
第三方平台 appsecret(对应 Java
getComponentAppSecret())。Source§fn set_component_app_secret(&self, component_app_secret: &str)
fn set_component_app_secret(&self, component_app_secret: &str)
设置第三方平台 appsecret(对应 Java
setComponentAppSecret(String))。Source§fn component_token(&self) -> Option<String>
fn component_token(&self) -> Option<String>
消息校验 Token(对应 Java
getComponentToken())。Source§fn set_component_token(&self, component_token: &str)
fn set_component_token(&self, component_token: &str)
设置消息校验 Token(对应 Java
setComponentToken(String))。Source§fn component_aes_key(&self) -> Option<String>
fn component_aes_key(&self) -> Option<String>
消息加解密 Key(对应 Java
getComponentAesKey())。Source§fn set_component_aes_key(&self, component_aes_key: &str)
fn set_component_aes_key(&self, component_aes_key: &str)
设置消息加解密 Key(对应 Java
setComponentAesKey(String))。Source§fn component_verify_ticket(&self) -> Option<String>
fn component_verify_ticket(&self) -> Option<String>
推送的 verify ticket(对应 Java
getComponentVerifyTicket())。Source§fn set_component_verify_ticket(&self, component_verify_ticket: &str)
fn set_component_verify_ticket(&self, component_verify_ticket: &str)
设置推送的 verify ticket(对应 Java
setComponentVerifyTicket(String))。Source§fn component_access_token(&self) -> Option<String>
fn component_access_token(&self) -> Option<String>
当前缓存的 component_access_token(对应 Java
getComponentAccessToken())。Source§fn is_component_access_token_expired(&self) -> bool
fn is_component_access_token_expired(&self) -> bool
component_access_token 是否已过期(对应 Java
isComponentAccessTokenExpired())。Source§fn expire_component_access_token(&self)
fn expire_component_access_token(&self)
强制将 component_access_token 过期(对应 Java
expireComponentAccessToken())。Source§fn update_component_access_token_with_expiry(
&self,
component_access_token: &str,
expires_in_seconds: i32,
)
fn update_component_access_token_with_expiry( &self, component_access_token: &str, expires_in_seconds: i32, )
线程安全地更新 component_access_token(对应 Java
updateComponentAccessToken(String, int) 重载)。Source§fn component_access_token_lock(&self) -> Arc<AsyncMutex<()>> ⓘ
fn component_access_token_lock(&self) -> Arc<AsyncMutex<()>> ⓘ
component_access_token 锁(对应 Java
getComponentAccessTokenLock())。Source§fn lock_by_key(&self, key: &str) -> Arc<AsyncMutex<()>> ⓘ
fn lock_by_key(&self, key: &str) -> Arc<AsyncMutex<()>> ⓘ
按 key 取锁(对应 Java
getLockByKey(String),并发仅刷新一次语义)。Source§fn wx_open_host_config(&self) -> Option<WxOpenHostConfig>
fn wx_open_host_config(&self) -> Option<WxOpenHostConfig>
自定义域名配置(对应 mp/ma 的 host config 语义)。 Read more
授权方 refresh_token(对应 Java
getAuthorizerRefreshToken(String))。设置授权方 refresh_token(对应 Java
setAuthorizerRefreshToken(String, String))。授权方 access_token(对应 Java
getAuthorizerAccessToken(String))。授权方 access_token 是否过期(对应 Java
isAuthorizerAccessTokenExpired(String))。强制将授权方 access_token 过期(对应 Java
expireAuthorizerAccessToken(String))。线程安全地更新授权方 access_token(对应 Java
updateAuthorizerAccessToken(String, String, int) 重载)。Source§fn jsapi_ticket(&self, app_id: &str) -> Option<String>
fn jsapi_ticket(&self, app_id: &str) -> Option<String>
授权方 jsapi ticket(对应 Java
getJsapiTicket(String))。Source§fn is_jsapi_ticket_expired(&self, app_id: &str) -> bool
fn is_jsapi_ticket_expired(&self, app_id: &str) -> bool
授权方 jsapi ticket 是否过期(对应 Java
isJsapiTicketExpired(String))。Source§fn expire_jsapi_ticket(&self, app_id: &str)
fn expire_jsapi_ticket(&self, app_id: &str)
强制将授权方 jsapi ticket 过期(对应 Java
expireJsapiTicket(String))。Source§fn update_jsapi_ticket(
&self,
app_id: &str,
jsapi_ticket: &str,
expires_in_seconds: i32,
)
fn update_jsapi_ticket( &self, app_id: &str, jsapi_ticket: &str, expires_in_seconds: i32, )
线程安全地更新授权方 jsapi ticket(对应 Java
updateJsapiTicket(String, String, int))。Source§fn card_api_ticket(&self, app_id: &str) -> Option<String>
fn card_api_ticket(&self, app_id: &str) -> Option<String>
授权方卡券 api ticket(对应 Java
getCardApiTicket(String))。Source§fn is_card_api_ticket_expired(&self, app_id: &str) -> bool
fn is_card_api_ticket_expired(&self, app_id: &str) -> bool
授权方卡券 api ticket 是否过期(对应 Java
isCardApiTicketExpired(String))。Source§fn expire_card_api_ticket(&self, app_id: &str)
fn expire_card_api_ticket(&self, app_id: &str)
强制将授权方卡券 api ticket 过期(对应 Java
expireCardApiTicket(String))。Source§fn update_card_api_ticket(
&self,
app_id: &str,
card_api_ticket: &str,
expires_in_seconds: i32,
)
fn update_card_api_ticket( &self, app_id: &str, card_api_ticket: &str, expires_in_seconds: i32, )
线程安全地更新授权方卡券 api ticket(对应 Java
updateCardApiTicket(String, String, int))。Source§fn http_proxy_host(&self) -> Option<String>
fn http_proxy_host(&self) -> Option<String>
HTTP 代理主机(对应 Java
getHttpProxyHost())。Source§fn http_proxy_port(&self) -> i32
fn http_proxy_port(&self) -> i32
HTTP 代理端口(对应 Java
getHttpProxyPort())。Source§fn http_proxy_username(&self) -> Option<String>
fn http_proxy_username(&self) -> Option<String>
HTTP 代理用户名(对应 Java
getHttpProxyUsername())。Source§fn http_proxy_password(&self) -> Option<String>
fn http_proxy_password(&self) -> Option<String>
HTTP 代理密码(对应 Java
getHttpProxyPassword())。Source§fn retry_sleep_millis(&self) -> i32
fn retry_sleep_millis(&self) -> i32
HTTP 请求重试间隔(毫秒,对应 Java
getRetrySleepMillis(),默认 1000)。Source§fn max_retry_times(&self) -> i32
fn max_retry_times(&self) -> i32
HTTP 请求最大重试次数(对应 Java
getMaxRetryTimes(),默认 5)。Source§fn component_api_signature_rsa_private_key(&self) -> Option<String>
fn component_api_signature_rsa_private_key(&self) -> Option<String>
第三方平台设置 API 签名 RSA 私钥(对应 Java
getComponentApiSignatureRsaPrivateKey())。Source§fn set_component_api_signature_rsa_private_key(
&self,
api_signature_rsa_private_key: &str,
)
fn set_component_api_signature_rsa_private_key( &self, api_signature_rsa_private_key: &str, )
设置 API 签名 RSA 私钥(对应 Java
setComponentApiSignatureRsaPrivateKey(String))。Source§fn component_api_signature_aes_key(&self) -> Option<String>
fn component_api_signature_aes_key(&self) -> Option<String>
API 签名 AES KEY(对应 Java
getComponentApiSignatureAesKey())。Source§fn set_component_api_signature_aes_key(&self, api_signature_aes_key: &str)
fn set_component_api_signature_aes_key(&self, api_signature_aes_key: &str)
设置 API 签名 AES KEY(对应 Java
setComponentApiSignatureAesKey(String))。Source§fn component_api_signature_rsa_private_key_sn(&self) -> Option<String>
fn component_api_signature_rsa_private_key_sn(&self) -> Option<String>
API 签名 RSA 私钥序号(对应 Java
getComponentApiSignatureRsaPrivateKeySn())。Source§fn set_component_api_signature_rsa_private_key_sn(
&self,
api_signature_rsa_private_key_sn: &str,
)
fn set_component_api_signature_rsa_private_key_sn( &self, api_signature_rsa_private_key_sn: &str, )
设置 API 签名 RSA 私钥序号(对应 Java
setComponentApiSignatureRsaPrivateKeySn(String))。Source§fn component_api_signature_aes_key_sn(&self) -> Option<String>
fn component_api_signature_aes_key_sn(&self) -> Option<String>
API 签名 AES key 序号(对应 Java
getComponentApiSignatureAesKeySn())。Source§fn set_component_api_signature_aes_key_sn(&self, api_signature_aes_key_sn: &str)
fn set_component_api_signature_aes_key_sn(&self, api_signature_aes_key_sn: &str)
设置 API 签名 AES key 序号(对应 Java
setComponentApiSignatureAesKeySn(String))。Source§fn set_wx_open_info(
&self,
component_app_id: &str,
component_app_secret: &str,
component_token: &str,
component_aes_key: &str,
)
fn set_wx_open_info( &self, component_app_id: &str, component_app_secret: &str, component_token: &str, component_aes_key: &str, )
设置第三方平台基础信息(对应 Java
setWxOpenInfo 四参便捷方法)。Source§fn update_component_access_token(
&self,
component_access_token: &WxOpenComponentAccessToken,
)
fn update_component_access_token( &self, component_access_token: &WxOpenComponentAccessToken, )
线程安全地更新 component_access_token(对应 Java
updateComponentAccessToken(WxOpenComponentAccessToken))。Source§fn auto_refresh_token(&self) -> bool
fn auto_refresh_token(&self) -> bool
token 过期时是否自动刷新(对应 Java
autoRefreshToken(),默认 true)。更新授权方 refresh_token(对应 Java
updateAuthorizerRefreshToken(String, String)
重载方法,Java 语义与 set 相同)。线程安全地更新授权方 access_token(对应 Java
updateAuthorizerAccessToken(String, WxOpenAuthorizerAccessToken))。Source§fn wx_mp_config_storage(
&self,
_app_id: &str,
) -> Option<Arc<dyn WxConfigStorage>>
fn wx_mp_config_storage( &self, _app_id: &str, ) -> Option<Arc<dyn WxConfigStorage>>
按 appId 取代公众号配置存储(对应 Java
getWxMpConfigStorage(String))。 Read moreSource§fn wx_ma_config(&self, _app_id: &str) -> Option<Arc<dyn WxConfigStorage>>
fn wx_ma_config(&self, _app_id: &str) -> Option<Arc<dyn WxConfigStorage>>
按 appId 取代小程序配置存储(对应 Java
getWxMaConfig(String))。 Read moreAuto Trait Implementations§
impl !Freeze for WxOpenDefaultConfig
impl !RefUnwindSafe for WxOpenDefaultConfig
impl !UnwindSafe for WxOpenDefaultConfig
impl Send for WxOpenDefaultConfig
impl Sync for WxOpenDefaultConfig
impl Unpin for WxOpenDefaultConfig
impl UnsafeUnpin for WxOpenDefaultConfig
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