pub struct Args {
pub content: String,
pub version: u32,
pub scene: Scene,
pub openid: String,
pub title: Option<String>,
pub nickname: Option<String>,
pub signature: Option<String>,
}Expand description
微信内容安全检测请求参数
用于配置内容安全检测的各项参数,包括检测内容、场景、用户信息等。
§字段说明
content: 待检测的文本内容,最大长度2500字符version: 接口版本号,固定为2scene: 检测场景,不同场景有不同的检测策略openid: 用户openid,用户需在近两小时访问过小程序title: 文本标题(可选)nickname: 用户昵称(可选)signature: 个性签名,仅在资料场景有效(可选)
§示例
use wechat_minapp::minapp_security::{Args, Scene};
let args = Args::new("待检测的文本内容", Scene::Comment, "user_openid");
assert_eq!(args.content_length(), 18);
assert!(args.is_profile_scene());Fields§
§content: String需检测的文本内容,文本字数的上限为2500字,需使用UTF-8编码
version: u32接口版本号,2.0版本为固定值2
scene: Scene场景枚举值
openid: String用户的openid(用户需在近两小时访问过小程序)
title: Option<String>文本标题,需使用UTF-8编码
nickname: Option<String>用户昵称,需使用UTF-8编码
signature: Option<String>个性签名,该参数仅在资料类场景有效(scene=1),需使用UTF-8编码
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Args
impl RefUnwindSafe for Args
impl Send for Args
impl Sync for Args
impl Unpin for Args
impl UnsafeUnpin for Args
impl UnwindSafe for Args
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