catcolab_document_types/v0/
path.rs1use serde::{Deserialize, Serialize};
2use tsify::Tsify;
3
4#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Tsify)]
5#[serde(tag = "tag", content = "content")]
6#[tsify(into_wasm_abi, from_wasm_abi)]
7pub enum Path<V, E> {
8 Id(V),
9 Seq(Vec<E>),
10}
11
12#[cfg(feature = "property-tests")]
14pub(crate) mod arbitrary {
15 use super::*;
16 use proptest::prelude::*;
17
18 pub fn arb_path<V: std::fmt::Debug + 'static, E: std::fmt::Debug + 'static>(
20 arb_v: impl Strategy<Value = V> + 'static,
21 arb_e: impl Strategy<Value = E> + 'static,
22 ) -> BoxedStrategy<Path<V, E>> {
23 prop_oneof![
24 arb_v.prop_map(Path::Id),
25 prop::collection::vec(arb_e, 0..3).prop_map(Path::Seq),
26 ]
27 .boxed()
28 }
29}