Skip to content

Commit

Permalink
Merge pull request #91 from nvzqz/const-all-the-things
Browse files Browse the repository at this point in the history
Make many functions `const`
  • Loading branch information
hecrj authored Mar 6, 2020
2 parents 3062c19 + f81827c commit d817fe8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<T> Vector<T> {
/// Creates a new [`Vector`] with the given components.
///
/// [`Vector`]: struct.Vector.html
pub fn new(x: T, y: T) -> Self {
pub const fn new(x: T, y: T) -> Self {
Self { x, y }
}
}
Expand Down
2 changes: 1 addition & 1 deletion native/src/layout/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Limits {
///
/// [`Limits`]: struct.Limits.html
/// [`Size`]: ../struct.Size.html
pub fn new(min: Size, max: Size) -> Limits {
pub const fn new(min: Size, max: Size) -> Limits {
Limits {
min,
max,
Expand Down
4 changes: 2 additions & 2 deletions native/src/layout/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ impl Node {
///
/// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html
pub fn new(size: Size) -> Self {
pub const fn new(size: Size) -> Self {
Self::with_children(size, Vec::new())
}

/// Creates a new [`Node`] with the given [`Size`] and children.
///
/// [`Node`]: struct.Node.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 {
bounds: Rectangle {
x: 0.0,
Expand Down

0 comments on commit d817fe8

Please sign in to comment.