1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Decode data extracted from an image
pub use ;
/// Decode extracted data into a resulting String
///
/// DATA type must equal the output type of the matching [`Extract`] implementation
///
/// For convenience and easy pipelining the input for decode is the [`Result`] returned from the extract method.
/// Implementors should return any Error passed to the decode function as-is.
///
/// Pre-implemented Decodes provided by this library that are included in the default [`Decoder`]:
/// * [`QRDecoder`]
///
/// # Example
/// ```
/// # extern crate bardecoder;
/// # use bardecoder::util::qr::{QRData, QRError};
/// use bardecoder::decode::Decode;
///
/// struct MyDecoder {}
///
/// impl Decode<QRData, String, QRError> for MyDecoder {
/// fn decode(&self, data: Result<QRData, QRError>) -> Result<String, QRError> {
/// // process data here
/// # Ok(String::from("ok!"))
/// }
/// }
/// ```
///
/// with the corresponding impl Extract being the Example [`here`]
///
/// [`Extract`]: ../extract/trait.Extract.html
/// [`here`]: ../extract/trait.Extract.html
/// [`Decoder`]: ../struct.Decoder.html