Skip to main content

Breakpoints

Struct Breakpoints 

Source
pub struct Breakpoints { /* private fields */ }
Expand description

Fail the build if a hand-written breakpoint has drifted from SizeClass.

Every pixel width named by a media query must be a SizeClass boundary or one of the tuning widths.

makeover_webview::build::drift::Breakpoints::in_frontend("frontend")
    .tuning(&[1400])
    .run();

Without this, moving SizeClass::Medium::min_px regenerates the emitted stylesheets and leaves every hand-written query behind, and the result is a stylesheet that disagrees with itself at the old boundary rather than an error.

The generated stylesheets are scanned too, and pass by construction: they ask makeover-geometry for the number rather than stating it. Scanning them means a consumer never has to name which files are hand-written.

Implementations§

Source§

impl Breakpoints

Source

pub fn in_frontend(frontend: impl AsRef<Path>) -> Self

Every .css under frontend/css and every .js under frontend/js, recursively.

Source

pub fn files<P: AsRef<Path>>(paths: &[P]) -> Self

A named list of files rather than a tree.

For a frontend whose generated and hand-written files share a directory, with nothing to point a directory scan at: the MNW server keeps both under static/ beside a bundler’s output. The list is hand-maintained, and a stylesheet nobody adds to it is unchecked rather than failing, so prefer in_frontend where the layout allows it.

A .js path is read as script and anything else as stylesheet.

Source

pub fn tuning(self, widths: &[u16]) -> Self

Widths inside a shell where something reflows without the shell changing: a dashboard dropping from three columns to two, a pane’s width cap ending.

The one thing an app gets a say in. A shell boundary is a SizeClass edge and belongs to makeover-geometry; nothing switches shells at a tuning width, so it does not move when a size class does. Each entry owes a note beside it saying what it tunes: this list is where a genuine boundary goes to hide from the check.

Source

pub fn run(&self)

Run the check. Emits cargo:rerun-if-changed for every file it read, and for the scanned directories.

§Panics

If a listed file cannot be read (a listed path that no longer exists is a check covering less than it says), or if any width is neither a size-class boundary nor a tuning width. A build script has nowhere useful to return an error to.

Trait Implementations§

Source§

impl Clone for Breakpoints

Source§

fn clone(&self) -> Self

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 Breakpoints

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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.