Skip to main content

Policy

Trait Policy 

Source
pub trait Policy<Context>
where Context: ?Sized,
{ type Error; // Required method fn check(&self, context: &Context) -> Result<(), Self::Error>; }
Expand description

English:
Fallible domain rule checked against a borrowed, possibly unsized context. Rejection and inability to evaluate are both represented by the implementation’s error type. This trait does not enforce the rule automatically at other domain boundaries.

日本語:
サイズ不定でもよいコンテキストを借用して確認する、失敗し得るドメイン規則です。 拒否と評価不能は、どちらも実装のエラー型で表現します。 他のドメイン境界で規則を自動的に強制するものではありません。

Required Associated Types§

Source

type Error

English:
Policy-specific rejection or evaluation failure.

日本語:
ポリシー固有の拒否または評価の失敗です。

Required Methods§

Source

fn check(&self, context: &Context) -> Result<(), Self::Error>

English:
Returns Ok(()) when context passes the rule, otherwise a policy error. No ownership of the context is transferred; effects and panics depend on the implementation.

日本語:
context が規則を満たす場合は Ok(())、それ以外はポリシーエラーを返します。 コンテキストの所有権は移らず、副作用とパニックは実装に依存します。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§