Skip to main content

Selectors

Struct Selectors 

Source
pub struct Selectors;
Expand description

Functions for building Selectors.

Every function takes the selector that precedes the new one (None to start a selector). The same functions are available as chaining methods on Selector:

ⓘ
// Button.big > :is(Control)
let selector = Selectors::of_type::<Button>().class("big").child().is::<Control>();

Implementations§

Source§

impl Selectors

Source

pub fn child(previous: Option<Selector>) -> Selector

Returns a selector which matches a previous selector’s child.

Source

pub fn class(previous: Option<Selector>, name: &str) -> Selector

Returns a selector which matches a control’s style class.

Source

pub fn descendant(previous: Option<Selector>) -> Selector

Returns a selector which matches a descendant of a previous selector.

Source

pub fn is_type_info( previous: Option<Selector>, type_: &'static TypeInfo, ) -> Selector

Returns a selector which matches a type or a derived type.

Source

pub fn is<T: ObjectType + Upcast<StyledElement>>() -> Selector

Returns a selector which matches class T or a class derived from it.

Source

pub fn name(previous: Option<Selector>, name: &str) -> Selector

Returns a selector which matches a control’s name.

Source

pub fn nesting(_previous: Option<Selector>) -> Selector

Returns the nesting selector, which stands for the selector of the parent style.

Source

pub fn not(previous: Option<Selector>, argument: Selector) -> Selector

Returns a selector which inverts the results of selector argument.

Source

pub fn not_with( previous: Option<Selector>, argument: impl FnOnce(Option<Selector>) -> Selector, ) -> Selector

Returns a selector which inverts the results of the selector built by argument.

Source

pub fn nth_child(previous: Option<Selector>, step: i32, offset: i32) -> Selector

Returns a selector which matches elements based on their position among a group of siblings.

Source

pub fn nth_last_child( previous: Option<Selector>, step: i32, offset: i32, ) -> Selector

Returns a selector which matches elements based on their position among a group of siblings, counting from the end.

Source

pub fn of_type_info( previous: Option<Selector>, type_: &'static TypeInfo, ) -> Selector

Returns a selector which matches a type.

Source

pub fn of_type<T: ObjectType + Upcast<StyledElement>>() -> Selector

Returns a selector which matches class T exactly.

Source

pub fn or(selectors: impl IntoIterator<Item = Selector>) -> Selector

Returns a selector which ORs selectors.

Source

pub fn property_equals<T: PropertyValue>( previous: Option<Selector>, property: &'static StyledProperty<T>, value: T, ) -> Selector

Returns a selector which matches a control with the specified property value.

Source

pub fn property_equals_untyped( previous: Option<Selector>, property: &'static FerroProperty, value: BoxedValue, ) -> Selector

Returns a selector which matches a control with the specified property value. value must hold exactly the property’s value type.

Source

pub fn template(previous: Option<Selector>) -> Selector

Returns a selector which enters a lookless control’s template.

Trait Implementations§

Source§

impl MarkupTyped for Selectors

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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, 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.