Struct exar_server::Server
[−]
[src]
pub struct Server { // some fields omitted }
Exar DB's server.
It manages TCP connections.
Examples
extern crate exar; extern crate exar_server; use exar::*; use exar_server::*; let db = Database::new(DatabaseConfig::default()); let config = ServerConfig::default(); let mut server = Server::new(config, db).unwrap(); server.listen();
Methods
impl Server
[src]
fn new(config: ServerConfig, db: Database) -> Result<Server, DatabaseError>
Creates a server with the given config and database and binds it to the configured host and port,
or returns a DatabaseError
if a failure occurs.
fn bind<A: ToSocketAddrs>(address: A, db: Database) -> Result<Server, DatabaseError>
Creates a server database and binds it to the given address,
or returns a DatabaseError
if a failure occurs.
fn with_credentials(self, username: &str, password: &str) -> Server
Returns a modified version of the server by setting its credentials to the given value.
fn listen(&self)
Starts listening for incoming TCP connections.
It will block the current thread indefinitely.