Trait UAttributesValidator

Source
pub trait UAttributesValidator: Send {
    // Required methods
    fn validate(&self, attributes: &UAttributes) -> Result<(), UAttributesError>;
    fn message_type(&self) -> UMessageType;
    fn validate_source(
        &self,
        attributes: &UAttributes,
    ) -> Result<(), UAttributesError>;
    fn validate_sink(
        &self,
        attributes: &UAttributes,
    ) -> Result<(), UAttributesError>;

    // Provided methods
    fn validate_type(
        &self,
        attributes: &UAttributes,
    ) -> Result<(), UAttributesError> { ... }
    fn validate_id(
        &self,
        attributes: &UAttributes,
    ) -> Result<(), UAttributesError> { ... }
}
Expand description

UAttributes is the struct that defines the Payload. It serves as the configuration for various aspects like time to live, priority, security tokens, and more. Each variant of UAttributes defines a different type of message payload. The payload could represent a simple published payload with some state change, an RPC request payload, or an RPC response payload.

UAttributesValidator is a trait implemented by all validators for UAttributes. It provides functionality to help validate that a given UAttributes instance is correctly configured to define the Payload.

Required Methods§

Source

fn validate(&self, attributes: &UAttributes) -> Result<(), UAttributesError>

Checks if a given set of attributes complies with the rules specified for the type of message they describe.

§Errors

Returns an error if the attributes are not consistent with the rules specified for the message type.

Source

fn message_type(&self) -> UMessageType

Returns the type of message that this validator can be used with.

Source

fn validate_source( &self, attributes: &UAttributes, ) -> Result<(), UAttributesError>

Verifies that a set of attributes contains a valid source URI.

§Errors

If the UAttributes::source property does not contain a valid URI as required by the type of message, an error is returned.

Source

fn validate_sink( &self, attributes: &UAttributes, ) -> Result<(), UAttributesError>

Verifies that a set of attributes contains a valid sink URI.

Provided Methods§

Source

fn validate_type( &self, attributes: &UAttributes, ) -> Result<(), UAttributesError>

Verifies that this validator is appropriate for a set of attributes.

§Errors

Returns an error if UAttributes::type_ does not match the type returned by UAttributesValidator::message_type.

Source

fn validate_id(&self, attributes: &UAttributes) -> Result<(), UAttributesError>

Verifies that a set of attributes contains a valid message ID.

§Errors

Returns an error if UAttributes::id does not contain a valid uProtocol UUID.

Implementors§