[][src]Function fleetspeak::send

pub fn send<M>(packet: Packet<M>) -> Result<(), WriteError> where
    M: Message

Sends the message to the Fleetspeak server.

The message is delivered to the server-side service as specified by the packet and optionally tagged with a type if specified. This optional message type is irrelevant for Fleetspeak but might be useful for the service the message is delivered to.

In case of any I/O failure or malformed message (e.g. due to encoding problems), an error is reported.

Examples

use fleetspeak::Packet;

fleetspeak::send(Packet {
    service: String::from("example"),
    kind: None,
    data: String::from("Hello, World!"),
}).expect("failed to send the packet");