Skip to content

Commit

Permalink
Fix Vec<Vec<u8>> and std::backtrace::Backtrace (#57)
Browse files Browse the repository at this point in the history
* fix `Vec<Vec<u8>>`

* empty

* std backtrace
  • Loading branch information
fzyzcjy authored Jan 13, 2024
1 parent e66b88a commit 3b68fbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/into_dart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ impl IntoDart for anyhow::Error {
}
}

impl IntoDart for std::backtrace::Backtrace {
fn into_dart(self) -> DartCObject {
format!("{:?}", self).into_dart()
}
}

#[cfg(feature = "backtrace")]
impl IntoDart for backtrace::Backtrace {
fn into_dart(self) -> DartCObject {
Expand Down Expand Up @@ -236,6 +242,8 @@ macro_rules! dart_typed_data_type_trait_impl {
}
}

impl IntoDartExceptPrimitive for Vec<$rust_type> {}

impl IntoDart for HashSet<$rust_type> {
fn into_dart(self) -> DartCObject {
self.into_iter().collect::<Vec<_>>().into_dart()
Expand Down
3 changes: 3 additions & 0 deletions tests/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ fn main() {

#[cfg(feature = "anyhow")]
assert!(isolate.post(return_anyhow_error()));
assert!(isolate.post(std::backtrace::Backtrace::capture()));
#[cfg(feature = "backtrace")]
assert!(isolate.post(return_backtrace()));
#[cfg(feature = "chrono")]
Expand Down Expand Up @@ -224,6 +225,8 @@ fn main() {
assert!(isolate.post(HashSet::from([200])));
assert!(isolate.post(HashSet::from([200u8])));

assert!(isolate.post(vec![vec![10u8]]));

println!("all done!");
}

Expand Down

0 comments on commit 3b68fbc

Please sign in to comment.