pub enum PageTemplate {
Default {
title: Option<String>,
body_text: Option<String>,
},
Tickbox {
title: Option<String>,
body_text: Option<String>,
consent_text: Option<String>,
},
Custom(String),
}Expand description
Controls what the user sees in the browser when __location__ is called.
§Variants at a glance
| Variant | Description |
|---|---|
PageTemplate::Default | Clean single-button page. Title and body text are customisable. |
PageTemplate::Tickbox | Same, but requires a checkbox tick before the button activates. Title, body text, and consent label are customisable. |
PageTemplate::Custom | Fully custom HTML. Place {} where the capture button should appear; the required JavaScript is injected automatically. |
Variants§
Default
A clean, single-button consent page.
Both fields fall back to sensible built-in values when None.
§Example
// fully default
let t = PageTemplate::default();
// custom title only
let t = PageTemplate::Default {
title: Some("My App — Location".into()),
body_text: None,
};Fields
Tickbox
Like Default but adds a checkbox the user
must tick before the capture button becomes active.
§Example
let t = PageTemplate::Tickbox {
title: Some("Verify Location".into()),
body_text: None,
consent_text: Some("I agree to share my location with this application.".into()),
};Fields
§
title: Option<String>Browser tab title and <h1> heading text.
Falls back to "Location Access" when None.
Custom(String)
A fully custom HTML document.
Place exactly one {} in the string where the capture button should
be injected. The required JavaScript (which POSTs to /location and
/location-error) is injected automatically before </body>, so you
do not need to write any geolocation JS yourself.
§Example
let html = r#"<!DOCTYPE html>
<html><body>
<h1>Where are you?</h1>
{}
<div id="status"></div>
</body></html>"#;
let t = PageTemplate::Custom(html.into());Trait Implementations§
Source§impl Default for PageTemplate
impl Default for PageTemplate
Source§fn default() -> Self
fn default() -> Self
Returns PageTemplate::Default with both fields set to None
(all text falls back to built-in defaults).
Auto Trait Implementations§
impl Freeze for PageTemplate
impl RefUnwindSafe for PageTemplate
impl Send for PageTemplate
impl Sync for PageTemplate
impl Unpin for PageTemplate
impl UnsafeUnpin for PageTemplate
impl UnwindSafe for PageTemplate
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