melvin_ob/http_handler/http_response/
beacon_position.rs1use crate::http_handler::http_response::response_common::SerdeJSONBodyHTTPResponseType;
2
3#[derive(serde::Deserialize, Debug)]
5pub(crate) struct BeaconPositionResponse {
6 status: String,
8 attempts_made: i8,
10}
11
12impl BeaconPositionResponse {
13 pub(crate) fn is_success(&self) -> bool { self.status.contains("The beacon was found!") }
15 pub(crate) fn attempts_made(&self) -> i8 { self.attempts_made }
17 pub(crate) fn is_unknown(&self) -> bool { self.status.contains("Could not find beacon") }
19 pub(crate) fn is_fail(&self) -> bool { self.status.contains("The beacon could not be found") }
21 pub(crate) fn is_last(&self) -> bool { self.status.contains("No more rescue attempts") }
23 pub(crate) fn msg(&self) -> &str { &self.status }
25}
26
27impl SerdeJSONBodyHTTPResponseType for BeaconPositionResponse {}