[][src]Struct fish::Server

pub struct Server { /* fields omitted */ }

A fully kitted-callback handling server that can handle async communication over HTTP-Webhooks

Implementations

impl Server[src]

pub fn start<A: Into<SocketAddr>>(addr: A) -> Self[src]

Create a new callback server on the provided address

Example

This example is not tested
let fish = Server::start("127.0.0.1:3306");

let hook = fish.spawn();

let _ = async {
    reqwest::get(format!("http://some.api/?callback={}", hook.url())).await
};

// don't forget to spin up the server!
server.await

pub fn start_with_proxy<A: Into<SocketAddr>>(addr: A, proxy: Url) -> Self[src]

Create a callback server but with a proxy URL that will forward traffic there. E.g. you could use ngrok to tunnel a public Url to your development server's fish::Server

pub fn spawn(&self) -> Webhook[src]

Spawn a webhook

Example

This example is not tested
let server = Server::new(([127, 0, 0, 1], 3031));
let webhook = server.spawn();
// make your call
// e.g. http_client.body(webhook.url()).send().await
webhook.await

Trait Implementations

impl Clone for Server[src]

Auto Trait Implementations

impl RefUnwindSafe for Server

impl Send for Server

impl Sync for Server

impl Unpin for Server

impl UnwindSafe for Server

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> 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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,