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>>;
// Provided method
fn judge_frame(
&self,
image: FetchedImage,
) -> BoxFuture<'_, Result<FetchedImage, FrameFault>> { ... }
}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§
Sourcefn normalize(
&self,
body: RawBytes,
content_type: Option<String>,
) -> BoxFuture<'_, Result<NormalizedAlert, VisionError>>
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.
Sourcefn fetch_image(
&self,
source_url: String,
) -> BoxFuture<'_, Result<FetchedImage, VisionError>>
fn fetch_image( &self, source_url: String, ) -> BoxFuture<'_, Result<FetchedImage, VisionError>>
Retrieve the image a source URL names.
Sourcefn clear_detection(
&self,
detection: Detection,
) -> BoxFuture<'_, Result<(), VisionError>>
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.
Provided Methods§
Sourcefn judge_frame(
&self,
image: FetchedImage,
) -> BoxFuture<'_, Result<FetchedImage, FrameFault>>
fn judge_frame( &self, image: FetchedImage, ) -> BoxFuture<'_, Result<FetchedImage, FrameFault>>
Judge one retrieved frame as a picture of the print, answering it back when it is one and why not otherwise.
An implementation that does not judge frames answers every one back, which is what one that does not override this does.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".