Skip to content

Commit

Permalink
Consistently return HassleError and remove unneeded check macros
Browse files Browse the repository at this point in the history
Our public API becomes a lot cleaner when returning `HassleError`
everywhere, helped by the fact that `HRESULT`s from the low-level COM
API is a newtype with support for functions to convert to `Result<>`
easily.  These can be short-circuit-returned in a more Rust'y way
through the questionmark operator instead of wrapping everything in
large macro calls.  This change is based on a similar approach in the
Ash crate: https://github.com/MaikKlein/ash/pull/339/files
  • Loading branch information
MarijnS95 committed Jan 25, 2022
1 parent ae6a5d1 commit bfc7f90
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 453 deletions.
14 changes: 4 additions & 10 deletions examples/intellisense-tu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,11 @@ fn main() {

let child_cursors = cursor.get_all_children().unwrap();

assert_eq!(child_cursors[0].get_display_name().unwrap(), "g_input");
assert_eq!(child_cursors[1].get_display_name().unwrap(), "g_output");
assert_eq!(
child_cursors[0].get_display_name(),
Ok("g_input".to_owned())
);
assert_eq!(
child_cursors[1].get_display_name(),
Ok("g_output".to_owned())
);
assert_eq!(
child_cursors[2].get_display_name(),
Ok("copyCs(uint3)".to_owned())
child_cursors[2].get_display_name().unwrap(),
"copyCs(uint3)"
);

for child_cursor in child_cursors {
Expand Down
Loading

0 comments on commit bfc7f90

Please sign in to comment.