ESPHome 2026.4.0-dev
Loading...
Searching...
No Matches
esphome::Callback< void(Ts...)> Struct Template Reference

#include <helpers.h>

Public Member Functions

void call (Ts... args) const
 Invoke the callback. Only valid on Callbacks created via create(), never on default-constructed instances.
 

Static Public Member Functions

template<typename F >
static Callback create (F &&callable)
 Create from any callable.
 

Data Fields

void(* fn_ )(void *, Ts...)
 
void * ctx_ {nullptr}
 

Detailed Description

template<typename... Ts>
struct esphome::Callback< void(Ts...)>

Definition at line 1763 of file helpers.h.

Member Function Documentation

◆ call()

template<typename... Ts>
void esphome::Callback< void(Ts...)>::call ( Ts... args) const
inline

Invoke the callback. Only valid on Callbacks created via create(), never on default-constructed instances.

Definition at line 1773 of file helpers.h.

◆ create()

template<typename... Ts>
template<typename F >
static Callback esphome::Callback< void(Ts...)>::create ( F && callable)
inlinestatic

Create from any callable.

Small trivially-copyable callables (like [this] lambdas) are stored inline in the ctx pointer without heap allocation.

Definition at line 1777 of file helpers.h.

Field Documentation

◆ ctx_

template<typename... Ts>
void* esphome::Callback< void(Ts...)>::ctx_ {nullptr}

Definition at line 1770 of file helpers.h.

◆ fn_

template<typename... Ts>
void(* esphome::Callback< void(Ts...)>::fn_) (void *, Ts...)
inline

Definition at line 1769 of file helpers.h.


The documentation for this struct was generated from the following file: