Expand description
查询参数常量定义模块
本模块定义了飞书API中常用的查询参数名称常量,旨在:
- 减少字符串分配开销 - 使用&’static str替代重复的.to_string()调用
- 提高代码一致性 - 统一参数名称,避免拼写错误
- 便于维护管理 - 集中管理所有查询参数常量
§性能影响
使用本模块常量可以显著减少内存分配:
use open_lark::core::query_params::QueryParams;
use std::collections::HashMap;
let mut params = HashMap::new();
let value = "20".to_string();
// 优化前: 每次调用都分配新字符串
params.insert("page_size", value.clone());
// 优化后: 使用静态字符串常量
params.insert(QueryParams::PAGE_SIZE, value);§使用示例
use open_lark::core::query_params::QueryParams;
use std::collections::HashMap;
let mut params = HashMap::new();
params.insert(QueryParams::PAGE_SIZE, "20".to_string());
let token = "next-page-token".to_string();
params.insert(QueryParams::PAGE_TOKEN, token);Structs§
- Query
Params - 飞书API查询参数常量定义
- Query
Params Builder - 查询参数构建器