pub struct FieldResolver { /* private fields */ }Expand description
Resolves fixture field paths to language-specific accessor expressions.
Implementations§
Source§impl FieldResolver
impl FieldResolver
Sourcepub fn new(
fields: &HashMap<String, String>,
optional: &HashSet<String>,
result_fields: &HashSet<String>,
array_fields: &HashSet<String>,
method_calls: &HashSet<String>,
) -> Self
pub fn new( fields: &HashMap<String, String>, optional: &HashSet<String>, result_fields: &HashSet<String>, array_fields: &HashSet<String>, method_calls: &HashSet<String>, ) -> Self
Create a new resolver from the e2e config’s fields aliases,
fields_optional set, result_fields set, fields_array set,
and fields_method_calls set.
Sourcepub fn resolve<'a>(&'a self, fixture_field: &'a str) -> &'a str
pub fn resolve<'a>(&'a self, fixture_field: &'a str) -> &'a str
Resolve a fixture field path to the actual struct path. Falls back to the field itself if no alias exists.
Sourcepub fn is_optional(&self, field: &str) -> bool
pub fn is_optional(&self, field: &str) -> bool
Check if a resolved field path is optional.
Sourcepub fn has_alias(&self, fixture_field: &str) -> bool
pub fn has_alias(&self, fixture_field: &str) -> bool
Check if a fixture field has an explicit alias mapping.
Sourcepub fn is_valid_for_result(&self, fixture_field: &str) -> bool
pub fn is_valid_for_result(&self, fixture_field: &str) -> bool
Check whether a fixture field path is valid for the configured result type.
Sourcepub fn has_map_access(&self, fixture_field: &str) -> bool
pub fn has_map_access(&self, fixture_field: &str) -> bool
Check if a resolved field path contains a non-numeric map access.
Auto Trait Implementations§
impl Freeze for FieldResolver
impl RefUnwindSafe for FieldResolver
impl Send for FieldResolver
impl Sync for FieldResolver
impl Unpin for FieldResolver
impl UnsafeUnpin for FieldResolver
impl UnwindSafe for FieldResolver
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