Struct stringsext::finding::Finding [−][src]
pub struct Finding<'a> {
pub input_file_id: Option<u8>,
pub mission: &'static Mission,
pub position: u64,
pub position_precision: Precision,
pub s: &'a str,
pub s_completes_previous_s: bool,
}
Expand description
Finding
represents a valid result string decoded to UTF-8 with it’s
original location and its original encoding in the input stream.
Fields
input_file_id: Option<u8>
A label identifying the origin of the input data: If the origin of the data
is stdin
: None
, otherwise: Some(1)
for input coming from the first
file, Some(2)
for input from the second file, Some(3)
for …
mission: &'static Mission
Mission
associated with this finding. We need a reference to the
corresponding Mission
object here, in order to get additional information,
e.g. the label of the encoding, when we print this Finding
.
position: u64
The byte number position of this Finding
in the input stream.
position_precision: Precision
In some cases the position
can not be determined exactly. Therefor,
position_precision
indicates how well the finding is localized. In case
that the position is not exactly known, we indicate if the finding is
somewhere before or after position
.
s: &'a str
Whatever the original encoding was, the result string s
is always stored as
UTF-8. s
is a &str
pointing into FindingCollection::output_buffer
.
s_completes_previous_s: bool
This flag indicates that s
holds only the second part of a cut finding
from the previous scanner::scan()
run. This can happen when a finding from
the previous run has hit theinput_buffer
-boundary.
Implementations
Trait Implementations
Useful to compare findings for debugging or testing.
When itertools::kmerge()
merges FindingCollections
into an iterator over
Finding
s, it needs to compare Finding
s. Therefor, we must implement
PartialOrd
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more