Merge pull request #91 from nvzqz/const-all-the-things

Make many functions `const`
This commit is contained in:
Héctor Ramón 2020-03-06 03:47:40 +01:00 committed by GitHub
commit d817fe8e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ impl<T> Vector<T> {
/// Creates a new [`Vector`] with the given components. /// Creates a new [`Vector`] with the given components.
/// ///
/// [`Vector`]: struct.Vector.html /// [`Vector`]: struct.Vector.html
pub fn new(x: T, y: T) -> Self { pub const fn new(x: T, y: T) -> Self {
Self { x, y } Self { x, y }
} }
} }

View File

@ -20,7 +20,7 @@ impl Limits {
/// ///
/// [`Limits`]: struct.Limits.html /// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html /// [`Size`]: ../struct.Size.html
pub fn new(min: Size, max: Size) -> Limits { pub const fn new(min: Size, max: Size) -> Limits {
Limits { Limits {
min, min,
max, max,

View File

@ -12,7 +12,7 @@ impl Node {
/// ///
/// [`Node`]: struct.Node.html /// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html /// [`Size`]: ../struct.Size.html
pub fn new(size: Size) -> Self { pub const fn new(size: Size) -> Self {
Self::with_children(size, Vec::new()) Self::with_children(size, Vec::new())
} }
@ -20,7 +20,7 @@ impl Node {
/// ///
/// [`Node`]: struct.Node.html /// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html /// [`Size`]: ../struct.Size.html
pub fn with_children(size: Size, children: Vec<Node>) -> Self { pub const fn with_children(size: Size, children: Vec<Node>) -> Self {
Node { Node {
bounds: Rectangle { bounds: Rectangle {
x: 0.0, x: 0.0,