Skip to main content

xnode_manager_sdk/utils/
output.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
4pub enum Output {
5    Bytes { output: Vec<u8> },
6    UTF8 { output: String },
7}
8
9impl From<Vec<u8>> for Output {
10    fn from(value: Vec<u8>) -> Self {
11        match String::from_utf8(value.clone()) {
12            Ok(output) => Output::UTF8 { output },
13            Err(_) => Output::Bytes { output: value },
14        }
15    }
16}