pub trait IntoDart {
// Required method
fn into_dart(self) -> DartCObject;
}Expand description
A trait to convert between Rust types and Dart Types that could then be sent to the isolate
see: crate::Isolate::post
Required Methods§
Sourcefn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
Consumes Self and Performs the conversion.
Implementations on Foreign Types§
Source§impl IntoDart for Vec<f32>
Available on crate feature zero-copy only.
impl IntoDart for Vec<f32>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<f64>
Available on crate feature zero-copy only.
impl IntoDart for Vec<f64>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<i8>
Available on crate feature zero-copy only.
impl IntoDart for Vec<i8>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<i16>
Available on crate feature zero-copy only.
impl IntoDart for Vec<i16>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<i32>
Available on crate feature zero-copy only.
impl IntoDart for Vec<i32>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<i64>
Available on crate feature zero-copy only.
impl IntoDart for Vec<i64>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<u8>
Available on crate feature zero-copy only.
impl IntoDart for Vec<u8>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<u16>
Available on crate feature zero-copy only.
impl IntoDart for Vec<u16>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<u32>
Available on crate feature zero-copy only.
impl IntoDart for Vec<u32>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<u64>
Available on crate feature zero-copy only.
impl IntoDart for Vec<u64>
zero-copy only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<NaiveDateTime>
impl IntoDart for Vec<NaiveDateTime>
fn into_dart(self) -> DartCObject
Source§impl IntoDart for Vec<Uuid>
impl IntoDart for Vec<Uuid>
Source§fn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
⚠️ concatenated in a single Vec<u8> for performance optimization
on the other side of FFI, value should be reconstructed like:
-
hydrate into Dart List<UuidValue>
return List<UuidValue>.generate( raw.lengthInBytes / 16, (int i) => UuidValue.fromByteList(Uint8List.view(raw.buffer, i * 16, 16)), growable: false); -
hydrate into Rust Vec<Uuid>
ⓘraw .as_slice() .chunks(16) .map(|x: &[u8]| uuid::Uuid::from_bytes(*<&[u8] as std::convert::TryInto<&[u8;16]>>::try_into(x).expect("invalid uuid slice"))) .collect();
note that buffer could end up being incomplete under the same conditions as of std::io::Write::write.
Source§impl IntoDart for Error
Available on crate feature anyhow only.
impl IntoDart for Error
anyhow only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for Backtrace
Available on crate feature backtrace only.
impl IntoDart for Backtrace
backtrace only.fn into_dart(self) -> DartCObject
Source§impl IntoDart for DateTime<Local>
impl IntoDart for DateTime<Local>
Source§fn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
on the other side of FFI, value should be reconstructed like:
-
hydrate into Dart DateTime
DateTime.fromMicrosecondsSinceEpoch(raw, isUtc: false); -
hydrate into Rust DateTime::<Local>
ⓘlet s = (raw / 1_000_000) as i64; let ns = (raw.rem_euclid(1_000_000) * 1_000) as u32; chrono::DateTime::<chrono::Local>::from( chrono::DateTime::<chrono::Utc>::from_utc( chrono::NaiveDateTime::from_timestamp(s, ns), chrono::Utc));note that it could overflow under the same conditions as of chrono::NaiveDateTime::from_timestamp
Source§impl IntoDart for DateTime<Utc>
impl IntoDart for DateTime<Utc>
Source§fn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
on the other side of FFI, value should be reconstructed like:
-
hydrate into Dart DateTime
DateTime.fromMicrosecondsSinceEpoch(raw, isUtc: true); -
hydrate into Rust DateTime::<Utc>
ⓘlet s = (raw / 1_000_000) as i64; let ns = (raw.rem_euclid(1_000_000) * 1_000) as u32; chrono::DateTime::<chrono::Utc>::from_utc( chrono::NaiveDateTime::from_timestamp(s, ns), chrono::Utc);note that it could overflow under the same conditions as of chrono::NaiveDateTime::from_timestamp
Source§impl IntoDart for NaiveDate
impl IntoDart for NaiveDate
Source§fn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
on the other side of FFI, value should be reconstructed like:
-
hydrate into Dart DateTime
DateTime.fromMicrosecondsSinceEpoch(raw, isUtc: true); -
hydrate into Rust NaiveDateTime
ⓘlet s = (raw / 1_000_000) as i64; let ns = (raw.rem_euclid(1_000_000) * 1_000) as u32; chrono::NaiveDateTime::from_timestamp(s, ns)note that it could overflow under the same conditions as of chrono::NaiveDateTime::from_timestamp
Source§impl IntoDart for NaiveDateTime
impl IntoDart for NaiveDateTime
Source§fn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
on the other side of FFI, value should be reconstructed like:
-
hydrate into Dart DateTime
DateTime.fromMicrosecondsSinceEpoch(raw, isUtc: true); -
hydrate into Rust NaiveDateTime
ⓘlet s = (raw / 1_000_000) as i64; let ns = (raw.rem_euclid(1_000_000) * 1_000) as u32; chrono::NaiveDateTime::from_timestamp(s, ns)note that it could overflow under the same conditions as of chrono::NaiveDateTime::from_timestamp
Source§impl IntoDart for Uuid
impl IntoDart for Uuid
Source§fn into_dart(self) -> DartCObject
fn into_dart(self) -> DartCObject
delegate to Vec<u8> implementation
on the other side of FFI, value should be reconstructed like:
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart> IntoDart for (A, B, C)
impl<A: IntoDart, B: IntoDart, C: IntoDart> IntoDart for (A, B, C)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart> IntoDart for (A, B, C, D)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart> IntoDart for (A, B, C, D)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart> IntoDart for (A, B, C, D, E)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart> IntoDart for (A, B, C, D, E)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart> IntoDart for (A, B, C, D, E, F)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart> IntoDart for (A, B, C, D, E, F)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart> IntoDart for (A, B, C, D, E, F, G)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart> IntoDart for (A, B, C, D, E, F, G)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart> IntoDart for (A, B, C, D, E, F, G, H)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart> IntoDart for (A, B, C, D, E, F, G, H)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart, I: IntoDart> IntoDart for (A, B, C, D, E, F, G, H, I)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart, I: IntoDart> IntoDart for (A, B, C, D, E, F, G, H, I)
fn into_dart(self) -> DartCObject
Source§impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart, I: IntoDart, J: IntoDart> IntoDart for (A, B, C, D, E, F, G, H, I, J)
impl<A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart, I: IntoDart, J: IntoDart> IntoDart for (A, B, C, D, E, F, G, H, I, J)
fn into_dart(self) -> DartCObject
Source§impl<T> IntoDart for *const T
Available on 64-bit only.A workaround to send raw pointers to dart over the port.
it will be sent as int64 on 64bit targets, and as int32 on 32bit targets.
impl<T> IntoDart for *const T
A workaround to send raw pointers to dart over the port. it will be sent as int64 on 64bit targets, and as int32 on 32bit targets.