pub struct EventChannelObject {
name: String,
subscriptions: Mutex<HashMap<String, Arc<EventSubscriptionObject>>>,
manager_ref: &'static EventManager,
}Expand description
EventChannel implementation for KernelObject integration
Fields§
§name: String§subscriptions: Mutex<HashMap<String, Arc<EventSubscriptionObject>>>Channel manages its own subscriptions as EventSubscriptionObjects
manager_ref: &'static EventManagerImplementations§
Source§impl EventChannelObject
impl EventChannelObject
pub fn new(name: String) -> Self
pub fn name(&self) -> &str
Sourcepub fn create_subscription(
&self,
task_id: u32,
) -> Result<Arc<EventSubscriptionObject>, EventError>
pub fn create_subscription( &self, task_id: u32, ) -> Result<Arc<EventSubscriptionObject>, EventError>
Create a new subscription for this channel
Sourcepub fn remove_subscription(
&self,
subscription_id: &str,
) -> Result<(), EventError>
pub fn remove_subscription( &self, subscription_id: &str, ) -> Result<(), EventError>
Remove a subscription from this channel
Sourcepub fn get_subscriptions(&self) -> Vec<Arc<EventSubscriptionObject>>
pub fn get_subscriptions(&self) -> Vec<Arc<EventSubscriptionObject>>
Get all subscriptions for this channel
Sourcepub fn get_subscribers(&self) -> Vec<u32>
pub fn get_subscribers(&self) -> Vec<u32>
Get list of current subscriber task IDs
Sourcepub fn broadcast_to_subscribers(&self, event: Event) -> Result<(), EventError>
pub fn broadcast_to_subscribers(&self, event: Event) -> Result<(), EventError>
Send event to all subscribers of this channel
Sourcepub fn subscribe(
&self,
task_id: u32,
) -> Result<Arc<EventSubscriptionObject>, EventError>
pub fn subscribe( &self, task_id: u32, ) -> Result<Arc<EventSubscriptionObject>, EventError>
Subscribe a task to this channel (legacy method for backward compatibility)
Sourcepub fn unsubscribe(&self, task_id: u32) -> Result<(), EventError>
pub fn unsubscribe(&self, task_id: u32) -> Result<(), EventError>
Unsubscribe a task from this channel (legacy method for backward compatibility)
Sourcepub fn get_subscription_by_id(
&self,
subscription_id: &str,
) -> Option<Arc<EventSubscriptionObject>>
pub fn get_subscription_by_id( &self, subscription_id: &str, ) -> Option<Arc<EventSubscriptionObject>>
Get a subscription by its ID
Trait Implementations§
Source§impl CloneOps for EventChannelObject
impl CloneOps for EventChannelObject
Source§fn custom_clone(&self) -> KernelObject
fn custom_clone(&self) -> KernelObject
Perform a custom clone operation and return the cloned object Read more
Source§impl EventReceiver for EventChannelObject
impl EventReceiver for EventChannelObject
Source§fn has_pending_events(&self) -> bool
fn has_pending_events(&self) -> bool
Check if events are pending Read more
Source§impl EventSender for EventChannelObject
impl EventSender for EventChannelObject
Source§fn send_event(&self, event: Event) -> Result<(), &'static str>
fn send_event(&self, event: Event) -> Result<(), &'static str>
Send an event Read more