pub enum LocationQueryResult<'m> {
Segment(&'m Segment<'m>),
Field(&'m Field<'m>),
Repeat(&'m Repeat<'m>),
Component(&'m Component<'m>),
Subcomponent(&'m Subcomponent<'m>),
}
Expand description
A result of a location query. This can be a segment, field, repeat, component, or subcomponent. The result contains a reference to the corresponding part of the message. The result can be used to get the raw value of the part of the message, or to display the value using the separators to decode escape sequences.
Variants§
Segment(&'m Segment<'m>)
Field(&'m Field<'m>)
Repeat(&'m Repeat<'m>)
Component(&'m Component<'m>)
Subcomponent(&'m Subcomponent<'m>)
Implementations§
Source§impl<'m> LocationQueryResult<'m>
impl<'m> LocationQueryResult<'m>
Sourcepub fn raw_value(&self) -> &'m str
pub fn raw_value(&self) -> &'m str
Get the raw value of the result. This is the value as it appears in the message, without any decoding of escape sequences. Segments will be separated by the segment separator character. Fields will be separated by the field separator character. Repeats will be separated by the repeat separator character. Components will be separated by the component separator character. Subcomponents will be separated by the subcomponent separator character.
Sourcepub fn range(&self) -> Range<usize>
pub fn range(&self) -> Range<usize>
Get the range of the result within the message. This is the character range of the result within the message, including the separators.
Sourcepub fn display(
&self,
separators: &'m Separators,
) -> LocationQueryResultDisplay<'m>
pub fn display( &self, separators: &'m Separators, ) -> LocationQueryResultDisplay<'m>
Display the result, using the separators to decode escape sequences
by default. Note: if you want to display the raw value without decoding escape
sequences, use the #
flag, e.g. format!("{:#}", result.display(separators))
.
Trait Implementations§
Source§impl<'m> Clone for LocationQueryResult<'m>
impl<'m> Clone for LocationQueryResult<'m>
Source§fn clone(&self) -> LocationQueryResult<'m>
fn clone(&self) -> LocationQueryResult<'m>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more