diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-09-12 00:10:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 00:10:43 +0200 |
commit | bdeb4bddbf5cabd04abe906388f5ebfe64a84c53 (patch) | |
tree | fd6aed583eac5108c4403ae424bc4246781bed0c /runtime/ops/fs_events.rs | |
parent | aaff69db3fd8cf70d1c031720e84874cb4a4d02c (diff) |
refactor: rewrite runtime/ ops to op2 (#20459)
Diffstat (limited to 'runtime/ops/fs_events.rs')
-rw-r--r-- | runtime/ops/fs_events.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index 2668431eb..2d46f73ff 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -11,7 +11,7 @@ use deno_core::RcRef; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::op; +use deno_core::op2; use notify::event::Event as NotifyEvent; use notify::Error as NotifyError; @@ -92,10 +92,11 @@ pub struct OpenArgs { paths: Vec<String>, } -#[op] +#[op2] +#[smi] fn op_fs_events_open( state: &mut OpState, - args: OpenArgs, + #[serde] args: OpenArgs, ) -> Result<ResourceId, AnyError> { let (sender, receiver) = mpsc::channel::<Result<FsEvent, AnyError>>(16); let sender = Mutex::new(sender); @@ -130,10 +131,11 @@ fn op_fs_events_open( Ok(rid) } -#[op] +#[op2(async)] +#[serde] async fn op_fs_events_poll( state: Rc<RefCell<OpState>>, - rid: ResourceId, + #[smi] rid: ResourceId, ) -> Result<Option<FsEvent>, AnyError> { let resource = state.borrow().resource_table.get::<FsEventsResource>(rid)?; let mut receiver = RcRef::map(&resource, |r| &r.receiver).borrow_mut().await; |