pub struct TestPolicy { /* private fields */ }Implementations§
Trait Implementations§
Source§impl Policy for TestPolicy
impl Policy for TestPolicy
type Effect = TestEffect
type Action<'a> = TestActions
type Command<'a> = TestProtocol<'a>
Source§fn serial(&self) -> u32
fn serial(&self) -> u32
Policies have a serial number which can be used to order them.
This is used to support inband policy upgrades.
Source§fn call_rule(
&self,
command: &impl Command,
facts: &mut impl FactPerspective,
sink: &mut impl Sink<Self::Effect>,
_recall: CommandRecall,
) -> Result<(), EngineError>
fn call_rule( &self, command: &impl Command, facts: &mut impl FactPerspective, sink: &mut impl Sink<Self::Effect>, _recall: CommandRecall, ) -> Result<(), EngineError>
Evaluate a command at the given perspective. If the command is accepted, effects may
be emitted to the sink and facts may be written to the perspective. Returns an error
for a rejected command.
Source§fn merge<'a>(
&self,
target: &'a mut [u8],
ids: MergeIds,
) -> Result<TestProtocol<'a>, EngineError>
fn merge<'a>( &self, target: &'a mut [u8], ids: MergeIds, ) -> Result<TestProtocol<'a>, EngineError>
Produces a merge message serialized to target. The
struct representing the
Command is returned.Source§fn call_action(
&self,
action: Self::Action<'_>,
facts: &mut impl Perspective,
sink: &mut impl Sink<Self::Effect>,
) -> Result<(), EngineError>
fn call_action( &self, action: Self::Action<'_>, facts: &mut impl Perspective, sink: &mut impl Sink<Self::Effect>, ) -> Result<(), EngineError>
Process an action checking each published command against the policy and emitting
effects to the sink. All published commands are handled transactionally where if any
published command is rejected no commands are added to the storage.
Auto Trait Implementations§
impl Freeze for TestPolicy
impl RefUnwindSafe for TestPolicy
impl Send for TestPolicy
impl Sync for TestPolicy
impl Unpin for TestPolicy
impl UnwindSafe for TestPolicy
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