pub struct GateRequest {
pub actor: ActorRef,
pub namespace: Namespace,
pub verb: String,
pub args: Value,
pub context: GateContext,
}Expand description
What the gate sees on every verb invocation.
The JSON projection of this struct is the input shape policies receive
(e.g. Rego’s input.actor, input.verb, input.args). The shape is a
public contract — changing field names is a breaking change.
Invariant: verb must be non-empty. actor is validated by ActorRef.
Enforced at construction and deserialization.
Fields§
§actor: ActorRef§namespace: Namespace§verb: String§args: Value§context: GateContextImplementations§
Source§impl GateRequest
impl GateRequest
Sourcepub fn try_new(
actor: ActorRef,
namespace: Namespace,
verb: impl Into<String>,
args: Value,
) -> Result<GateRequest, GateValidationError>
pub fn try_new( actor: ActorRef, namespace: Namespace, verb: impl Into<String>, args: Value, ) -> Result<GateRequest, GateValidationError>
Create a validated GateRequest. Returns Err if verb is empty.
Sourcepub fn new(
actor: ActorRef,
namespace: Namespace,
verb: impl Into<String>,
args: Value,
) -> GateRequest
pub fn new( actor: ActorRef, namespace: Namespace, verb: impl Into<String>, args: Value, ) -> GateRequest
Builds a GateRequest with default (empty) context. Panics if verb is empty.
Sourcepub fn with_context(self, context: GateContext) -> GateRequest
pub fn with_context(self, context: GateContext) -> GateRequest
Attaches a GateContext (session, timestamp, source) to this request.
Trait Implementations§
Source§impl Clone for GateRequest
impl Clone for GateRequest
Source§fn clone(&self) -> GateRequest
fn clone(&self) -> GateRequest
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 moreSource§impl Debug for GateRequest
impl Debug for GateRequest
Source§impl<'de> Deserialize<'de> for GateRequest
impl<'de> Deserialize<'de> for GateRequest
Source§fn deserialize<D>(
deserializer: D,
) -> Result<GateRequest, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<GateRequest, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for GateRequest
impl Serialize for GateRequest
Source§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,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<RawGateRequest> for GateRequest
impl TryFrom<RawGateRequest> for GateRequest
Source§type Error = GateValidationError
type Error = GateValidationError
The type returned in the event of a conversion error.
Source§fn try_from(
raw: RawGateRequest,
) -> Result<GateRequest, <GateRequest as TryFrom<RawGateRequest>>::Error>
fn try_from( raw: RawGateRequest, ) -> Result<GateRequest, <GateRequest as TryFrom<RawGateRequest>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for GateRequest
impl RefUnwindSafe for GateRequest
impl Send for GateRequest
impl Sync for GateRequest
impl Unpin for GateRequest
impl UnsafeUnpin for GateRequest
impl UnwindSafe for GateRequest
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