[][src]Struct rifling::hook::Hook

pub struct Hook {
    pub event: &'static str,
    pub secret: Option<String>,
    pub func: Arc<dyn HookFunc>,
}

The actual hook, contains the event it's going to listen, the secret to authenticate the payload, and the function to execute.

Fields

event: &'static strsecret: Option<String>func: Arc<dyn HookFunc>

Methods

impl Hook[src]

Main impl clause of Hook()

pub fn new(
    event: &'static str,
    secret: Option<String>,
    func: impl HookFunc + 'static
) -> Self
[src]

Create a new hook

Example:

extern crate rifling;

use rifling::{Hook, Delivery};

let hook = Hook::new("push", None, |_: &Delivery| println!("Pushed!"));

pub fn auth(&self, delivery: &Delivery) -> bool[src]

Authenticate the payload using ring

pub fn handle_delivery(self, delivery: &Delivery)[src]

Handle the request

Trait Implementations

impl Clone for Hook[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Hook

impl Sync for Hook

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T