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

feature: check if valid port on server listening #19

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

impl Server {
pub fn new() -> Self {

Check warning on line 18 in src/lib.rs

View workflow job for this annotation

GitHub Actions / lint

you should consider adding a `Default` implementation for `Server`

Check warning on line 18 in src/lib.rs

View workflow job for this annotation

GitHub Actions / lint

you should consider adding a `Default` implementation for `Server`
Server { initialized: true }
}

Expand All @@ -38,7 +38,11 @@
panic!("An error occured, parameters need to be valid local host");
}

if !Params::is_valid_port(port) {
panic!("An error occured, parameters need to be valid local port");
}

addr.push_str(&host);

Check warning on line 45 in src/lib.rs

View workflow job for this annotation

GitHub Actions / lint

this expression creates a reference which is immediately dereferenced by the compiler

Check warning on line 45 in src/lib.rs

View workflow job for this annotation

GitHub Actions / lint

this expression creates a reference which is immediately dereferenced by the compiler
addr.push(':');
addr.push_str(&port.to_string());

Expand Down Expand Up @@ -130,7 +134,7 @@
let is_host_empty = host.is_empty();
let is_port_empty = port == 0;

match (is_host_empty, is_port_empty) {

Check warning on line 137 in src/lib.rs

View workflow job for this annotation

GitHub Actions / lint

match expression looks like `matches!` macro

Check warning on line 137 in src/lib.rs

View workflow job for this annotation

GitHub Actions / lint

match expression looks like `matches!` macro
(true, true) => true,
_ => false,
}
Expand Down
Loading