Skip to content

impl From<PaMap> for OwnedPathAttributes #63

@density215

Description

@density215

While trying to write tests best path selection in rotonda-store - which requires From<Vec<u8>> and Into<Vec<u8>> for types to be stored - I need a way to create OwnedPathAttributes from scratch (so not from an existing PDUs). One way could be to create an empty PaMap and try to convert that into a PathAttributes.

I though a (convoluted) way could be:

OwnedPathAttributes::from((
    PduParseInfo::modern(),
    UpdateBuilder::<Vec<u8>>, Ipv4UnicastNlri>::from_attributes_builder(pa_map)
        .into_pdu_iter(&SessionConfig::modern())
        .next()
        .unwrap()
        .unwrap()
        .octets()
        .to_vec(),
));

This is incorrect, however.

Having an From<..> impl for this, would allow OrdRoute to take &OwnedPathAttributes as argument, instead of &PaMap. This would be handy, since Rotonda itself stores OwnedPathAttributes as its meta type in the store.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions