Trait FieldSelector

Source
pub trait FieldSelector {
    // Required methods
    fn new() -> Self;
    fn enable_dot_hierarchy(&mut self, field: &str);
    fn enable(&mut self, field_hierarchy: &[&str]);
}
Expand description

Helper trait for field selectors to provide common functionality.

This trait is automatically implemented for all generated field selectors.

Required Methods§

Source

fn new() -> Self

Create a new selector with all fields disabled.

Source

fn enable_dot_hierarchy(&mut self, field: &str)

Enable a field using dot notation.

§Examples
selector.enable_dot_hierarchy("name");           // Simple field
selector.enable_dot_hierarchy("profile.bio");    // Nested field
selector.enable_dot_hierarchy("posts.title");    // Field in collection
Source

fn enable(&mut self, field_hierarchy: &[&str])

Enable a field using a slice of field names.

This is useful when you already have the field path split.

§Examples
selector.enable(&["name"]);                  // Simple field
selector.enable(&["profile", "bio"]);       // Nested field

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§