pub trait FromChannelMessage: Sized {
// Required method
unsafe fn from_channel_message(
data: *const u8,
size: usize,
) -> Result<Self, String>;
}Expand description
Represents a type which can be converted to from a channel message sent by a
guest plugin. Used by the channel_recv macro.
§Supported Types
&[u8]- gives you the raw bytesVec<u8>- gives you the raw bytes, but owned&str- gives you the bytes as a UTF-8 string. Prints a warning if invalid unicode and skips your callback.String- same as&strbut ownedOption<T>- rather than print a warning if the type can’t be decoded, pass NoneResult<T, String>- rather than print out the warning to stdout, pass the warning as aString
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.