use serde::{Deserialize, Serialize};
use schemars::JsonSchema;
#[derive(Debug, Deserialize, JsonSchema)]
pub struct Input {
pub text: String,
}
#[derive(Debug, Serialize, JsonSchema)]
pub struct Output {
pub result: String,
}
pub struct TextReverse;
impl TextReverse {
pub const MODULE_ID: &'static str = "text.reverse";
pub const DESCRIPTION: &'static str = "Reverse a string character by character";
pub fn execute(input: Input) -> Output {
Output {
result: input.text.chars().rev().collect(),
}
}
}
fn main() {
let input = Input { text: "apcore-cli".to_string() };
let output = TextReverse::execute(input);
println!("{}", serde_json::to_string_pretty(&output).unwrap());
}