Crate plumber_rs

Source
Expand description

The Plumber-Rust servlet library. This is the basic library that can be used to create Plumber servlets/guest code with Rust. For more details about how to create the Plumber servlet with Rust, please read the README.md under the repository.

To learn more about the Plumber dataflow programming middleware, please visit https://plumberserver.com

Sample servlet in Rust:

 
#[macro_use]
extern crate plumber_rs;
use plumber_rs::servlet::{Bootstrap, BootstrapResult, Unimplemented, SyncServlet, ServletFuncResult, success};
struct Bootstrapper;
struct Servlet;
 
impl SyncServlet for Servlet {
    no_protocol!();
    fn init(&mut self, args : &[&str], _protocol: &mut Self::ProtocolType) -> ServletFuncResult
    {
        plumber_log!(W "Hello World! args = {:?}", args);
        return success();
    }
    fn exec(&mut self, _data : Self::DataModelType) -> ServletFuncResult  { success() }
    fn cleanup(&mut self) -> ServletFuncResult { success() }
}
 
impl Bootstrap for Bootstrapper {
    type SyncServletType = Servlet;
    type AsyncServletType = Unimplemented;
    fn get(_args : &[&str]) -> BootstrapResult<Self>
    {
        return Self::sync(Servlet{});
    }
}
export_bootstrap!(Bootstrapper);

Modules§

log
The binding for the Plumber framework logging system.
pipe
The Plumber Pipe IO API wrapper
protocol
The inter-component procotol utilities
rust_servlet
The hepler function used by the Rust servlet.
servlet
The module that defines the servlet traits.

Macros§

export_bootstrap
The macro that is used to export the servlet to the shared object that can be loaded by Plumber-Rust binary loader. This macro will emit all the function that is required by the Plumber-Rust binary loader.
init_protocol
Initialize the protocol in the init function block.
no_protocol
Make the servlet implementation uses untyped mode, which we just do the pipe IO instead.
plumber_log
Write a log message to the Plumber logging system. See the example code in the documentation of this module for the detailed usage of the macro
plumber_log_write
Write the log with specified level to Plumber logging system
protodef
Defines a language-neutural protocol binding for the Rust servlet.
use_protocol
Make the servlet implementation uses the given protocol defined by protodef!

Statics§

API_ADDRESS_TABLE
The Plumber API address table.

Functions§

assign_address_table
Assign the basic address tables used by Rust servlet

Type Aliases§

ApiAddressTable
The type for the Plumber API address table
VariadicWrapperFunc
The function pointer for the variadic helper function