pub struct Server { /* private fields */ }
Expand description
The linebased TCP server
Implementations§
Source§impl Server
impl Server
Sourcepub fn new<F>(config: Config, func: F) -> Result<Server>
pub fn new<F>(config: Config, func: F) -> Result<Server>
Create a new server
use linebased::Server;
// Create a server with the default config and a
// handler that only knows the "version" command
let mut server = Server::new(Default::default(), |query| {
match query {
"version" => {
String::from("0.1.0")
},
_ => {
String::from("unknown command")
}
}
}).unwrap();
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more