diff options
| author | Rubens Brandao <git@rubens.io> | 2024-05-27 17:45:25 -0300 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-05-28 17:11:23 -0400 |
| commit | 53eed1fedbef8c778ba1ea03d6660a7f097886ca (patch) | |
| tree | af3bedbd282f57a54a846afc847eea6cf1eb0064 /rust/src/string.rs | |
| parent | fbf782fcd84aa77f8765589bdda491646a957044 (diff) | |
allow `load_with_option` to accept json 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) + } +} |
