pub struct Context { /* private fields */ }Expand description
The device/viewport context a query is tested against. Build it with the setters; any feature left unset never matches.
let ctx = css_mediaquery::Context::new().width(800.0).height(600.0).resolution(192.0);Implementations§
Source§impl Context
impl Context
Sourcepub fn media_type(self, value: &str) -> Self
pub fn media_type(self, value: &str) -> Self
Set the media type ("screen", "print", …); stored lowercased.
Sourcepub fn orientation(self, value: &str) -> Self
pub fn orientation(self, value: &str) -> Self
Set the orientation ("portrait" or "landscape").
Sourcepub fn device_width(self, value: f64) -> Self
pub fn device_width(self, value: f64) -> Self
Set the device width, in pixels.
Sourcepub fn device_height(self, value: f64) -> Self
pub fn device_height(self, value: f64) -> Self
Set the device height, in pixels.
Sourcepub fn resolution(self, value: f64) -> Self
pub fn resolution(self, value: f64) -> Self
Set the resolution, in dots per inch (1dppx = 96dpi).
Sourcepub fn aspect_ratio(self, value: f64) -> Self
pub fn aspect_ratio(self, value: f64) -> Self
Set the aspect ratio as a decimal (e.g. 16.0 / 9.0).
Sourcepub fn device_aspect_ratio(self, value: f64) -> Self
pub fn device_aspect_ratio(self, value: f64) -> Self
Set the device aspect ratio as a decimal.
Sourcepub fn device_pixel_ratio(self, value: f64) -> Self
pub fn device_pixel_ratio(self, value: f64) -> Self
Set the device pixel ratio as a decimal.
Sourcepub fn color_index(self, value: i64) -> Self
pub fn color_index(self, value: i64) -> Self
Set the number of entries in the color lookup table.
Sourcepub fn monochrome(self, value: i64) -> Self
pub fn monochrome(self, value: i64) -> Self
Set the number of bits per pixel on a monochrome device.
Trait Implementations§
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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