pub struct Query<'q> {
pub q: &'q str,
pub from: &'q str,
pub to: &'q str,
pub sign: String,
}Expand description
翻译前的必要信息
Fields§
§q: &'q str请求翻译 query,必须为 UTF-8 编码。
TODO: 在传入之前应该把文字控制在 6000 字节以内(汉字约为 2000 个字符), 超过 6000 字节要分段请求。
from: &'q str翻译源语言,可设置为 auto
TODO:变成 Option + enum 类型,None 表示 auto
to: &'q str翻译目标语言,不可设置为 auto
TODO:和 from 共用 enum 类型,但无需是 Option 类型
sign: Stringappid+q+salt+密钥的 MD5 值,q 是待查询的原文字符串
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'q> Freeze for Query<'q>
impl<'q> RefUnwindSafe for Query<'q>
impl<'q> Send for Query<'q>
impl<'q> Sync for Query<'q>
impl<'q> Unpin for Query<'q>
impl<'q> UnwindSafe for Query<'q>
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