Skip to content

Generate From<> rust conversions when the encoding is infallible #161

@hchataing

Description

@hchataing

When converting from a child packet to a parent the encoding is often infallible, but the rust backend still generates TryFrom<> implementations instead of From<>.

For example:

packet Command {
   op_code: 8,
   _size_(_payload_),
   _payload_,
}

packet OneCommand : Command (op_code = 1) {
   x: 16,
   y: 16,
}

Generates

impl TryFrom<OneCommand> for Command {}

When the conversion can never fail.

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