Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions rust_crate/src/signal_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};

/// Defines the methods that a type capable of
/// receiving Dart signals must implement.
pub trait DartSignalBinary<T> {
pub trait DartSignalBinary
where
Self: Sized,
{
/// Returns the receiver that listens for signals from Dart.
///
/// If this function is called multiple times,
/// only the most recent receiver remains active,
/// and all previous ones become inactive after receiving `None`.
fn get_dart_signal_receiver() -> SignalReceiver<DartSignalPack<T>>;
fn get_dart_signal_receiver() -> SignalReceiver<DartSignalPack<Self>>;
}

/// Defines the methods that a type capable of
/// receiving Dart signals must implement.
pub trait DartSignal<T> {
pub trait DartSignal
where
Self: Sized,
{
/// Returns the receiver that listens for signals from Dart.
/// If this function is called multiple times,
/// only the most recent receiver remains active,
/// and all previous ones become inactive after receiving `None`.
fn get_dart_signal_receiver() -> SignalReceiver<DartSignalPack<T>>;
fn get_dart_signal_receiver() -> SignalReceiver<DartSignalPack<Self>>;
}

/// Defines the methods that a type capable of
Expand Down
4 changes: 2 additions & 2 deletions rust_crate_proc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ fn derive_dart_signal_real(

// Implement methods and extern functions.
let signal_trait = if include_binary {
quote! { rinf::DartSignalBinary<#name> }
quote! { rinf::DartSignalBinary }
} else {
quote! { rinf::DartSignal<#name> }
quote! { rinf::DartSignal }
};
let expanded = quote! {
impl #signal_trait for #name #where_clause {
Expand Down
Loading