mirror of
https://github.com/encounter/notify.git
synced 2026-07-10 12:18:48 -07:00
Add serialization-compat-6 feature
This commit is contained in:
@@ -4,6 +4,13 @@ v5 maintenance branch is on `v5_maintenance` after `5.2.0`
|
||||
|
||||
v4 commits split out to branch `v4_maintenance` starting with `4.0.16`
|
||||
|
||||
## notify-types 1.0.0
|
||||
|
||||
New crate containing public type definitions for the notify and debouncer crates.
|
||||
|
||||
- CHANGE: the serialization format for events has been changed to be easier to use in environments like JavaScript;
|
||||
the old behavior can be restored using the new feature flag `serialization-compat-6`
|
||||
|
||||
## debouncer-full 0.4.0
|
||||
|
||||
- CHANGE: Manage root folder paths for the file ID cache automatically. **breaking**
|
||||
|
||||
@@ -24,6 +24,7 @@ serde = ["notify-types/serde"]
|
||||
mock_instant = ["dep:mock_instant","notify-types/mock_instant"]
|
||||
# can't use dep:crossbeam-channel and feature name crossbeam-channel below rust 1.60
|
||||
crossbeam = ["crossbeam-channel","notify/crossbeam-channel"]
|
||||
serialization-compat-6 = ["notify/serialization-compat-6"]
|
||||
macos_fsevent = ["notify/macos_fsevent"]
|
||||
macos_kqueue = ["notify/macos_kqueue"]
|
||||
|
||||
|
||||
@@ -36,5 +36,7 @@ A debouncer for [notify] that is optimized for ease of use.
|
||||
notify-debouncer-full = { version = "*", default-features = false, features = ["macos_kqueue"] }
|
||||
```
|
||||
|
||||
- `serialization-compat-6` passed down to notify, off by default
|
||||
|
||||
[docs]: https://docs.rs/notify-debouncer-full
|
||||
[notify]: https://crates.io/crates/notify
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
//! - `crossbeam` enabled by default, adds [`DebounceEventHandler`](DebounceEventHandler) support for crossbeam channels.
|
||||
//! Also enables crossbeam-channel in the re-exported notify. You may want to disable this when using the tokio async runtime.
|
||||
//! - `serde` enables serde support for events.
|
||||
//! - `serialization-compat-6` passed down to notify, off by default
|
||||
//!
|
||||
//! # Caveats
|
||||
//!
|
||||
|
||||
@@ -23,6 +23,7 @@ default = ["crossbeam","macos_fsevent"]
|
||||
serde = ["notify-types/serde"]
|
||||
# can't use dep:crossbeam-channel and feature name crossbeam-channel below rust 1.60
|
||||
crossbeam = ["crossbeam-channel","notify/crossbeam-channel"]
|
||||
serialization-compat-6 = ["notify/serialization-compat-6"]
|
||||
macos_fsevent = ["notify/macos_fsevent"]
|
||||
macos_kqueue = ["notify/macos_kqueue"]
|
||||
|
||||
|
||||
@@ -29,5 +29,7 @@ Tiny debouncer for [notify]. Filters incoming events and emits only one event pe
|
||||
```
|
||||
- `serde` for serde support of event types, off by default
|
||||
|
||||
- `serialization-compat-6` passed down to notify, off by default
|
||||
|
||||
[docs]: https://docs.rs/notify-debouncer-mini
|
||||
[notify]: https://crates.io/crates/notify
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
//! - `crossbeam` enabled by default, adds [`DebounceEventHandler`](DebounceEventHandler) support for crossbeam channels.
|
||||
//! Also enables crossbeam-channel in the re-exported notify. You may want to disable this when using the tokio async runtime.
|
||||
//! - `serde` enables serde support for events.
|
||||
//! - `serialization-compat-6` passed down to notify, off by default
|
||||
//!
|
||||
//! # Caveats
|
||||
//!
|
||||
|
||||
@@ -14,6 +14,9 @@ authors = ["Daniel Faust <hessijames@gmail.com>"]
|
||||
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
serialization-compat-6 = []
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.89", features = ["derive"], optional = true }
|
||||
mock_instant = { version = "0.3.0", optional = true }
|
||||
|
||||
@@ -195,7 +195,7 @@ pub enum RemoveKind {
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
|
||||
#[cfg_attr(feature = "serde", serde(tag = "type"))]
|
||||
#[cfg_attr(all(feature = "serde", not(feature = "serialization-compat-6")), serde(tag = "type"))]
|
||||
pub enum EventKind {
|
||||
/// The catch-all event kind, for unsupported/unknown events.
|
||||
///
|
||||
@@ -300,7 +300,7 @@ pub struct Event {
|
||||
/// The `EventKind::Any` variant should be used as the "else" case when mapping native kernel
|
||||
/// bitmasks or bitmaps, such that if the mask is ever extended with new event types the
|
||||
/// backend will not gain bugs due to not matching new unknown event types.
|
||||
#[cfg_attr(feature = "serde", serde(flatten))]
|
||||
#[cfg_attr(all(feature = "serde", not(feature = "serialization-compat-6")), serde(flatten))]
|
||||
pub kind: EventKind,
|
||||
|
||||
/// Paths the event is about, if known.
|
||||
@@ -478,7 +478,7 @@ impl EventAttributes {
|
||||
/// particular ways.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(all(feature = "serde", not(feature = "serialization-compat-6")), serde(rename_all = "camelCase"))]
|
||||
pub enum Flag {
|
||||
/// Rescan notices are emitted by some platforms (and may also be emitted by Notify itself).
|
||||
/// They indicate either a lapse in the events or a change in the filesystem such that events
|
||||
@@ -618,7 +618,7 @@ impl Hash for Event {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "serde"))]
|
||||
#[cfg(all(test, feature = "serde", not(feature = "serialization-compat-6")))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -57,3 +57,4 @@ timing_tests = []
|
||||
manual_tests = []
|
||||
macos_kqueue = ["kqueue", "mio"]
|
||||
macos_fsevent = ["fsevent-sys"]
|
||||
serialization-compat-6 = ["notify-types/serialization-compat-6"]
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
//! - `macos_fsevent` enabled by default, for fsevent backend on macos
|
||||
//! - `macos_kqueue` for kqueue backend on macos
|
||||
//! - `crossbeam-channel` enabled by default, see below
|
||||
//! - `serialization-compat-6` restores the serialization behavior of notify 6, off by default
|
||||
//!
|
||||
//! ### Serde
|
||||
//!
|
||||
|
||||
Reference in New Issue
Block a user