Struct ActionContract
pub struct ActionContract {
pub availability: Availability,
pub kind: ActionKind,
pub field: Option<String>,
pub risk: RiskLevel,
pub confirmation: ConfirmationPolicy,
pub retry: RetryPolicy,
pub reversible: bool,
pub execution: ExecutionMode,
pub result: ResultSpec,
pub tags: Vec<String>,
}Expand description
Complete operational contract copied into every inert descriptor.
Fields§
§availability: Availability§kind: ActionKindWhat the action is able to do: read, change only the document, or reach outside it. Grants are given by kind, so every door decides by this and the action’s place in the published tree.
field: Option<String>The one field of its resource the action writes, when it writes only
one: the action sits below that field in the tree, so a grant on the
field (commenting is writing comments) reaches it.
risk: RiskLevel§confirmation: ConfirmationPolicy§retry: RetryPolicy§reversible: bool§execution: ExecutionMode§result: ResultSpecImplementations§
§impl ActionContract
impl ActionContract
pub fn need(&self) -> ActionNeed
pub fn need(&self) -> ActionNeed
What an invocation needs when its value does not say otherwise.
pub fn view() -> ActionContract
pub fn view() -> ActionContract
Safe defaults for a presentation-only operation.
pub fn for_operation(operation: OperationKind) -> ActionContract
pub fn for_operation(operation: OperationKind) -> ActionContract
The defaults for an operation of operation’s kind: a view reads, a
document operation changes only the document, an effect reaches
outside it.
pub fn is_programmatic(&self) -> bool
pub fn is_programmatic(&self) -> bool
Whether the action is offered only to programmatic callers. See
PROGRAMMATIC_TAG.
pub fn reads_document(&self) -> bool
pub fn reads_document(&self) -> bool
Whether the action reads the open document’s first page. See
DOCUMENT_READ_TAG.
pub fn carries_untrusted_content(&self) -> bool
pub fn carries_untrusted_content(&self) -> bool
Whether the action’s result carries content from outside the user’s
own data. See UNTRUSTED_CONTENT_TAG.
pub fn confirmation_depends_on_arguments(&self) -> bool
pub fn confirmation_depends_on_arguments(&self) -> bool
Whether confirmation depends on the invocation’s arguments. See
ARGUMENT_RISK_TAG.
pub fn advertised_confirmation(&self) -> ConfirmationPolicy
pub fn advertised_confirmation(&self) -> ConfirmationPolicy
The confirmation a caller that cannot classify arguments must assume:
the declared policy, or ConfirmationPolicy::Confirm for an action
whose risk depends on its arguments. A trust boundary that only sees
this inert contract (the session broker) gates on it; the publishing
host, which can classify, asks
ActionSpec::confirmation_for_json.
pub fn confirmation_for_argument(
&self,
argument: Option<&str>,
) -> ConfirmationPolicy
pub fn confirmation_for_argument( &self, argument: Option<&str>, ) -> ConfirmationPolicy
The confirmation an invocation with argument (the wire argument:
typed JSON behind ARGUMENTS_JSON_PREFIX)
needs, decided without the publishing app’s code: the declared
policy; for a generic field edit, the edit itself read by
tilo_action_policy::edits::field_edit_asks; for any other action
whose risk depends on its arguments, Self::advertised_confirmation.
pub fn validate_declaration(&self) -> Vec<String>
pub fn validate_declaration(&self) -> Vec<String>
Validate the contract as inert protocol data. This is intentionally usable at both publication ends: a well-behaved app checks before it sends, and the broker repeats the check at its trust boundary.
§impl ActionContract
impl ActionContract
pub fn requirements(&self) -> Vec<ContextRequirement>
pub fn requirements(&self) -> Vec<ContextRequirement>
The context preconditions declared on this contract, in order.
pub fn is_participant_view(&self) -> bool
pub fn is_participant_view(&self) -> bool
Whether this View contract changes only the invoking participant’s
view (PARTICIPANT_VIEW_TAG).
Trait Implementations§
§impl Clone for ActionContract
impl Clone for ActionContract
§fn clone(&self) -> ActionContract
fn clone(&self) -> ActionContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ActionContract
impl Debug for ActionContract
§impl Default for ActionContract
impl Default for ActionContract
§fn default() -> ActionContract
fn default() -> ActionContract
§impl<'de> Deserialize<'de> for ActionContract
impl<'de> Deserialize<'de> for ActionContract
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActionContract, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActionContract, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for ActionContract
impl PartialEq for ActionContract
§impl Serialize for ActionContract
impl Serialize for ActionContract
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ActionContract
impl StructuralPartialEq for ActionContract
Auto Trait Implementations§
impl Freeze for ActionContract
impl RefUnwindSafe for ActionContract
impl Send for ActionContract
impl Sync for ActionContract
impl Unpin for ActionContract
impl UnsafeUnpin for ActionContract
impl UnwindSafe for ActionContract
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more