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§

source

fn into_dart(self) -> DartCObject

Consumes Self and Performs the conversion.

Implementations on Foreign Types§

source§

impl IntoDart for &str

source§

impl IntoDart for bool

source§

impl IntoDart for char

source§

impl IntoDart for f32

source§

impl IntoDart for f64

source§

impl IntoDart for i8

source§

impl IntoDart for i16

source§

impl IntoDart for i32

source§

impl IntoDart for i64

source§

impl IntoDart for i128

source§

impl IntoDart for u8

source§

impl IntoDart for u16

source§

impl IntoDart for u32

source§

impl IntoDart for u64

source§

impl IntoDart for u128

source§

impl IntoDart for ()

source§

impl IntoDart for usize

source§

impl IntoDart for CString

source§

impl IntoDart for String

source§

impl IntoDart for Vec<f32>

source§

impl IntoDart for Vec<f64>

source§

impl IntoDart for Vec<i8>

source§

impl IntoDart for Vec<i16>

source§

impl IntoDart for Vec<i32>

source§

impl IntoDart for Vec<i64>

source§

impl IntoDart for Vec<u8>

source§

impl IntoDart for Vec<u16>

source§

impl IntoDart for Vec<u32>

source§

impl IntoDart for Vec<u64>

source§

impl IntoDart for Vec<DateTime<Local>>

source§

impl IntoDart for Vec<DateTime<Utc>>

source§

impl IntoDart for Vec<Duration>

source§

impl IntoDart for Vec<NaiveDateTime>

source§

impl IntoDart for Error

source§

impl IntoDart for Backtrace

source§

impl IntoDart for DateTime<Local>

source§

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>

source§

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 Duration

source§

fn into_dart(self) -> DartCObject

on the other side of FFI, value should be reconstructed like:

  • hydrate into Dart Duration Duration(microseconds: raw);

  • hydrate into Rust Duration chrono::Duration::microseconds(raw);

source§

impl IntoDart for NaiveDateTime

source§

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<A> IntoDart for (A,)
where A: IntoDart,

source§

impl<A, B> IntoDart for (A, B)
where A: IntoDart, B: IntoDart,

source§

impl<A, B, C> IntoDart for (A, B, C)
where A: IntoDart, B: IntoDart, C: IntoDart,

source§

impl<A, B, C, D> IntoDart for (A, B, C, D)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart,

source§

impl<A, B, C, D, E> IntoDart for (A, B, C, D, E)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart,

source§

impl<A, B, C, D, E, F> IntoDart for (A, B, C, D, E, F)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart,

source§

impl<A, B, C, D, E, F, G> IntoDart for (A, B, C, D, E, F, G)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart,

source§

impl<A, B, C, D, E, F, G, H> IntoDart for (A, B, C, D, E, F, G, H)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart,

source§

impl<A, B, C, D, E, F, G, H, I> IntoDart for (A, B, C, D, E, F, G, H, I)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart, I: IntoDart,

source§

impl<A, B, C, D, E, F, G, H, I, J> IntoDart for (A, B, C, D, E, F, G, H, I, J)
where A: IntoDart, B: IntoDart, C: IntoDart, D: IntoDart, E: IntoDart, F: IntoDart, G: IntoDart, H: IntoDart, I: IntoDart, J: IntoDart,

source§

impl<T> IntoDart for Option<T>
where T: IntoDart,

source§

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.

source§

impl<T> IntoDart for *mut T

source§

impl<T> IntoDart for Vec<T>

source§

impl<T, E> IntoDart for Result<T, E>
where T: IntoDart, E: ToString,

source§

impl<T, const N: usize> IntoDart for [T; N]

source§

impl<const N: usize> IntoDart for [f32; N]

source§

impl<const N: usize> IntoDart for [f64; N]

source§

impl<const N: usize> IntoDart for [i8; N]

source§

impl<const N: usize> IntoDart for [i16; N]

source§

impl<const N: usize> IntoDart for [i32; N]

source§

impl<const N: usize> IntoDart for [i64; N]

source§

impl<const N: usize> IntoDart for [u8; N]

source§

impl<const N: usize> IntoDart for [u16; N]

source§

impl<const N: usize> IntoDart for [u32; N]

source§

impl<const N: usize> IntoDart for [u64; N]

source§

impl<const N: usize> IntoDart for [DateTime<Local>; N]

source§

impl<const N: usize> IntoDart for [DateTime<Utc>; N]

source§

impl<const N: usize> IntoDart for [Duration; N]

source§

impl<const N: usize> IntoDart for [NaiveDateTime; N]

Implementors§

source§

impl IntoDart for flutter_rust_bridge::handler::Error

source§

impl IntoDart for Rust2DartAction

source§

impl<T> IntoDart for ZeroCopyBuffer<Vec<T>>
where T: DartTypedDataTypeTrait,

source§

impl<T> IntoDart for T
where T: Into<DartCObject>,

source§

impl<T, const N: usize> IntoDart for ZeroCopyBuffer<[T; N]>
where T: DartTypedDataTypeTrait,