summaryrefslogtreecommitdiffstats
path: root/native/src/size.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-24 11:34:30 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-24 11:34:30 +0100
commit149fd2aa1fa86858c7c1dcec8fd844caa78cec94 (patch)
treea199cf8d2caaf6aa60e48e93d6dd0688969d43b0 /native/src/size.rs
parent9712b319bb7a32848001b96bd84977430f14b623 (diff)
parent47196c9007d12d3b3e0036ffabe3bf6d14ff4523 (diff)
downloadiced-149fd2aa1fa86858c7c1dcec8fd844caa78cec94.tar.gz
iced-149fd2aa1fa86858c7c1dcec8fd844caa78cec94.tar.bz2
iced-149fd2aa1fa86858c7c1dcec8fd844caa78cec94.zip
Merge pull request #65 from hecrj/improvement/docs
Documentation
Diffstat (limited to 'native/src/size.rs')
-rw-r--r--native/src/size.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/native/src/size.rs b/native/src/size.rs
index bd909292..30e2a57e 100644
--- a/native/src/size.rs
+++ b/native/src/size.rs
@@ -1,5 +1,6 @@
use std::f32;
+/// An amount of space in 2 dimensions.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Size {
/// The width.
@@ -9,13 +10,26 @@ pub struct Size {
}
impl Size {
+ /// A [`Size`] with zero width and height.
+ ///
+ /// [`Size`]: struct.Size.html
pub const ZERO: Size = Size::new(0., 0.);
+
+ /// A [`Size`] with infinite width and height.
+ ///
+ /// [`Size`]: struct.Size.html
pub const INFINITY: Size = Size::new(f32::INFINITY, f32::INFINITY);
+ /// A [`Size`] of infinite width and height.
+ ///
+ /// [`Size`]: struct.Size.html
pub const fn new(width: f32, height: f32) -> Self {
Size { width, height }
}
+ /// Increments the [`Size`] to account for the given padding.
+ ///
+ /// [`Size`]: struct.Size.html
pub fn pad(&self, padding: f32) -> Self {
Size {
width: self.width + padding * 2.0,