Crate pass_it_on

source ·
Expand description

§Pass-It-On

A library that provides simple notification client and server that receives messages and passes them on to endpoints

§Client Example

To use the client to pass messages to the server you will need to pass a valid ClientConfiguration and a channel receiver to the start client function. It will monitor that channel for incoming Notification values and send them in the expected format to server.


async fn main() -> Result<(), Error> {
    const NOTIFICATION_NAME: &str = "test1";
    let config = ClientConfiguration::from_toml(CLIENT_TOML_CONFIG)?;
    let (interface_tx, interface_rx) = mpsc::channel(100);

    let messages = vec![
        Message::new("A message to be sent").to_client_ready_message(NOTIFICATION_NAME),
        Message::new("Another message").to_client_ready_message(NOTIFICATION_NAME),
    ];

    for message in messages {
        if let Err(send_error) = interface_tx.send(message).await {
            println!("Send Error: {}", send_error);
        }
    }

    start_client(config, interface_rx, None).await?;

    Ok(())
}

§Feature Flags

FeatureDescription
clientEnables the client but not any particular interface.
discordEnables the discord webhook endpoint.
emailEnables the email endpoint.
endpointsEnables the Endpoint and EndpointConfig traits.
fileEnables the regular file endpoint.
httpEnables the HTTP interface client and server.
http-clientEnables the HTTP interface for just client.
http-serverEnables the HTTP interface for just server.
interfacesEnables the Interface and InterfaceConfig traits.
matrixEnables the matrix endpoint.
parse-cfgEnables parsing of client or server configurations from TOML when those features are also enabled.
pipeEnables the named pipe interface client and server. (Unix only)
pipe-clientEnables the named pipe interface client. (Unix only)
pipe-serverEnables the named pipe interface server. (Unix only)
serverEnables the server but not any particular interface or endpoint.
server-bin-fullEnables the building of the provided pass-it-on-server binary with all available interfaces and endpoints
server-bin-minimalEnables the building of the provided pass-it-on-server binary while not requiring any specific interface or endpoint
vendored-tlsEnables vendored tls for reqwest.

Modules§

Structs§

Enums§

  • Errors returned by pass-it-on library.

Constants§

Functions§