pub struct Subfeature<'a> {
pub after: usize,
pub fragment: Fragment<'a>,
}Expand description
Represents a “subfeature” of a symbolic location, such as a substring within a YAML string.
Fields§
§after: usizeA byte index after which the subfeature starts.
This is a fuzzy anchor: we know our subfeature starts somewhere after this index, but we don’t know exactly where it is in the original feature due to parsed whitespace.
fragment: Fragment<'a>The fragment of the subfeature.
Implementations§
Source§impl<'a> Subfeature<'a>
impl<'a> Subfeature<'a>
Sourcepub fn new(after: usize, fragment: impl Into<Fragment<'a>>) -> Self
pub fn new(after: usize, fragment: impl Into<Fragment<'a>>) -> Self
Create a new subfeature with the given after index and fragment.
Sourcepub fn locate_within(&self, feature: &str) -> Option<Span>
pub fn locate_within(&self, feature: &str) -> Option<Span>
Locate this subfeature within the given feature.
Returns the subfeature’s span within the feature, or None if it
can’t be found. The returned span is relative to the feature’s
start.
Trait Implementations§
Source§impl<'a> Clone for Subfeature<'a>
impl<'a> Clone for Subfeature<'a>
Source§fn clone(&self) -> Subfeature<'a>
fn clone(&self) -> Subfeature<'a>
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<'a> Debug for Subfeature<'a>
impl<'a> Debug for Subfeature<'a>
Auto Trait Implementations§
impl<'a> Freeze for Subfeature<'a>
impl<'a> RefUnwindSafe for Subfeature<'a>
impl<'a> Send for Subfeature<'a>
impl<'a> Sync for Subfeature<'a>
impl<'a> Unpin for Subfeature<'a>
impl<'a> UnwindSafe for Subfeature<'a>
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