Trait roa::cookie::CookieSetter[][src]

pub trait CookieSetter {
    fn set_cookie(&mut self, cookie: Cookie<'_>) -> Result;
}
This is supported on crate feature cookies only.

An extension to set cookie.

Required methods

Set a cookie in pecent encoding, should not return Err.

Example

use roa::cookie::{cookie_parser, Cookie};
use roa::preload::*;
use roa::{App, Context};
use std::error::Error;

async fn end(ctx: &mut Context) -> roa::Result {
    ctx.set_cookie(Cookie::new("name", "Hexilee"));
    Ok(())
}

let app = App::new().gate(cookie_parser).end(end);
let (addr, server) = app.run()?;
// server.await
Ok(())
Loading content...

Implementors

impl<S> CookieSetter for Context<S>[src]

Loading content...