Skip to content

Commit

Permalink
Support isize (#53)
Browse files Browse the repository at this point in the history
* Support `isize`

* Update containers.rs
  • Loading branch information
fzyzcjy authored Dec 23, 2023
1 parent 1dc6a52 commit 424e5ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/into_dart_extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ impl IntoDart for usize {
}
}

#[cfg(target_pointer_width = "64")]
impl IntoDart for isize {
fn into_dart(self) -> DartCObject {
(self as i64).into_dart()
}
}

#[cfg(target_pointer_width = "32")]
impl IntoDart for isize {
fn into_dart(self) -> DartCObject {
(self as i32).into_dart()
}
}

impl IntoDart for char {
fn into_dart(self) -> DartCObject {
(self as u32).into_dart()
Expand Down
1 change: 1 addition & 0 deletions tests/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ fn main() {
assert!(isolate.post(42i128));
assert!(isolate.post(42u128));
assert!(isolate.post(42usize));
assert!(isolate.post(42isize));
assert!(isolate.post(true));
assert!(isolate.post(false));
assert!(isolate.post('🎊'));
Expand Down

0 comments on commit 424e5ac

Please sign in to comment.