pub struct EdgeHeadersConfig {
pub targets: Vec<String>,
pub overrides: BTreeMap<String, String>,
}Expand description
Edge-runtime header emitter configuration (issue #550). Surfaces
the [edge_headers] section of ssg.toml:
[edge_headers]
targets = ["cloudflare", "netlify", "vercel"]
[edge_headers.overrides]
permissions-policy = "geolocation=(self)"When targets is empty (the default), the
crate::postprocess::EdgeHeadersPlugin is a no-op: nothing is
emitted into dist/. Listing one or more of "cloudflare",
"netlify", or "vercel" opts in to per-platform header config
generation; unknown target strings are logged and ignored.
overrides is a header-name → header-value map (case-insensitive
on the platform side, but stored verbatim) that lets a site author
replace any of the five baseline headers without recompiling.
Fields§
§targets: Vec<String>Edge platforms to emit configuration for. Recognised values:
"cloudflare", "netlify", "vercel". Anything else is
logged and skipped. Empty (the default) disables the plugin.
overrides: BTreeMap<String, String>Header-name → header-value overrides applied on top of the
baseline defaults. Names are matched case-insensitively when
the emitter merges overrides, so "permissions-policy",
"Permissions-Policy", and "PERMISSIONS-POLICY" all win.
Implementations§
Source§impl EdgeHeadersConfig
impl EdgeHeadersConfig
Sourcepub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Returns true when at least one valid target is configured —
the registration site in register_default_plugins uses this to
decide whether to register the emitter.
§Examples
use ssg::cmd::EdgeHeadersConfig;
let cfg = EdgeHeadersConfig::default();
// No targets configured by default.
assert!(!cfg.is_enabled());Trait Implementations§
Source§impl Clone for EdgeHeadersConfig
impl Clone for EdgeHeadersConfig
Source§fn clone(&self) -> EdgeHeadersConfig
fn clone(&self) -> EdgeHeadersConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EdgeHeadersConfig
impl Debug for EdgeHeadersConfig
Source§impl Default for EdgeHeadersConfig
impl Default for EdgeHeadersConfig
Source§fn default() -> EdgeHeadersConfig
fn default() -> EdgeHeadersConfig
Source§impl<'de> Deserialize<'de> for EdgeHeadersConfig
impl<'de> Deserialize<'de> for EdgeHeadersConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EdgeHeadersConfig
impl RefUnwindSafe for EdgeHeadersConfig
impl Send for EdgeHeadersConfig
impl Sync for EdgeHeadersConfig
impl Unpin for EdgeHeadersConfig
impl UnsafeUnpin for EdgeHeadersConfig
impl UnwindSafe for EdgeHeadersConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more