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 or container query must be a SizeClass boundary or one of the tuning widths. A container query is checked the same way as a media query: @container screen (width < 600px) states a width.

A width on a SizeClass boundary must also be written as an edge of the partition, exclusive on one side: width < 600px and 600px <= width pass, while max-width: 600px, width <= 600px and width > 600px fail, because each also claims the point where the next class begins. A tuning width may be written in either direction.

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

The generated stylesheets are scanned too, and pass: they take the number from makeover-geometry.

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 with no directory a scan can point at. A stylesheet not on the list is not checked.

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.

A tuning width does not move when a size class does. Each entry carries a note beside it in the caller saying what it tunes.

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, including one that no longer exists; if any width is neither a size-class boundary nor a tuning width; or if a size-class boundary is written with an operator that straddles it (max-width: 600px, width <= 600px).

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.