# Selectors

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/styling/struct-selectors/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct Selectors
```

Functions for building [`Selector`](/docs/0.5.0/api/ferroui-base/styling/struct-selector/)s.

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`](/docs/0.5.0/api/ferroui-base/styling/struct-selector/):

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

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L18)

## Members

- [`child`](#function-child)
- [`class`](#function-class)
- [`descendant`](#function-descendant)
- [`is_type_info`](#function-is_type_info)
- [`is`](#function-is)
- [`name`](#function-name)
- [`nesting`](#function-nesting)
- [`not`](#function-not)
- [`not_with`](#function-not_with)
- [`nth_child`](#function-nth_child)
- [`nth_last_child`](#function-nth_last_child)
- [`of_type_info`](#function-of_type_info)
- [`of_type`](#function-of_type)
- [`or`](#function-or)
- [`property_equals`](#function-property_equals)
- [`property_equals_untyped`](#function-property_equals_untyped)
- [`template`](#function-template)

<a id="function-child"></a>

### child

```rust
fn child(previous: Option<Selector>) -> Selector
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L22)

<a id="function-class"></a>

### class

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L27)

<a id="function-descendant"></a>

### descendant

```rust
fn descendant(previous: Option<Selector>) -> Selector
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L43)

<a id="function-is_type_info"></a>

### is_type_info

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L48)

<a id="function-is"></a>

### is

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L53)

<a id="function-name"></a>

### name

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

Returns a selector which matches a control's name.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L58)

<a id="function-nesting"></a>

### nesting

```rust
fn nesting(_previous: Option<Selector>) -> Selector
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L75)

<a id="function-not"></a>

### not

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

Returns a selector which inverts the results of selector argument.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L80)

<a id="function-not_with"></a>

### not_with

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L86)

<a id="function-nth_child"></a>

### nth_child

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L92)

<a id="function-nth_last_child"></a>

### nth_last_child

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L98)

<a id="function-of_type_info"></a>

### of_type_info

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

Returns a selector which matches a type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L103)

<a id="function-of_type"></a>

### of_type

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

Returns a selector which matches class `T` exactly.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L108)

<a id="function-or"></a>

### or

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

Returns a selector which ORs selectors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L113)

<a id="function-property_equals"></a>

### property_equals

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L119)

<a id="function-property_equals_untyped"></a>

### property_equals_untyped

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L129)

<a id="function-template"></a>

### template

```rust
fn template(previous: Option<Selector>) -> Selector
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/selectors.rs#L138)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
