Trait zircon_object::object::KernelObject [−][src]
Common interface of a kernel object.
Implemented by impl_kobject macro.
Required methods
fn id(&self) -> KoID[src]
Get object’s KoID.
fn type_name(&self) -> &str[src]
Get the name of the type of the kernel object.
fn name(&self) -> String[src]
Get object’s name.
fn set_name(&self, name: &str)[src]
Set object’s name.
fn signal(&self) -> Signal[src]
Get the signal status.
fn signal_set(&self, signal: Signal)[src]
Assert signal.
fn signal_clear(&self, signal: Signal)[src]
Deassert signal.
fn signal_change(&self, clear: Signal, set: Signal)[src]
Change signal status: first clear then set indicated bits.
All signal callbacks will be called.
fn add_signal_callback(&self, callback: SignalHandler)[src]
Add callback for signal status changes.
The callback is a function of Fn(Signal) -> bool.
It returns a bool indicating whether the handle process is over.
If true, the function will never be called again.
Provided methods
fn get_child(&self, _id: KoID) -> ZxResult<Arc<dyn KernelObject>>[src]
Attempt to find a child of the object with given KoID.
If the object is a Process, the Threads it contains may be obtained.
If the object is a Job, its (immediate) child Jobs and the Processes it contains may be obtained.
If the object is a Resource, its (immediate) child Resources may be obtained.
fn peer(&self) -> ZxResult<Arc<dyn KernelObject>>[src]
Attempt to get the object’s peer.
An object peer is the opposite endpoint of a Channel, Socket, Fifo, or EventPair.
fn related_koid(&self) -> KoID[src]
If the object is related to another (such as the other end of a channel, or the parent of a job), returns the KoID of that object, otherwise returns zero.
fn allowed_signals(&self) -> Signal[src]
Get object’s allowed signals.
Implementations
impl dyn KernelObject[src]
pub fn is<__T: KernelObject>(&self) -> bool[src]
Returns true if the trait object wraps an object of type __T.
pub fn downcast<__T: KernelObject>(
self: Box<Self>
) -> Result<Box<__T>, Box<Self>>[src]
self: Box<Self>
) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T. Returns the original boxed trait if it isn’t.
pub fn downcast_rc<__T: KernelObject>(
self: Rc<Self>
) -> Result<Rc<__T>, Rc<Self>>[src]
self: Rc<Self>
) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of
type __T. Returns the original Rc-ed trait if it isn’t.
pub fn downcast_ref<__T: KernelObject>(&self) -> Option<&__T>[src]
Returns a reference to the object within the trait object if it is of type __T, or
None if it isn’t.
pub fn downcast_mut<__T: KernelObject>(&mut self) -> Option<&mut __T>[src]
Returns a mutable reference to the object within the trait object if it is of type
__T, or None if it isn’t.
pub fn downcast_arc<__T: KernelObject>(
self: Arc<Self>
) -> Result<Arc<__T>, Arc<Self>> where
__T: Any + Send + Sync, [src]
self: Arc<Self>
) -> Result<Arc<__T>, Arc<Self>> where
__T: Any + Send + Sync,
Returns an Arc-ed object from an Arc-ed trait object if the underlying object is of
type __T. Returns the original Arc-ed trait if it isn’t.
impl dyn KernelObject[src]
pub fn wait_signal(
self: &Arc<Self>,
signal: Signal
) -> impl Future<Output = Signal>[src]
self: &Arc<Self>,
signal: Signal
) -> impl Future<Output = Signal>
Asynchronous wait for one of signal.
pub fn send_signal_to_port_async(
self: &Arc<Self>,
signal: Signal,
port: &Arc<Port>,
key: u64
)[src]
self: &Arc<Self>,
signal: Signal,
port: &Arc<Port>,
key: u64
)
Once one of the signal asserted, push a packet with key into the port,
It’s used to implement sys_object_wait_async.