18 lines
440 B
Rust
18 lines
440 B
Rust
use actix_web::http::StatusCode;
|
|
use actix_web::{HttpResponse, Responder};
|
|
use serde::Serialize;
|
|
|
|
#[derive(Serialize)]
|
|
pub struct Readable {
|
|
pub content: String,
|
|
}
|
|
|
|
impl Responder for Readable {
|
|
type Body = String;
|
|
|
|
fn respond_to(self, _req: &actix_web::HttpRequest) -> actix_web::HttpResponse<Self::Body> {
|
|
let body = serde_json::to_string(&self).unwrap();
|
|
HttpResponse::with_body(StatusCode::OK, body)
|
|
}
|
|
}
|