pub fn merge_necessity<T: PartialEq>(
    vec: Vec<Necessity<T>>,
    other: Vec<Necessity<T>>
) -> Vec<Necessity<T>>
Expand description

merge two lists of necessities the result contains mandatory elements if they were present as mandatory in both given lists all other elements are returned as optional elements of the second list are appended to the first list

Example

use xml_schema_generator::Necessity;

let vec: Vec<Necessity<u8>> = vec![Necessity::Mandatory(1), Necessity::Mandatory(2), Necessity::Mandatory(4) ];
let other: Vec<Necessity<u8>> = vec![Necessity::Mandatory(1), Necessity::Mandatory(3), Necessity::Optional(4)];
let expected: Vec<Necessity<u8>> = vec![Necessity::Mandatory(1), Necessity::Optional(2), Necessity::Optional(4), Necessity::Optional(3)];

let actual = xml_schema_generator::merge_necessity(vec, other);

assert_eq!(actual, expected);