pub struct HelmetLayer { /* private fields */ }Expand description
Tower Layer that injects security headers into every response.
Apply with Axum’s .layer() call. Use HelmetLayer::default() for
secure defaults, or HelmetLayer::new() to supply a custom Helmet.
§Examples
use axum::{routing::get, Router};
use rune_axum_helmet::HelmetLayer;
// Secure defaults
let app: Router = Router::new()
.route("/", get(|| async { "ok" }))
.layer(HelmetLayer::default());Implementations§
Source§impl HelmetLayer
impl HelmetLayer
Sourcepub fn new(helmet: Helmet) -> HelmetLayer
pub fn new(helmet: Helmet) -> HelmetLayer
Creates a new HelmetLayer from a custom Helmet configuration.
Trait Implementations§
Source§impl Clone for HelmetLayer
impl Clone for HelmetLayer
Source§fn clone(&self) -> HelmetLayer
fn clone(&self) -> HelmetLayer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HelmetLayer
impl Debug for HelmetLayer
Source§impl Default for HelmetLayer
impl Default for HelmetLayer
Source§fn default() -> HelmetLayer
fn default() -> HelmetLayer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HelmetLayer
impl RefUnwindSafe for HelmetLayer
impl Send for HelmetLayer
impl Sync for HelmetLayer
impl Unpin for HelmetLayer
impl UnsafeUnpin for HelmetLayer
impl UnwindSafe for HelmetLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more