(&self)
| 23 | } |
| 24 | |
| 25 | pub fn flush(&self) { |
| 26 | println!(">>>> BitVM Query Response <<<<"); |
| 27 | |
| 28 | match &self.status { |
| 29 | ResponseStatus::OK => { |
| 30 | println!( |
| 31 | "{}", |
| 32 | json!({ |
| 33 | "status": "OK", |
| 34 | "data": match &self.data { |
| 35 | Some(data) => data.clone(), |
| 36 | None => json!({}), |
| 37 | }, |
| 38 | "error": "", |
| 39 | }) |
| 40 | ); |
| 41 | } |
| 42 | ResponseStatus::NOK(msg) => { |
| 43 | println!( |
| 44 | "{}", |
| 45 | json!({ |
| 46 | "status": "NOK", |
| 47 | "data": "", |
| 48 | "error": msg |
| 49 | }) |
| 50 | ); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | std::process::exit(match self.status { |
| 55 | ResponseStatus::OK => 0, |
| 56 | ResponseStatus::NOK(_) => 1, |
| 57 | }); |
| 58 | } |
| 59 | } |
no outgoing calls
no test coverage detected