pub struct ResponsePath { /* private fields */ }Expand description
A path to a response value, e.g., "address.street".
Used as keys in Responses to identify specific fields, including nested ones.
Paths are hierarchical, using dot notation for nested fields.
This is an internal type. Users interact with surveys through the
generated builder methods like suggest_name() or assume_address_street().
Implementations§
Source§impl ResponsePath
impl ResponsePath
Sourcepub fn new(path: impl Into<String>) -> ResponsePath
pub fn new(path: impl Into<String>) -> ResponsePath
Create a new path from a dot-separated string.
Sourcepub fn empty() -> ResponsePath
pub fn empty() -> ResponsePath
Create an empty path (used for top-level enums).
Sourcepub fn child(&self, name: &str) -> ResponsePath
pub fn child(&self, name: &str) -> ResponsePath
Append a child segment to this path, returning a new path.
Sourcepub fn segments(&self) -> impl Iterator<Item = &str>
pub fn segments(&self) -> impl Iterator<Item = &str>
Get the segments of this path as an iterator.
Sourcepub fn strip_prefix(&self, prefix: &str) -> Option<ResponsePath>
pub fn strip_prefix(&self, prefix: &str) -> Option<ResponsePath>
Returns a new path with the given prefix segment removed, if it matches.
Sourcepub fn strip_path_prefix(&self, prefix: &ResponsePath) -> Option<ResponsePath>
pub fn strip_path_prefix(&self, prefix: &ResponsePath) -> Option<ResponsePath>
Strip a ResponsePath prefix from this path.
Sourcepub fn parent(&self) -> ResponsePath
pub fn parent(&self) -> ResponsePath
Get the parent path by removing the last segment. Returns an empty path if this path has only one segment.
Trait Implementations§
Source§impl Clone for ResponsePath
impl Clone for ResponsePath
Source§fn clone(&self) -> ResponsePath
fn clone(&self) -> ResponsePath
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResponsePath
impl Debug for ResponsePath
Source§impl Display for ResponsePath
impl Display for ResponsePath
Source§impl From<&String> for ResponsePath
impl From<&String> for ResponsePath
Source§fn from(s: &String) -> ResponsePath
fn from(s: &String) -> ResponsePath
Converts to this type from the input type.
Source§impl From<&str> for ResponsePath
impl From<&str> for ResponsePath
Source§fn from(s: &str) -> ResponsePath
fn from(s: &str) -> ResponsePath
Converts to this type from the input type.
Source§impl From<String> for ResponsePath
impl From<String> for ResponsePath
Source§fn from(s: String) -> ResponsePath
fn from(s: String) -> ResponsePath
Converts to this type from the input type.
Source§impl Hash for ResponsePath
impl Hash for ResponsePath
Source§impl PartialEq for ResponsePath
impl PartialEq for ResponsePath
impl Eq for ResponsePath
impl StructuralPartialEq for ResponsePath
Auto Trait Implementations§
impl Freeze for ResponsePath
impl RefUnwindSafe for ResponsePath
impl Send for ResponsePath
impl Sync for ResponsePath
impl Unpin for ResponsePath
impl UnwindSafe for ResponsePath
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