Changed FromBytesError::InvalidBytes to take ownership of the byte slice by converting it to Vec<u8>. This removes the lifetime parameter from the enum, simplifying the API and preventing potential lifetime-related issues. The change ensures that error instances can be freely moved and stored without borrowing constraints.
Refactored Protocol300Transmission parsing to provide more detailed error information when encountering invalid byte sequences. Changed the error variant from `InvalidByte` to `InvalidBytes` which now includes the problematic byte slice, enabling better debugging. Updated the match arm to capture the byte slice as `b` instead of using a wildcard, and modified the error logging to reflect these changes. The lifetime parameter was added to the `FromBytesError` enum to support the byte slice reference.
Add a new method to calculate the byte length of Protocol300Transmission
variants without converting to bytes. The method returns:
- 1 byte for control characters (Ack, Enq, Eot, Nack)
- 3 bytes for Init
- telegram_length + 3 bytes for Message
Include comprehensive unit tests for all transmission variants to ensure
correct length calculation.