pub enum AuthConfig {
Bearer,
ApiKeyHeader {
header_name: String,
},
None,
Custom(Arc<dyn Fn(&str) -> Vec<(String, String)> + Send + Sync>),
}Expand description
认证配置
定义如何处理 API 认证。
Variants§
Bearer
Bearer token 认证
生成: Authorization: Bearer {token}
ApiKeyHeader
API Key header 认证
生成: {header_name}: {token}
None
无认证
Custom(Arc<dyn Fn(&str) -> Vec<(String, String)> + Send + Sync>)
自定义认证(通过闭包)
闭包接收 token,返回头部列表
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthConfig
impl !RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl !UnwindSafe for AuthConfig
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