[−][src]Module rifling::hook
Hook
Hook is a struct that contains the information needed for validating the payload and the work after that.
Example
To create a Hook object, use the new method:
extern crate rifling; use rifling::{Hook, Delivery}; // Create the hook let hook = Hook::new("push", None, |_: &Delivery| println!("Pushed!"));
The last parameter is a trait object of the trait HookFunc
, it's currently implemented to Fn(&Delivery)
.
Delivery
contains the information of the request received.
To use the hook, you need to register it to the Constructor
.
Structs
Hook | The actual hook, contains the event it's going to listen, the secret to authenticate the payload, and the function to execute. |
Traits
HookFunc | The part of the hook that will be executed after validating the payload You can implement this trait to your own struct |