Skip to content

Commit 03f68d8

Browse files
authored
Merge pull request #10 from superwall/develop
0.1.12
2 parents a070662 + 8be57d1 commit 03f68d8

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
# CHANGELOG
22

3+
## 0.1.12
4+
5+
### Fixes
6+
7+
- Adds Result types to fix issues when building for iOS.
8+
39
## 0.1.11
410

5-
## Enhancements
11+
### Enhancements
612

713
- Adds new Android target
814
- Ensures JSON deserialization is done in a safe manner
915

1016
## 0.1.10
1117

12-
## Enhancements
18+
### Enhancements
1319

1420
- Updates github workflow for the renaming of the iOS repository.
1521

1622
## 0.1.9
1723

18-
## Enhancements
24+
### Enhancements
1925

2026
- Added returning of a JSON encoded `Result<PassableValue,String>` from the exposed methods instead of relying on panics.
2127
Example JSON:
2228
- Error: `{"Err":"No such key: should_display"}`
2329
- Ok: `{"Ok":{"type":"bool","value":true}}`
2430

25-
## Fixes
31+
### Fixes
2632

2733
- Fixed a bug where getting properties from `device` would panic when `device` functions were defined

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cel-eval"
3-
version = "0.1.11"
3+
version = "0.1.12"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmlž

src/lib.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn evaluate_ast_with_context(definition: String, host: Arc<dyn HostContext>)
6161
let data = match data {
6262
Ok(data) => data,
6363
Err(_) => {
64-
let e = Err("Invalid execution context JSON".to_string());
64+
let e : Result<_, String> = Err::<ASTExecutionContext,String>("Invalid execution context JSON".to_string());
6565
return serde_json::to_string(&e).unwrap()
6666
}
6767
};
@@ -87,7 +87,7 @@ pub fn evaluate_ast(ast: String) -> String {
8787
let data : JSONExpression = match data {
8888
Ok(data) => data,
8989
Err(_) => {
90-
let e = Err("Invalid definition for AST Execution".to_string());
90+
let e : Result<_, String> = Err::<JSONExpression,String>("Invalid definition for AST Execution".to_string());
9191
return serde_json::to_string(&e).unwrap()
9292
}
9393
};
@@ -110,13 +110,7 @@ pub fn evaluate_with_context(definition: String, host: Arc<dyn HostContext>) ->
110110
let data: ExecutionContext = match data {
111111
Ok(data) => data,
112112
Err(_) => {
113-
let e = Err("Invalid execution context JSON".to_string());
114-
return serde_json::to_string(&e).unwrap()
115-
}
116-
};
117-
let data = match data {
118-
Ok(data) => data,
119-
Err(e) => {
113+
let e : Result<ExecutionContext, String> = Err("Invalid execution context JSON".to_string());
120114
return serde_json::to_string(&e).unwrap()
121115
}
122116
};

0 commit comments

Comments
 (0)