diff options
Diffstat (limited to 'rust/src/string.rs')
| -rw-r--r-- | rust/src/string.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/rust/src/string.rs b/rust/src/string.rs index f4098d66..936e3033 100644 --- a/rust/src/string.rs +++ b/rust/src/string.rs @@ -246,3 +246,15 @@ unsafe impl BnStrCompatible for &QualifiedName { self.string().into_bytes_with_nul() } } + +pub trait IntoJson { + type Output: BnStrCompatible; + fn get_json_string(self) -> Result<Self::Output, ()>; +} + +impl<S: BnStrCompatible> IntoJson for S { + type Output = S; + fn get_json_string(self) -> Result<Self::Output, ()> { + Ok(self) + } +} |
