pub trait ClientSideValidate<'client_data>: ClientData<'client_data>where
    Self::ValidationItem: 'client_data,{
    type ValidationItem: ClientData<'client_data, ValidationReport = Self::ValidationReport>;
    type ValidationIter: Iterator<Item = &'client_data Self::ValidationItem>;

    // Required method
    fn validation_iter(&'client_data self) -> Self::ValidationIter;

    // Provided method
    fn client_side_validate<Resolver>(
        &'client_data self,
        resolver: &'client_data mut Resolver
    ) -> Status<Self::ValidationReport>
       where Resolver: SealResolver<<<<Self as ClientData<'client_data>>::ValidationReport as ValidationReport>::SealIssue as SealIssue>::Seal, Error = <<Self as ClientData<'client_data>>::ValidationReport as ValidationReport>::SealIssue> { ... }
}
Expand description

This simple trait MUST be used by all top-level data structures implementing client-side validation paradigm. The core concept of this paradigm is that a client must have a complete and uniform set of data, which can be represented or accessed through a single structure; and MUST be able to deterministically validate this set giving an external validation function, that is able to provide validator with

Required Associated Types§

source

type ValidationItem: ClientData<'client_data, ValidationReport = Self::ValidationReport>

Data type for data sub-entries contained withing the current client-side-validated data item.

If the client-side-validated data contain different types of internal entries, this may be a special enum type with a per-data-type variant.

If the data do not contain internal data, set this type to ().

source

type ValidationIter: Iterator<Item = &'client_data Self::ValidationItem>

Iterator over the list of specific validation items.

If the client-side-validated data contain different types of internal entries, this may be a special enum type with a per-data-type variant.

Required Methods§

source

fn validation_iter(&'client_data self) -> Self::ValidationIter

Returns iterator over hierarchy of individual data items inside client-side-validation data.

Provided Methods§

source

fn client_side_validate<Resolver>( &'client_data self, resolver: &'client_data mut Resolver ) -> Status<Self::ValidationReport>where Resolver: SealResolver<<<<Self as ClientData<'client_data>>::ValidationReport as ValidationReport>::SealIssue as SealIssue>::Seal, Error = <<Self as ClientData<'client_data>>::ValidationReport as ValidationReport>::SealIssue>,

The mein method performing client-side-validation for the whole block of client-side-validated data.

The default implementation of the trait iterates over client-side-validated data hierarchy using iterator returned by ClientSideValidate::validation_iter and for each of the items

The function should not fail on any validation failures and run the whole validation process up to the end, accumulating all failures and reported issues withing Status object, returned by the function at the end.

Object Safety§

This trait is not object safe.

Implementors§