Skip to content

Commit c3cc319

Browse files
Method signature refactor for ServerSocket constr.
ServerSocket::new(...) -> ServerSocket::bind(...) Documentation refactor mirroring changes
1 parent 5bf5d85 commit c3cc319

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/src/socket/server/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl ServerSocket{
102102
/// #[tokio::main]
103103
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
104104
/// let port: u16 = 8080;
105-
/// match ServerSocket::new(port).await {
105+
/// match ServerSocket::bind(port).await {
106106
/// Ok(server) => {
107107
/// println!("Server started on port {}", server.port);
108108
/// }
@@ -131,9 +131,9 @@ impl ServerSocket{
131131
/// - [`ServerSocketError`] for details on the possible errors.
132132
/// - [`TcpListener`] for information on TCP listener behavior and usage.
133133
/// ```rust
134-
/// pub async fn new(port: u16) -> Result<Self, ServerSocketError> {
134+
/// pub async fn bind(port: u16) -> Result<Self, ServerSocketError> {
135135
/// //localhost
136-
/// let localhost = Ipv4Addr::new(127, 0, 0, 1);
136+
/// let localhost = Ipv4Addr::bind(127, 0, 0, 1);
137137
/// let tcp_listener = TcpListener::bind((localhost, port)).await?; // ServerSocketError::IoError{source:<Error>}
138138
///
139139
/// Ok(ServerSocket {
@@ -143,7 +143,7 @@ impl ServerSocket{
143143
/// })
144144
/// }
145145
/// ```
146-
pub async fn new(port: u16) -> Result<Self, ServerSocketError> {
146+
pub async fn bind(port: u16) -> Result<Self, ServerSocketError> {
147147
//localhost
148148
let localhost = Ipv4Addr::new(127, 0, 0, 1);
149149
let tcp_listener = TcpListener::bind((localhost, port)).await?; // ServerSocketError::IoError{source:<Error>}

0 commit comments

Comments
 (0)