Skip to main content

AuthChecker

Trait AuthChecker 

Source
pub trait AuthChecker: Send + Sync {
    // Required methods
    fn is_authenticated(&self) -> bool;
    fn check_status(&self) -> AuthCheckResult;
}
Expand description

认证检查器 trait(同步版本,用于前置检查)。

§Examples

ⓘ
use gitflow_core::AuthChecker;

fn check_auth(checker: &dyn AuthChecker) {
    if checker.is_authenticated() {
        println!("User is authenticated");
    }
}

Required Methods§

Source

fn is_authenticated(&self) -> bool

快速检查是否已认证(不查询 API,仅检查本地凭据)。

§Returns

如果已认证返回 true,否则返回 false。

Source

fn check_status(&self) -> AuthCheckResult

获取认证检查的详细状态。

§Returns

包含认证状态、用户名、失败原因和修复建议的 AuthCheckResult。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§