docs(constraint): add note about percentages (#1368)

Co-authored-by: Orhun Parmaksız <orhun@archlinux.org>
This commit is contained in:
Josh McKinney 2024-09-13 04:42:52 -07:00 committed by GitHub
parent 5635b930c7
commit b88717b65f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,8 +116,12 @@ pub enum Constraint {
/// Applies a percentage of the available space to the element
///
/// Converts the given percentage to a floating-point value and multiplies that with area.
/// This value is rounded back to a integer as part of the layout split calculation.
/// Converts the given percentage to a floating-point value and multiplies that with area. This
/// value is rounded back to a integer as part of the layout split calculation.
///
/// **Note**: As this value only accepts a `u16`, certain percentages that cannot be
/// represented exactly (e.g. 1/3) are not possible. You might want to use
/// [`Constraint::Ratio`] or [`Constraint::Fill`] in such cases.
///
/// # Examples
///