EventChannelObject

Struct EventChannelObject 

Source
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 EventManager

Implementations§

Source§

impl EventChannelObject

Source

pub fn new(name: String) -> Self

Source

pub fn name(&self) -> &str

Source

pub fn create_subscription( &self, task_id: u32, ) -> Result<Arc<EventSubscriptionObject>, EventError>

Create a new subscription for this channel

Source

pub fn remove_subscription( &self, subscription_id: &str, ) -> Result<(), EventError>

Remove a subscription from this channel

Source

pub fn get_subscriptions(&self) -> Vec<Arc<EventSubscriptionObject>>

Get all subscriptions for this channel

Source

pub fn get_subscribers(&self) -> Vec<u32>

Get list of current subscriber task IDs

Source

pub fn broadcast_to_subscribers(&self, event: Event) -> Result<(), EventError>

Send event to all subscribers of this channel

Source

pub fn subscribe( &self, task_id: u32, ) -> Result<Arc<EventSubscriptionObject>, EventError>

Subscribe a task to this channel (legacy method for backward compatibility)

Source

pub fn unsubscribe(&self, task_id: u32) -> Result<(), EventError>

Unsubscribe a task from this channel (legacy method for backward compatibility)

Source

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

Source§

fn custom_clone(&self) -> KernelObject

Perform a custom clone operation and return the cloned object Read more
Source§

impl EventReceiver for EventChannelObject

Source§

fn has_pending_events(&self) -> bool

Check if events are pending Read more
Source§

impl EventSender for EventChannelObject

Source§

fn send_event(&self, event: Event) -> Result<(), &'static str>

Send an event Read more

Auto Trait Implementations§

§

impl !Freeze for EventChannelObject

§

impl !RefUnwindSafe for EventChannelObject

§

impl Send for EventChannelObject

§

impl Sync for EventChannelObject

§

impl Unpin for EventChannelObject

§

impl !UnwindSafe for EventChannelObject

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.