Skip to content

#[derive(Clone)] on Server #272

Description

@eflukx

Why not #[derive(Clone)] on the Server struct.

Let's you call server.clone() on the server object directly instead of needing to wrap it in another Arc

i.e. using

let server = tiny_http::Server::http("0.0.0.0:9975").unwrap();

let handles: Vec<_> = (0..8)
    .map(|_| {
        let server = server.clone();
        thread::spawn(move || for rq in server.incoming_requests() { . . . } )
    })
    .collect();
 . . . 
}

in stead of using

 let server = Arc::new(tiny_http::Server::http("0.0.0.0:9975").unwrap());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions