Skip to content

Make many functions const#91

Merged
hecrj merged 2 commits into
iced-rs:masterfrom
nvzqz:const-all-the-things
Mar 6, 2020
Merged

Make many functions const#91
hecrj merged 2 commits into
iced-rs:masterfrom
nvzqz:const-all-the-things

Conversation

@nvzqz
Copy link
Copy Markdown
Contributor

@nvzqz nvzqz commented Nov 30, 2019

The point is to set up repeated components or boilerplate before their use sites.

The majority of these make sense as const. However, some functions such as those regarding state may not make sense as const.

The point is to set up repeated components or boilerplate before their
use sites.

The majority of these make sense as `const`. However, some functions
such as those regarding state may not make sense as `const`.
Copy link
Copy Markdown
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

However, some functions such as those regarding state may not make sense as const.

Yes, I believe the methods min, max, size, bounds, and is_focused should be left as is. I cannot picture a const use case for those. I have rarely used const fn, though. What do you think?

Copy link
Copy Markdown
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the const from all the widget methods, as they cannot be reused between views yet.

We can merge this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants