Rename (Posix)ThreadExt to As(Posix)Thread

This commit is contained in:
Ruihan Li
2024-11-12 09:53:01 +08:00
committed by Tate, Hongliang Tian
parent 9233d1cdbb
commit e6c613f538
19 changed files with 30 additions and 30 deletions

View File

@ -162,13 +162,13 @@ impl Thread {
}
}
/// An extension trait for [`Thread`]-like types.
pub trait ThreadExt {
/// A trait to provide the `as_thread` method for tasks.
pub trait AsThread {
/// Returns the associated [`Thread`].
fn as_thread(&self) -> Option<&Arc<Thread>>;
}
impl ThreadExt for Task {
impl AsThread for Task {
fn as_thread(&self) -> Option<&Arc<Thread>> {
self.data().downcast_ref::<Arc<Thread>>()
}