Skip to main content

Grammar

Struct Grammar 

Source
pub struct Grammar {
    pub title: Option<String>,
    pub output: OutputSpec,
    pub sections: Vec<(Section, Vec<Def>)>,
    pub draw: Vec<Draw>,
    pub compose: Compose,
    pub paint: Vec<Paint>,
    pub views: Vec<View>,
}

Fields§

§title: Option<String>

A name for the profile, carried with it when shared; nothing draws it.

§output: OutputSpec§sections: Vec<(Section, Vec<Def>)>

Sections in the order they were written, each with its defs.

§draw: Vec<Draw>§compose: Compose§paint: Vec<Paint>

A screen’s layers, bottom first (paint(...)): what covers the grid when the output is a screen (output.screen).

§views: Vec<View>

Other places drawn into rectangles of this page (view(...)), under the page’s own groups. Each is a whole graph with its own output.

Implementations§

Source§

impl Grammar

Source

pub fn terrains(&self) -> Vec<&Terrain>

The tools_terrain defs, in file order: what the host reads the elevation for.

Source

pub fn burins(&self) -> Vec<&Burin>

The tools_burin defs: whole burin documents the engine draws.

Source

pub fn draws_terrain(&self) -> bool

Whether any def draws the elevation — terrain, or a burin document. What turns the terrain fetch on.

Source

pub fn defs(&self, section: Section) -> &[Def]

Source

pub fn all_defs(&self) -> impl Iterator<Item = &Def>

Every def, in section order.

Source

pub fn reached(self) -> Grammar

This graph with only what it shows: the defs that no draw, paint, mask or clip reads, directly or through other defs, left out, so nothing is fetched or computed for them (terrain no layer reads asks for no elevation, a tile layer none reads for no tiles). Views keep their own graphs whole.

Source

pub fn find(&self, name: &Name) -> Option<&Def>

Source

pub fn module(&self, module: &str) -> Option<&Def>

The def holding module_<module>, if the profile calls one.

Source

pub fn groups(&self) -> Vec<String>

The SVG group each draw entry writes.

Source

pub fn osm_keys(&self) -> Vec<String>

Every OSM key the profile can select on: what Overpass must fetch.

Modules read tags the profile never names (module_roads needs highway), so they contribute their keys too, unless they read a feature set of their own (from). Empty: the profile needs no Overpass at all.

Source

pub fn tile_selectors(&self) -> Vec<String>

Every tiles_select item: what to read from the vector tiles.

Source

pub fn draws_ocean(&self) -> bool

Whether the profile reads open-sea polygons from the vector tiles.

Source

pub fn datasets(&self) -> Vec<String>

Every data_select source, a URL or a file path, in order: the GeoJSON the host must read and pass as Inputs::data.

Source

pub fn source_files(&self) -> Vec<String>

SVG files named by a fill source, for the host to read.

Source§

impl Grammar

Source

pub fn to_json(&self) -> Value

The graph as JSON: what a script built, for presets, --dump-graph and the page’s worker. Grammar::from_json reads it back.

Source

pub fn from_json(text: &str) -> Result<Grammar, GrammarError>

Trait Implementations§

Source§

impl Clone for Grammar

Source§

fn clone(&self) -> Grammar

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Grammar

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Grammar

Source§

fn eq(&self, other: &Grammar) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Grammar

Auto Trait Implementations§

§

impl Forget for Grammar

§

impl Freeze for Grammar

§

impl Move for Grammar

§

impl RefUnwindSafe for Grammar

§

impl Send for Grammar
where RawVecInner: Send, RawTable<usize>: Send, BoxRaw<Op>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, NodeRef<Owned, String, Name, LeafOrInternal>: Send, BoxRaw<(String, Name)>: Send, NodeRef<Owned, String, RoadClassSpec, LeafOrInternal>: Send, BoxRaw<(String, RoadClassSpec)>: Send, NodeRef<Owned, Id, Clip, LeafOrInternal>: Send, BoxRaw<(Id, Clip)>: Send, &'static str: Send, BoxRaw<Expr>: Send, Arc<Mutex<HashMap<String, Option<Look>>>>: Send, BoxRaw<Grammar>: Send,

§

impl Sync for Grammar
where RawVecInner: Sync, RawTable<usize>: Sync, BoxRaw<Op>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, NodeRef<Owned, String, Name, LeafOrInternal>: Sync, BoxRaw<(String, Name)>: Sync, NodeRef<Owned, String, RoadClassSpec, LeafOrInternal>: Sync, BoxRaw<(String, RoadClassSpec)>: Sync, NodeRef<Owned, Id, Clip, LeafOrInternal>: Sync, BoxRaw<(Id, Clip)>: Sync, BoxRaw<Expr>: Sync, Arc<Mutex<HashMap<String, Option<Look>>>>: Sync, BoxRaw<Grammar>: Sync,

§

impl Unpin for Grammar
where *const u8 is !null: Unpin, Box<Op>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, *const LeafNode<String, Name> is !null: Unpin, Box<(String, Name)>: Unpin, *const LeafNode<String, RoadClassSpec> is !null: Unpin, Box<(String, RoadClassSpec)>: Unpin, *const LeafNode<Id, Clip> is !null: Unpin, Box<(Id, Clip)>: Unpin, &'static str: Unpin, Box<Expr>: Unpin, Arc<Mutex<HashMap<String, Option<Look>>>>: Unpin, Box<Grammar>: Unpin,

§

impl UnsafeUnpin for Grammar

§

impl UnwindSafe for Grammar

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool