# FlexBasis

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

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

```rust
struct FlexBasis
```

Specifies the initial size of a flex item.

The default value is `FlexBasis::AUTO`.

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

## Members

- [`AUTO`](#assoc_const-auto)
- [`new`](#function-new)
- [`absolute`](#function-absolute)
- [`value`](#function-value)
- [`kind`](#function-kind)
- [`auto`](#function-auto)
- [`is_auto`](#function-is_auto)
- [`is_absolute`](#function-is_absolute)
- [`is_relative`](#function-is_relative)
- [`parse`](#function-parse)

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

### AUTO

```rust
const AUTO: FlexBasis
```

A basis that represents the "auto" value, which means the size of the
flex item is determined by its content or other factors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L20)

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

### new

```rust
fn new(value: f64, kind: FlexBasisKind) -> Self
```

Creates a basis with the given value and kind. The kind determines
how the value affects the size of the flex item.

Panics if the value is negative, NaN or infinite.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L26)

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

### absolute

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

Creates a basis with the given absolute value.

Panics if the value is negative, NaN or infinite.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L37)

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

### value

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

The value of the basis. The meaning of this value depends on the
`FlexBasisKind`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L54)

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

### kind

```rust
const fn kind(self: &Self) -> FlexBasisKind
```

The kind of the basis. This determines how the value affects the size
of the flex item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L61)

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

### auto

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

A basis that represents the "auto" value, which means the size of the
flex item is determined by its content or other factors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L68)

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

### is_auto

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

Whether the basis is set to "auto".

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L74)

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

### is_absolute

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

Whether the basis is set to an absolute value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L80)

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

### is_relative

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

Whether the basis is set to a relative value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/flex_panel/flex_basis.rs#L86)

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

### parse

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

Converts a string flex-basis value to a `FlexBasis`.

Valid values are `auto` (in any casing), a number (`100`) or a
percentage (`50%`).

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

## 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`

## Availability

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