pub struct Handler<T> { /* private fields */ }Expand description
Heap-allocated, reference-counted holder for a callback the C client keeps and fires later, possibly many times, from the conductor thread.
C is handed a pointer to the value (Handler::as_raw), so the value must outlive
C’s use of it. Methods that register a retained callback store a clone in the
client’s dependencies: a close is asynchronous, and the conductor may still fire
the callback after the resource’s handle has dropped. The clones therefore live
until the client drops, one small Arc per registration.
For callbacks C fires only during the call, prefer the *_fn / *_once methods:
the closure stays on the stack, may borrow local state, and allocates nothing.
Send when T is; Sync only under the multi-threaded feature, since callbacks
fire on the conductor thread.
use rusteron_code_gen::Handler;
let handler = Handler::new(your_value);
// the value is freed when the last clone of `handler` goes out of scopeImplementations§
Source§impl<T: AeronFragmentHandlerCallback + 'static> Handler<T>
impl<T: AeronFragmentHandlerCallback + 'static> Handler<T>
Sourcepub fn with_fragment_assembler(
handler: T,
) -> Result<(Handler<AeronFragmentAssembler>, Handler<T>), AeronCError>
pub fn with_fragment_assembler( handler: T, ) -> Result<(Handler<AeronFragmentAssembler>, Handler<T>), AeronCError>
Wrap handler in a fragment assembler; both are reference-counted and freed
automatically when the last clones drop (the assembler keeps the delegate alive).
pub fn leak_with_fragment_assembler( handler: T, ) -> Result<(Handler<AeronFragmentAssembler>, Handler<T>), AeronCError>
use Handler::with_fragment_assembler
Source§impl<T: AeronControlledFragmentHandlerCallback + 'static> Handler<T>
impl<T: AeronControlledFragmentHandlerCallback + 'static> Handler<T>
Sourcepub fn with_controlled_fragment_assembler(
handler: T,
) -> Result<(Handler<AeronControlledFragmentAssembler>, Handler<T>), AeronCError>
pub fn with_controlled_fragment_assembler( handler: T, ) -> Result<(Handler<AeronControlledFragmentAssembler>, Handler<T>), AeronCError>
Wrap handler in a controlled fragment assembler; both are reference-counted and
freed automatically when the last clones drop.
pub fn leak_with_controlled_fragment_assembler( handler: T, ) -> Result<(Handler<AeronControlledFragmentAssembler>, Handler<T>), AeronCError>
use Handler::with_controlled_fragment_assembler
Trait Implementations§
Source§impl<T: AeronAgentCloseFuncCallback> AeronAgentCloseFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronAgentCloseFuncCallback> AeronAgentCloseFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_agent_on_close_func(&mut self)
Source§impl<T: AeronAgentDoWorkFuncCallback> AeronAgentDoWorkFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronAgentDoWorkFuncCallback> AeronAgentDoWorkFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_agent_do_work_func(&mut self) -> c_int
Source§impl<T: AeronAgentStartFuncCallback> AeronAgentStartFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronAgentStartFuncCallback> AeronAgentStartFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_agent_on_start_func(&mut self, role_name: &str)
Source§impl<T: AeronAvailableCounterCallback> AeronAvailableCounterCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronAvailableCounterCallback> AeronAvailableCounterCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_on_available_counter( &mut self, counters_reader: AeronCountersReader, registration_id: i64, counter_id: i32, )
Source§impl<T: AeronAvailableImageCallback> AeronAvailableImageCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronAvailableImageCallback> AeronAvailableImageCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_on_available_image( &mut self, subscription: AeronSubscription, image: AeronImage, )
Source§impl<T: AeronBlockHandlerCallback> AeronBlockHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronBlockHandlerCallback> AeronBlockHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronCloseClientCallback> AeronCloseClientCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronCloseClientCallback> AeronCloseClientCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_on_close_client(&mut self)
Source§impl<T: AeronControlledFragmentHandlerCallback> AeronControlledFragmentHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronControlledFragmentHandlerCallback> AeronControlledFragmentHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_controlled_fragment_handler( &mut self, buffer: &[u8], header: AeronHeader, ) -> aeron_controlled_fragment_handler_action_t
Source§impl<T: AeronCountersReaderForeachCounterFuncCallback> AeronCountersReaderForeachCounterFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronCountersReaderForeachCounterFuncCallback> AeronCountersReaderForeachCounterFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronErrorHandlerCallback> AeronErrorHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronErrorHandlerCallback> AeronErrorHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_error_handler(&mut self, errcode: c_int, message: &str)
Source§impl<T: AeronErrorLogReaderFuncCallback> AeronErrorLogReaderFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronErrorLogReaderFuncCallback> AeronErrorLogReaderFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronFprintfHandlerCallback> AeronFprintfHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronFprintfHandlerCallback> AeronFprintfHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronFragmentHandlerCallback> AeronFragmentHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronFragmentHandlerCallback> AeronFragmentHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_fragment_handler(&mut self, buffer: &[u8], header: AeronHeader)
Source§impl<T: AeronIdleStrategyFuncCallback> AeronIdleStrategyFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronIdleStrategyFuncCallback> AeronIdleStrategyFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_idle_strategy_func(&mut self, work_count: c_int)
Source§impl<T: AeronLossReporterReadEntryFuncCallback> AeronLossReporterReadEntryFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronLossReporterReadEntryFuncCallback> AeronLossReporterReadEntryFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronNewPublicationCallback> AeronNewPublicationCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronNewPublicationCallback> AeronNewPublicationCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronNewSubscriptionCallback> AeronNewSubscriptionCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronNewSubscriptionCallback> AeronNewSubscriptionCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronNotificationCallback> AeronNotificationCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronNotificationCallback> AeronNotificationCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_notification(&mut self)
Source§impl<T: AeronPublicationErrorFrameHandlerCallback> AeronPublicationErrorFrameHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronPublicationErrorFrameHandlerCallback> AeronPublicationErrorFrameHandlerCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_publication_error_frame_handler( &mut self, error_frame: AeronPublicationErrorValues, )
Source§impl<T: AeronReservedValueSupplierCallback> AeronReservedValueSupplierCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronReservedValueSupplierCallback> AeronReservedValueSupplierCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
fn handle_aeron_reserved_value_supplier(&mut self, buffer: &mut [u8]) -> i64
Source§impl<T: AeronStrToPtrHashMapForEachFuncCallback> AeronStrToPtrHashMapForEachFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronStrToPtrHashMapForEachFuncCallback> AeronStrToPtrHashMapForEachFuncCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
Source§impl<T: AeronUriParseCallbackCallback> AeronUriParseCallbackCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.
impl<T: AeronUriParseCallbackCallback> AeronUriParseCallbackCallback for Handler<T>
Pass an existing Handler clone anywhere a callback value is expected, e.g.
to share one callback instance across several registrations.