pub fn components(components: &[Component]) -> Result<(), MessageValidationError> {
    let count = components.len();

    if count > COMPONENT_COUNT {
        Err(MessageValidationError {
            kind: MessageValidationErrorType::ComponentCount { count },
            source: None,
        })
    } else {
        for (idx, component) in components.iter().enumerate() {
            crate::component::component(component).map_err(|source| {
                let (kind, source) = source.into_parts();

                MessageValidationError {
                    kind: MessageValidationErrorType::ComponentInvalid { idx, kind },
                    source,
                }
            })?;
        }

        Ok(())
    }
}
/// Ensure a list of components is correct.
///
/// # Errors
///
/// Returns a [`ComponentValidationErrorType::ComponentCount`] if there are
/// too many components in the provided list.
///
/// Refer to the errors section of [`component`] for a list of errors that may
/// be returned as a result of validating each provided component.
///
/// [`component`]: crate::component::component
Ensure a list of components is correct.
Ensure a list of components is correct .
pub fn components(components: &[Component]) -> Result<(), MessageValidationError> {
    let count = components.len();
    if count > COMPONENT_COUNT {
        Err(MessageValidationError {
            kind: MessageValidationErrorType::ComponentCount { count },
            source: None,
        })
    } else {
        for (idx, component) in components.iter().enumerate() {
            crate::component::component(component).map_err(|source| {
                let (kind, source) = source.into_parts();
                MessageValidationError {
                    kind: MessageValidationErrorType::ComponentInvalid { idx, kind },
                    source,
                }
            })?;
        }
        Ok(())
    }
}
pub fn components ( components : & [ Component ] ) -> Result < ( ) , MessageValidationError > { let count = components . len ( ) ; if count > COMPONENT_COUNT { Err ( MessageValidationError { kind : MessageValidationErrorType :: ComponentCount { count } , source : None , } ) } else { for ( idx , component ) in components . iter ( ) . enumerate ( ) { crate :: component :: component ( component ) . map_err ( | source | { let ( kind , source ) = source . into_parts ( ) ; MessageValidationError { kind : MessageValidationErrorType :: ComponentInvalid { idx , kind } , source , } } ) ? ; } Ok ( ( ) ) } }
Ensure a list of components is correct.
Ensure a list of components is correct .
components
&[Component]
errors
Returns a [`ComponentValidationErrorType::ComponentCount`] if there are
too many components in the provided list.

Refer to the errors section of [`component`] for a list of errors that may
be returned as a result of validating each provided component.


Returns a [ ` ComponentValidationErrorType :: ComponentCount ` ] if there are too many components in the provided list . Refer to the errors section of [ ` component ` ] for a list of errors that may be returned as a result of validating each provided component .