Trait erlang_port::MessageDeserialize[][src]

pub trait MessageDeserialize {
    fn deserialize_message(buffer: Vec<u8>) -> Self;
}

Trait that parses some data from a Vec

This is used in the receive function to deserialize commands. A default implementation is provided for anything implementing DeserializeOwned from serde.

In Erlang "Let it Crash" style, if the data in buffer is malformed this trait shoul panic. Since this library is intended to be used as part of an Erlang system this should be picked up by the BEAM VM which can restart the Port.

It's possible that panicing is not what you want, for example if you have a Port that is handling multiple commands concurrently. Feel free to make a PR or raise an issue to better support your use case if that is the case.

Required Methods

Implementors