-
Notifications
You must be signed in to change notification settings - Fork 260
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
70fddc0
commit 38a18c3
Showing
3 changed files
with
24 additions
and
1 deletion.
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
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,21 @@ | ||
use serde::Deserialize; | ||
|
||
use crate::ClientError; | ||
|
||
/// 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