return a slice for RXingResultPoints

This commit is contained in:
Henry Schimke
2023-01-11 16:06:35 -06:00
parent fde23934f6
commit 7ddeb49064
7 changed files with 8 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ impl DetectorRXingResult for AztecDetectorRXingResult {
&self.bits
}
fn getPoints(&self) -> &Vec<RXingResultPoint> {
fn getPoints(&self) -> &[RXingResultPoint] {
&self.points
}
}

View File

@@ -54,7 +54,7 @@ pub use bit_array::*;
pub trait DetectorRXingResult {
fn getBits(&self) -> &BitMatrix;
fn getPoints(&self) -> &Vec<RXingResultPoint>;
fn getPoints(&self) -> &[RXingResultPoint];
}
// pub struct DetectorRXingResult {

View File

@@ -78,7 +78,7 @@ impl Reader for DataMatrixReader {
} else {
let detectorRXingResult = Detector::new(image.getBlackMatrix())?.detect()?;
decoderRXingResult = DECODER.decode(detectorRXingResult.getBits())?;
points = detectorRXingResult.getPoints().clone();
points = detectorRXingResult.getPoints().to_vec();
}
let mut result = RXingResult::new(
decoderRXingResult.getText(),

View File

@@ -16,7 +16,7 @@ impl DetectorRXingResult for DatamatrixDetectorResult {
&self.0
}
fn getPoints(&self) -> &Vec<RXingResultPoint> {
fn getPoints(&self) -> &[RXingResultPoint] {
&self.1
}
}

View File

@@ -57,7 +57,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
detectorRXingResult.getBits(),
hints,
)?;
let mut points = detectorRXingResult.getPoints().clone();
let mut points = detectorRXingResult.getPoints().to_vec();
// If the code was mirrored: swap the bottom-left and the top-right points.
if let Some(other) = decoderRXingResult.getOther() {
if other.is::<QRCodeDecoderMetaData>() {
@@ -73,7 +73,7 @@ impl MultipleBarcodeReader for QRCodeMultiReader {
let mut result = RXingResult::new(
decoderRXingResult.getText(),
decoderRXingResult.getRawBytes().clone(),
points,
points.to_vec(),
BarcodeFormat::QR_CODE,
);
let byteSegments = decoderRXingResult.getByteSegments();

View File

@@ -22,7 +22,7 @@ impl DetectorRXingResult for QRCodeDetectorResult {
&self.bit_source
}
fn getPoints(&self) -> &Vec<crate::RXingResultPoint> {
fn getPoints(&self) -> &[crate::RXingResultPoint] {
&self.result_points
}
}

View File

@@ -71,7 +71,7 @@ impl Reader for QRCodeReader {
Detector::new(image.getBlackMatrix()).detect_with_hints(hints)?;
decoderRXingResult =
qrcode_decoder::decode_bitmatrix_with_hints(detectorRXingResult.getBits(), hints)?;
points = detectorRXingResult.getPoints().clone();
points = detectorRXingResult.getPoints().to_vec();
}
// If the code was mirrored: swap the bottom-left and the top-right points.