-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
Surprisingly, many of the encoding methods are fallible. IMO this should not be handled at this layer, as semantic validation and structuring of types should be handled during type instantiation rather than during serialization of an instance of that type.
Looking through bgp/src/messages.rs I see the following examples of .to_wire() returning a Result<Vec<u8>> rather than just a Vec<u8>:
Message.to_wire()OpenMessage.to_wire()UpdateMessage.to_wire()PathAttribute.to_wire()PathAttributeValue.to_wire()As4PathSegment.to_wire()MpUnreachNlri.to_wire()NotificationMessage.to_wire()OptionalParameter.to_wire()Capability.to_wire()
These could all be modified to push the fallibility onto the creator of the type rather than the encoder.
Reactions are currently unavailable