pub trait Push: Send + Sync {
// Required methods
fn register(
&self,
) -> impl Future<Output = Result<PushToken, PlatformError>> + Send;
fn handle_notification(
&self,
payload: &[u8],
) -> impl Future<Output = Result<WakeSignal, PlatformError>> + Send;
}Expand description
Push notification trait.
Abstracts platform-specific push notification registration and handling (APNs, FCM). The testing implementation returns synthetic tokens and passes payloads through as wake signals. See ADR-006.
Required Methods§
Sourcefn register(
&self,
) -> impl Future<Output = Result<PushToken, PlatformError>> + Send
fn register( &self, ) -> impl Future<Output = Result<PushToken, PlatformError>> + Send
Register for push notifications and return a platform-specific token.
§Errors
Returns PlatformError::PushError if registration fails.
Sourcefn handle_notification(
&self,
payload: &[u8],
) -> impl Future<Output = Result<WakeSignal, PlatformError>> + Send
fn handle_notification( &self, payload: &[u8], ) -> impl Future<Output = Result<WakeSignal, PlatformError>> + Send
Handle an incoming push notification payload and produce a wake signal.
§Errors
Returns PlatformError::PushError if the payload cannot be processed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.