Selector
struct · ferroui-base · v0.5.0
struct Selector
A selector in a Style.
Selectors are built with the functions of Selectors
and the chaining methods of this type. A selector is a shared, immutable
description: cloning the handle is cheap.
Members
target_typematch_to_string_with_ownerchildclassdescendantisis_type_infonamenestingnotnot_withnth_childnth_last_childof_typeof_type_infoproperty_equalsproperty_equals_untypedtemplate
target_type
fn target_type(self: &Self) -> Option<&'static TypeInfo>
The target type of the selector, if available.
match_
fn match_(self: &Self, control: &StyledElement, parent: Option<&StyleBase>, subscribe: bool) -> SelectorMatch
Tries to match the selector with a control.
parent is the parent style, if the style containing the selector is
a nested style. With subscribe, a match whose state can change over
time carries an activator that tracks it; without, the match is only
evaluated for the current state.
to_string_with_owner
fn to_string_with_owner(self: &Self, owner: Option<&Style>) -> String
Gets a string representing the selector, with the nesting separator
(^) replaced with the parent selector.
child
fn child(self: Self) -> Selector
Returns a selector which matches this selector's child.
class
fn class(self: Self, name: &str) -> Selector
Returns a selector which additionally matches a control's style class.
descendant
fn descendant(self: Self) -> Selector
Returns a selector which matches a descendant of this selector.
is
fn is<T: ObjectType + Upcast<StyledElement>>(self: Self) -> Selector
Returns a selector which additionally matches class T or a class
derived from it.
is_type_info
fn is_type_info(self: Self, type_: &'static TypeInfo) -> Selector
Returns a selector which additionally matches a type or a derived type.
name
fn name(self: Self, name: &str) -> Selector
Returns a selector which additionally matches a control's name.
nesting
fn nesting(self: Self) -> Selector
Returns the nesting selector.
not
fn not(self: Self, argument: Selector) -> Selector
Returns a selector which additionally inverts the results of
argument.
not_with
fn not_with(self: Self, argument: impl FnOnce(Option<Selector>) -> Selector) -> Selector
Returns a selector which additionally inverts the results of the
selector built by argument.
nth_child
fn nth_child(self: Self, step: i32, offset: i32) -> Selector
Returns a selector which additionally matches elements based on their position among a group of siblings.
nth_last_child
fn nth_last_child(self: Self, step: i32, offset: i32) -> Selector
Returns a selector which additionally matches elements based on their position among a group of siblings, counting from the end.
of_type
fn of_type<T: ObjectType + Upcast<StyledElement>>(self: Self) -> Selector
Returns a selector which additionally matches class T exactly.
of_type_info
fn of_type_info(self: Self, type_: &'static TypeInfo) -> Selector
Returns a selector which additionally matches a type.
property_equals
fn property_equals<T: PropertyValue>(self: Self, property: &'static StyledProperty<T>, value: T) -> Selector
Returns a selector which additionally matches a control with the specified property value.
property_equals_untyped
fn property_equals_untyped(self: Self, property: &'static FerroProperty, value: BoxedValue) -> Selector
Returns a selector which additionally matches a control with the
specified property value. value must hold exactly the property's
value type.
template
fn template(self: Self) -> Selector
Returns a selector which enters a lookless control's template.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherClonePartialEqDisplayDebugMarkupTyped
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.