# GridLength

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-gridlength/

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

```rust
struct GridLength
```

Holds the width or height of a `Grid`'s column and row definitions.

The default value is an auto-sized length with a value of zero.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L26)

## Members

- [`AUTO`](#assoc_const-auto)
- [`STAR`](#assoc_const-star)
- [`from_pixels`](#function-from_pixels)
- [`new`](#function-new)
- [`auto`](#function-auto)
- [`star`](#function-star)
- [`grid_unit_type`](#function-grid_unit_type)
- [`is_absolute`](#function-is_absolute)
- [`is_auto`](#function-is_auto)
- [`is_star`](#function-is_star)
- [`value`](#function-value)
- [`parse`](#function-parse)
- [`parse_lengths`](#function-parse_lengths)

<a id="assoc_const-auto"></a>

### AUTO

```rust
const AUTO: GridLength
```

A length that indicates that a row or column should auto-size to fit
its content.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L34)

<a id="assoc_const-star"></a>

### STAR

```rust
const STAR: GridLength
```

A length that indicates that a row or column should fill its content.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L40)

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

### from_pixels

```rust
fn from_pixels(value: f64) -> Self
```

Creates a length in device independent pixels.

Panics if the value is negative, NaN or infinite.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L48)

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

### new

```rust
fn new(value: f64, type_: GridUnitType) -> Self
```

Creates a length with the given unit.

Panics if the value is negative, NaN or infinite.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L55)

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

### auto

```rust
const fn auto() -> Self
```

A length that indicates that a row or column should auto-size to fit
its content.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L70)

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

### star

```rust
const fn star() -> Self
```

A length that indicates that a row or column should fill its content.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L76)

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

### grid_unit_type

```rust
const fn grid_unit_type(self: &Self) -> GridUnitType
```

The unit of the length.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L82)

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

### is_absolute

```rust
fn is_absolute(self: &Self) -> bool
```

Whether the length has a `GridUnitType` of `Pixel`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L88)

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

### is_auto

```rust
fn is_auto(self: &Self) -> bool
```

Whether the length has a `GridUnitType` of `Auto`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L94)

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

### is_star

```rust
fn is_star(self: &Self) -> bool
```

Whether the length has a `GridUnitType` of `Star`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L100)

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

### value

```rust
const fn value(self: &Self) -> f64
```

The length.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L106)

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

### parse

```rust
fn parse(s: &str) -> Result<GridLength, FormatError>
```

Parses a string to return a `GridLength`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L111)

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

### parse_lengths

```rust
fn parse_lengths(s: &str) -> Result<Vec<GridLength>, FormatError>
```

Parses a string to return a collection of `GridLength`s.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/grid_length.rs#L144)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Debug`
- `Default`
- `PartialEq`
- `Hash`
- `Display`
- `FromStr`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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