-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ffi): add Element specific well known struct and a way to deseri…
…alize it from external clients
- Loading branch information
1 parent
f66b33a
commit bbfa9de
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::ClientError; | ||
use serde::Deserialize; | ||
|
||
/// Well-known settings specific to ElementCall | ||
#[derive(Deserialize, uniffi::Record)] | ||
pub struct ElementCallWellKnown { | ||
widget_url: String, | ||
} | ||
|
||
/// Element specific well-known settings | ||
#[derive(Deserialize, uniffi::Record)] | ||
pub struct ElementWellKnown { | ||
call: ElementCallWellKnown, | ||
} | ||
|
||
/// Helper function to parse a string into a ElementWellKnown struct | ||
#[uniffi::export] | ||
pub fn make_element_well_known(string: String) -> Result<ElementWellKnown, ClientError> { | ||
serde_json::from_str(&string).map_err(ClientError::new) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters