Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use const fn #35

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Use const fn #35

wants to merge 9 commits into from

Conversation

lrazovic
Copy link

@lrazovic lrazovic commented Sep 7, 2021

This PR aims to convert all the possibles functions to const fn in order to be used in other const fn environments, but also includes several changes to cleanup the code. Many of the changed lines of code are due to cargo fmt.

  • Use the include field in Cargo.toml to decrease the crate size by 6% (~2.4 KB).
  • Use the is_err() method in the server example instead of the if let Err(_) syntax.
  • Remove the unused &selfparameter in allow_everyone_connect() function and updated the test to reflect the new syntax. The empty() call can be removed since Endpoint::new() already sets security_attributes to SecurityAttributes::empty()
  • Use .cast() instead of as *mut _. pointer::cast is safer because it cannot accidentally change the pointer’s mutability nor cast the pointer to other types

Changes have been tested on Linux and Windows.

If my observations are wrong I am ready to discuss/change them based on your feedback.

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.

None yet

1 participant