11 lines
308 B
Rust
11 lines
308 B
Rust
|
use anyhow::Context;
|
||
|
use serde::Serialize;
|
||
|
|
||
|
pub fn string(str: &str) -> String {
|
||
|
serde_yml::to_string(str).expect("Should be able to encode string")
|
||
|
}
|
||
|
|
||
|
pub fn to_string<T: ?Sized + Serialize>(value: &T) -> anyhow::Result<String> {
|
||
|
serde_yml::to_string(value).context("Could not serialize to yaml")
|
||
|
}
|