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
impl Selectors
Sourcepub fn child(previous: Option<Selector>) -> Selector
pub fn child(previous: Option<Selector>) -> Selector
Returns a selector which matches a previous selector’s child.
Sourcepub fn class(previous: Option<Selector>, name: &str) -> Selector
pub fn class(previous: Option<Selector>, name: &str) -> Selector
Returns a selector which matches a control’s style class.
Sourcepub fn descendant(previous: Option<Selector>) -> Selector
pub fn descendant(previous: Option<Selector>) -> Selector
Returns a selector which matches a descendant of a previous selector.
Sourcepub fn is_type_info(
previous: Option<Selector>,
type_: &'static TypeInfo,
) -> Selector
pub fn is_type_info( previous: Option<Selector>, type_: &'static TypeInfo, ) -> Selector
Returns a selector which matches a type or a derived type.
Sourcepub fn is<T: ObjectType + Upcast<StyledElement>>() -> Selector
pub fn is<T: ObjectType + Upcast<StyledElement>>() -> Selector
Returns a selector which matches class T or a class derived from it.
Sourcepub fn name(previous: Option<Selector>, name: &str) -> Selector
pub fn name(previous: Option<Selector>, name: &str) -> Selector
Returns a selector which matches a control’s name.
Sourcepub fn nesting(_previous: Option<Selector>) -> Selector
pub fn nesting(_previous: Option<Selector>) -> Selector
Returns the nesting selector, which stands for the selector of the parent style.
Sourcepub fn not(previous: Option<Selector>, argument: Selector) -> Selector
pub fn not(previous: Option<Selector>, argument: Selector) -> Selector
Returns a selector which inverts the results of selector argument.
Sourcepub fn not_with(
previous: Option<Selector>,
argument: impl FnOnce(Option<Selector>) -> Selector,
) -> Selector
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.
Sourcepub fn nth_child(previous: Option<Selector>, step: i32, offset: i32) -> Selector
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.
Sourcepub fn nth_last_child(
previous: Option<Selector>,
step: i32,
offset: i32,
) -> Selector
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.
Sourcepub fn of_type_info(
previous: Option<Selector>,
type_: &'static TypeInfo,
) -> Selector
pub fn of_type_info( previous: Option<Selector>, type_: &'static TypeInfo, ) -> Selector
Returns a selector which matches a type.
Sourcepub fn of_type<T: ObjectType + Upcast<StyledElement>>() -> Selector
pub fn of_type<T: ObjectType + Upcast<StyledElement>>() -> Selector
Returns a selector which matches class T exactly.
Sourcepub fn or(selectors: impl IntoIterator<Item = Selector>) -> Selector
pub fn or(selectors: impl IntoIterator<Item = Selector>) -> Selector
Returns a selector which ORs selectors.
Sourcepub fn property_equals<T: PropertyValue>(
previous: Option<Selector>,
property: &'static StyledProperty<T>,
value: T,
) -> Selector
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.
Sourcepub fn property_equals_untyped(
previous: Option<Selector>,
property: &'static FerroProperty,
value: BoxedValue,
) -> Selector
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.
Trait Implementations§
Source§impl MarkupTyped for Selectors
impl MarkupTyped for Selectors
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl Freeze for Selectors
impl RefUnwindSafe for Selectors
impl Send for Selectors
impl Sync for Selectors
impl Unpin for Selectors
impl UnsafeUnpin for Selectors
impl UnwindSafe for Selectors
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more