Skip to main content

FromScannerResult

Trait FromScannerResult 

Source
pub trait FromScannerResult: Sized {
    const MARKERS: &[&[u8]] = _;

    // Required method
    fn from_scanner_result(result: &ScannerResult<'_>) -> Option<Self>;

    // Provided method
    fn from_attribute<'p>(value: &Property<'p, 'p>) -> Option<Self> { ... }
}
Expand description

Type that can recognize itself from a ScannerResult node.

Returning None means “this node is not of the implementing type,” which is an expected outcome rather than an error.

Provided Associated Constants§

Source

const MARKERS: &[&[u8]] = _

Byte markers used to reject impossible payloads before plist parsing.

When non-empty, from_attribute parses the payload only if it contains at least one of these byte sequences. This skips deserializing results from the shared __kIMDataDetectedAttributeName attribute that cannot be Self, since that attribute carries every data-detector type. Types parsed from a dedicated attribute leave this empty (the default).

Required Methods§

Source

fn from_scanner_result(result: &ScannerResult<'_>) -> Option<Self>

Parse Self from a scanner-result node, or return None on mismatch.

Provided Methods§

Source

fn from_attribute<'p>(value: &Property<'p, 'p>) -> Option<Self>

Parse Self from a typedstream attribute carrying a DDScannerResult archive (NSData or NSMutableData).

Returns None when the value is not data, fails the MARKERS pre-filter, is not a valid archive, or does not represent a Self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§