Skip to content

Instantly share code, notes, and snippets.

@jamesmunns
Created July 6, 2016 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmunns/2e094dc138d3ea642a91171d7d444a3a to your computer and use it in GitHub Desktop.
Save jamesmunns/2e094dc138d3ea642a91171d7d444a3a to your computer and use it in GitHub Desktop.
pub fn handler(&self, req: CoAPRequest) -> Option<CoAPResponse> {
match req.get_option(CoAPOption::UriPath) {
Some(req_path) => {
match req.get_class() {
MessageClass::RequestType(rq_type) => {
match self.map.get(&rq_type) {
Some(dispatch) => {
dispatch.get(&req_path)
},
None => None,
}
},
_ => None,
}
},
None => None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment