pub struct MessagePolicy {
pub blanket: BlanketMessagePolicy,
pub restrict_chain_ids_to: Option<HashSet<ChainId>>,
pub reject_message_bundles_without_application_ids: Option<HashSet<GenericApplicationId>>,
pub reject_message_bundles_with_other_application_ids: Option<HashSet<GenericApplicationId>>,
}Expand description
Policies for automatically handling incoming messages.
Fields§
§blanket: BlanketMessagePolicyThe blanket policy applied to all messages.
restrict_chain_ids_to: Option<HashSet<ChainId>>A collection of chains which restrict the origin of messages to be
accepted. Option::None means that messages from all chains are accepted. An empty
HashSet denotes that messages from no chains are accepted.
reject_message_bundles_without_application_ids: Option<HashSet<GenericApplicationId>>A collection of applications: If Some, only bundles with at least one message by any
of these applications will be accepted.
reject_message_bundles_with_other_application_ids: Option<HashSet<GenericApplicationId>>A collection of applications: If Some, only bundles all of whose messages are by these
applications will be accepted.
Implementations§
Source§impl MessagePolicy
impl MessagePolicy
pub async fn blanket(&self, ctx: &Context<'_>) -> Result<&BlanketMessagePolicy>
pub async fn restrict_chain_ids_to( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<ChainId>>>
pub async fn reject_message_bundles_without_application_ids( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<GenericApplicationId>>>
pub async fn reject_message_bundles_with_other_application_ids( &self, ctx: &Context<'_>, ) -> Result<&Option<HashSet<GenericApplicationId>>>
Source§impl MessagePolicy
impl MessagePolicy
Sourcepub fn new(
blanket: BlanketMessagePolicy,
restrict_chain_ids_to: Option<HashSet<ChainId>>,
reject_message_bundles_without_application_ids: Option<HashSet<GenericApplicationId>>,
reject_message_bundles_with_other_application_ids: Option<HashSet<GenericApplicationId>>,
) -> Self
pub fn new( blanket: BlanketMessagePolicy, restrict_chain_ids_to: Option<HashSet<ChainId>>, reject_message_bundles_without_application_ids: Option<HashSet<GenericApplicationId>>, reject_message_bundles_with_other_application_ids: Option<HashSet<GenericApplicationId>>, ) -> Self
Constructs a new MessagePolicy.
Sourcepub fn new_accept_all() -> Self
pub fn new_accept_all() -> Self
Constructs a new MessagePolicy that accepts all messages.
Trait Implementations§
Source§impl Clone for MessagePolicy
impl Clone for MessagePolicy
Source§fn clone(&self) -> MessagePolicy
fn clone(&self) -> MessagePolicy
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ContainerType for MessagePolicy
impl ContainerType for MessagePolicy
Source§async fn resolve_field(&self, ctx: &Context<'_>) -> ServerResult<Option<Value>>
async fn resolve_field(&self, ctx: &Context<'_>) -> ServerResult<Option<Value>>
Resolves a field value and outputs it as a json value
async_graphql::Value. Read moreSource§fn collect_all_fields<'a>(
&'a self,
ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>,
fields: &mut Fields<'a>,
) -> Result<(), ServerError>
fn collect_all_fields<'a>( &'a self, ctx: &ContextBase<'a, &'a Positioned<SelectionSet>>, fields: &mut Fields<'a>, ) -> Result<(), ServerError>
Collect all the fields of the container that are queried in the
selection set. Read more
Source§fn find_entity(
&self,
_: &ContextBase<'_, &Positioned<Field>>,
_params: &ConstValue,
) -> impl Future<Output = Result<Option<ConstValue>, ServerError>> + Send
fn find_entity( &self, _: &ContextBase<'_, &Positioned<Field>>, _params: &ConstValue, ) -> impl Future<Output = Result<Option<ConstValue>, ServerError>> + Send
Find the GraphQL entity with the given name from the parameter. Read more
Source§impl Debug for MessagePolicy
impl Debug for MessagePolicy
Source§impl Default for MessagePolicy
impl Default for MessagePolicy
Source§fn default() -> MessagePolicy
fn default() -> MessagePolicy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MessagePolicy
impl<'de> Deserialize<'de> for MessagePolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl OutputType for MessagePolicy
impl OutputType for MessagePolicy
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Create type information in the registry and return qualified typename.
Source§async fn resolve(
&self,
ctx: &ContextSelectionSet<'_>,
_field: &Positioned<Field>,
) -> ServerResult<Value>
async fn resolve( &self, ctx: &ContextSelectionSet<'_>, _field: &Positioned<Field>, ) -> ServerResult<Value>
Resolve an output value to
async_graphql::Value.Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Qualified typename.
Source§impl Serialize for MessagePolicy
impl Serialize for MessagePolicy
impl ObjectType for MessagePolicy
Auto Trait Implementations§
impl Freeze for MessagePolicy
impl RefUnwindSafe for MessagePolicy
impl Send for MessagePolicy
impl Sync for MessagePolicy
impl Unpin for MessagePolicy
impl UnwindSafe for MessagePolicy
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
Source§impl<T> MockResults for T
impl<T> MockResults for T
Source§type Results = T
type Results = T
The mock native type of the results for the
MockInstance.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.
Source§impl<T> Upcastable for T
impl<T> Upcastable for T
Source§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
Source§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref