Skip to main content

VisionPort

Trait VisionPort 

Source
pub trait VisionPort: Send + Sync {
    // Required methods
    fn normalize(
        &self,
        body: RawBytes,
        content_type: Option<String>,
    ) -> BoxFuture<'_, Result<NormalizedAlert, VisionError>>;
    fn fetch_image(
        &self,
        source_url: String,
    ) -> BoxFuture<'_, Result<FetchedImage, VisionError>>;
    fn clear_detection(
        &self,
        detection: Detection,
    ) -> BoxFuture<'_, Result<(), VisionError>>;
}
Expand description

The port external observations arrive through.

Every method is asynchronous, the trait is dyn-compatible, and it is shareable across threads, because the supervision core holds it behind Arc<dyn VisionPort>.

Required Methods§

Source

fn normalize( &self, body: RawBytes, content_type: Option<String>, ) -> BoxFuture<'_, Result<NormalizedAlert, VisionError>>

Read a received body into an event under this adapter’s own kind.

Source

fn fetch_image( &self, source_url: String, ) -> BoxFuture<'_, Result<FetchedImage, VisionError>>

Retrieve the image a source URL names.

Source

fn clear_detection( &self, detection: Detection, ) -> BoxFuture<'_, Result<(), VisionError>>

Tell the provider one of its detections has been handled.

A detector that paused a print and was never told the pause was dealt with may stay silent about that print for the rest of it; this is what re-arms it once the print has been adjusted and resumed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§