File: rust_backend.md

package info (click to toggle)
python-watchfiles 0.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: python: 1,973; makefile: 91
file content (35 lines) | stat: -rw-r--r-- 902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
::: watchfiles._rust_notify.RustNotify

::: watchfiles._rust_notify.WatchfilesRustInternalError

::: watchfiles._rust_notify.__version__

# Rust backend direct usage

The rust backend can be accessed directly as follows:

```py
title="Rust backend example"
from watchfiles._rust_notify import RustNotify

r = RustNotify(['first/path', 'second/path'], False, False, 0, True, False)

changes = r.watch(1_600, 50, 100, None)
print(changes)

r.close()
```

Or using `RustNotify` as a context manager:

```py
title="Rust backend context manager example"
from watchfiles._rust_notify import RustNotify

with RustNotify(['first/path', 'second/path'], False, False, 0, True, False) as r:
    changes = r.watch(1_600, 50, 100, None)
    print(changes)
```

(See the documentation on [`close`][watchfiles._rust_notify.RustNotify.close] above for when and why the
context manager or `close` method are required.)