Skip to content

Tracking Issue for waker_fn #149580

@tisonkun

Description

@tisonkun

Feature gate: #![feature(waker_fn)]

This is a tracking issue for rust-lang/libs-team#702.

Public API

pub fn waker_fn<F: Fn() + Send + Sync + 'static>(f: F) -> Waker {
  Waker::from(Arc::new(WakeFn(f)))
}

struct WakeFn<F> {
  f: F,
}

impl<F> Wake for WakeFn<F>
  where F: Fn()
{
  fn wake(self: Arc<Self>) { (self.f)() }
  fn wake_by_ref(self: &Arc<Self>) { (self.f)() }
}

Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions