1extern crate alloc;
2
3use alloc::borrow::Cow;
4
5use crate::{FieldLocationHint, ScalarValue, ValueTypeHint};
6
7#[derive(Debug, Clone, PartialEq)]
9pub struct FieldEvidence<'de> {
10 pub name: Cow<'de, str>,
12 pub location: FieldLocationHint,
14 pub value_type: Option<ValueTypeHint>,
16 pub scalar_value: Option<ScalarValue<'de>>,
20}
21
22impl<'de> FieldEvidence<'de> {
23 pub fn new(
25 name: impl Into<Cow<'de, str>>,
26 location: FieldLocationHint,
27 value_type: Option<ValueTypeHint>,
28 ) -> Self {
29 Self {
30 name: name.into(),
31 location,
32 value_type,
33 scalar_value: None,
34 }
35 }
36
37 pub fn with_scalar_value(
39 name: impl Into<Cow<'de, str>>,
40 location: FieldLocationHint,
41 value_type: Option<ValueTypeHint>,
42 scalar_value: ScalarValue<'de>,
43 ) -> Self {
44 Self {
45 name: name.into(),
46 location,
47 value_type,
48 scalar_value: Some(scalar_value),
49 }
50 }
51}