[−][src]Struct linebased::Server
The linebased TCP server
Methods
impl Server
[src]
pub fn new<F>(config: Config, func: F) -> Result<Server> where
F: Fn(&str) -> String + 'static + Send + Sync,
[src]
F: Fn(&str) -> String + 'static + Send + Sync,
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();
pub fn handle(&self) -> Handle
[src]
Get a handle for the server so graceful shutdown can be requested
pub async fn run<'_>(&'_ mut self) -> Result<()>
[src]
Run the event loop
Auto Trait Implementations
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,