Length

Length describes a layout length as data. It is used by Container, BoxStyle, positioning, padding, margin, and other typed layout APIs.
Variant or constructor
Meaning
Length::points(x)
Fixed logical points.
Length::percent(x)
Percentage of the containing axis. 50.0 means 50%.
Length::vw(x)
Percentage of active viewport width.
Length::vh(x)
Percentage of active viewport height.
Length::clamp(min, preferred, max)
Preferred value bounded by min and max.
Length::min(values)
Smallest resolved value.
Length::max(values)
Largest resolved value.
Length::fit_content(limit)
Intrinsic content size, optionally capped.
Length::MinContent
Minimum intrinsic content size.
Length::MaxContent
Preferred intrinsic content size.
Length::Auto
Let the active layout algorithm choose.
const PROFILE_MIN_WIDTH: f32 = 280.0;
const PROFILE_MAX_WIDTH: f32 = 480.0;

Container::new(ProfileCard)
    .width_length(Length::clamp(
        Length::points(PROFILE_MIN_WIDTH),
        Length::percent(36.0),
        Length::points(PROFILE_MAX_WIDTH),
    ))
    .into()
Fission
A cross-platform, GPU-accelerated user interface framework for Rust. MIT licensed.
Copyright (c) 2026 Fission
Ready to use today. Widget APIs are expected to remain stable; some runtime and shell APIs may change before 1.0.0.
Fission 0.9.2