# actix_web::actix::actix::Handler - Rust
API documentation for the Rust `Handler` trait in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, Handler

# Trait actix_web::actix::actix::Handler [−]

    pub trait Handler<M>: Actor + Actor where
        M: Message, {
        type Result: MessageResponse<Self, M>;
        fn handle(&mut self, msg: M, ctx: &mut Self::Context) -> Self::Result;
    }

Message handler

`Handler` implementation is a general way how to handle incoming messages, streams, futures.

`M` is a message which can be handled by the actor.

## Associated Types

### `type Result: MessageResponse<Self, M>`

The type of value that this handle will return

## Required Methods

### `fn handle(&mut self, msg: M, ctx: &mut Self::Context) -> Self::Result`

Method is called for every message received by this Actor

## Implementors

- `impl<I, E> Handler<Execute<I, E>> for Arbiter where E: Send, I: Send, type Result = Result<I, E>;` |

- `impl Handler<Resolve> for Resolver type Result = Box<ActorFuture<Error = ResolverError, Item = VecDeque<SocketAddr>, Actor = Resolver> + 'static>;` |

- `impl Handler<StopArbiter> for Arbiter type Result = ();` |

- `impl Handler<Signal> for DefaultSignalsHandler type Result = ();` |

- `impl Handler<ConnectAddr> for Resolver type Result = Box<ActorFuture<Error = ResolverError, Item = TcpStream, Actor = Resolver> + 'static>;` |

- `impl<A> Handler<StartActor<A>> for Arbiter where A: Actor<Context = Context<A>>, type Result = Addr<A>;` |

- `impl Handler<Subscribe> for ProcessSignals type Result = ();` |

- `impl Handler<Connect> for Resolver type Result = Box<ActorFuture<Error = ResolverError, Item = TcpStream, Actor = Resolver> + 'static>;` |

- `impl Handler<Pause> for ClientConnector type Result = ();` | [src]

- `impl Handler<Resume> for ClientConnector type Result = ();` | [src]

- `impl Handler<Connect> for ClientConnector type Result = ActorResponse<ClientConnector, Connection, ClientConnectorError>;` | [src]

- `impl<H: IntoHttpHandler> Handler<Signal> for HttpServer<H> type Result = ();` | [src]

- `impl<H: IntoHttpHandler> Handler<PauseServer> for HttpServer<H> type Result = ();` | [src]

- `impl<H: IntoHttpHandler> Handler<ResumeServer> for HttpServer<H> type Result = ();` | [src]

- `impl<H: IntoHttpHandler> Handler<StopServer> for HttpServer<H> type Result = Response<(), ()>;` | [src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)