#[non_exhaustive]pub struct DetectionCandidate {
pub field: String,
pub cardinality: usize,
}Expand description
One candidate field surfaced when auto-detection cannot pick a grouping field on its own.
Listed inside FaceError::AmbiguousDetection so callers can render
the §11.2 hint message.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.field: StringField path (e.g. data.path.text).
cardinality: usizeNumber of distinct values observed for this field.
Implementations§
Source§impl DetectionCandidate
impl DetectionCandidate
Sourcepub fn new(field: impl Into<String>, cardinality: usize) -> Self
pub fn new(field: impl Into<String>, cardinality: usize) -> Self
Construct a candidate from a field path and an observed distinct-value count.
DetectionCandidate is #[non_exhaustive]; downstream crates
(notably face-cli) build the candidate list when the CLI
falls back into FaceError::AmbiguousDetection, so this
constructor is the intended public entry point.
§Examples
use face_core::DetectionCandidate;
let c = DetectionCandidate::new("data.path.text", 47);
assert_eq!(c.field, "data.path.text");
assert_eq!(c.cardinality, 47);Trait Implementations§
Source§impl Clone for DetectionCandidate
impl Clone for DetectionCandidate
Source§fn clone(&self) -> DetectionCandidate
fn clone(&self) -> DetectionCandidate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DetectionCandidate
impl RefUnwindSafe for DetectionCandidate
impl Send for DetectionCandidate
impl Sync for DetectionCandidate
impl Unpin for DetectionCandidate
impl UnsafeUnpin for DetectionCandidate
impl UnwindSafe for DetectionCandidate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more