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>>;
}
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 this system’s own event vocabulary.

Source

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

Retrieve the image a source URL names.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§