pub struct Server;Expand description
A RESP server.
Implementations§
Source§impl Server
impl Server
Sourcepub fn bind(addr: impl Into<String>) -> ServerBuilder
pub fn bind(addr: impl Into<String>) -> ServerBuilder
Bind a server to the provided address.
Examples found in repository?
More examples
examples/history.rs (line 50)
40pub async fn main() -> Result<()> {
41 let addr = env::args()
42 .nth(1)
43 .unwrap_or_else(|| "0.0.0.0:6379".to_string());
44
45 let app = Router::from_state(AppState::default())
46 .route("HISTORY", history)
47 .route("COMMAND", history)
48 .route("PING", ping);
49
50 Server::bind(&addr)
51 .with_graceful_shutdown(async {
52 let _ = signal::ctrl_c().await;
53 })
54 .serve(app)
55 .await
56}Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin 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