#[non_exhaustive]pub enum LangHintSource {
CallerProvided,
FixtureExperimental,
Heuristic,
}Expand description
v0.10 Sprint 2 — LanguageHint 信息来源 enum。
caller 必须表明 lang 字符串来自哪类信息 — 影响 audit trail + 可信度判定。
into_lang_str() 决策时按 source × confidence 综合判 fail-closed 退化:
CallerProvided:caller 明确决策(如用户 locale 设置 / 业务上下文)— 高信任FixtureExperimental:fixture / 测试 / release-gate 模式 — 中信任(仅非 production)Heuristic:启发式 detect(unicode + 关键词)— 低信任,advisory only
SemVer:#[non_exhaustive] — 未来加 source(如 UserAgent / MlClassifier)
不破。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
CallerProvided
caller 显式传入(可信度最高;典型 user locale / 业务上下文)
FixtureExperimental
fixture / 测试 / release-gate 场景(权威源,但仅非 production)
Heuristic
启发式 lang detect(unicode 字符集 + 关键词;仅 advisory,不可作权威决策)
Implementations§
Source§impl LangHintSource
impl LangHintSource
Sourcepub fn is_trusted(&self) -> bool
pub fn is_trusted(&self) -> bool
该 source 是否本质可信(进 production 决策)。
Heuristic 始终 false(feedback_lang_review_authoritative 约束)。
Trait Implementations§
Source§impl Clone for LangHintSource
impl Clone for LangHintSource
Source§fn clone(&self) -> LangHintSource
fn clone(&self) -> LangHintSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LangHintSource
Source§impl Debug for LangHintSource
impl Debug for LangHintSource
impl Eq for LangHintSource
Source§impl Hash for LangHintSource
impl Hash for LangHintSource
Source§impl PartialEq for LangHintSource
impl PartialEq for LangHintSource
Source§fn eq(&self, other: &LangHintSource) -> bool
fn eq(&self, other: &LangHintSource) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LangHintSource
Auto Trait Implementations§
impl Freeze for LangHintSource
impl RefUnwindSafe for LangHintSource
impl Send for LangHintSource
impl Sync for LangHintSource
impl Unpin for LangHintSource
impl UnsafeUnpin for LangHintSource
impl UnwindSafe for LangHintSource
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