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.
This PR aims to convert all the possibles functions to
const fn
in order to be used in otherconst fn
environments, but also includes several changes to cleanup the code. Many of the changed lines of code are due tocargo fmt
.include
field inCargo.toml
to decrease the crate size by 6% (~2.4 KB).is_err()
method in the server example instead of theif let Err(_)
syntax.&self
parameter inallow_everyone_connect()
function and updated the test to reflect the new syntax. Theempty()
call can be removed sinceEndpoint::new()
already setssecurity_attributes
toSecurityAttributes::empty()
.cast()
instead ofas *mut _
.pointer::cast
is safer because it cannot accidentally change the pointer’s mutability nor cast the pointer to other typesChanges have been tested on Linux and Windows.
If my observations are wrong I am ready to discuss/change them based on your feedback.