pub trait ImageStore: Send + Sync {
// Required methods
fn put_image(
&self,
print_id: PrintId,
event_id: EventId,
source_url: Option<String>,
content_type: String,
bytes: RawBytes,
) -> BoxFuture<'_, Result<ImageRecord, StoreError>>;
fn image(
&self,
image_id: ImageId,
) -> BoxFuture<'_, Result<ImageLookup, StoreError>>;
}Expand description
The images stored beside events.
Every method is asynchronous, the trait is dyn-compatible, and it is
shareable across threads, because its consumers hold it behind
Arc<dyn ImageStore>.
Required Methods§
Sourcefn put_image(
&self,
print_id: PrintId,
event_id: EventId,
source_url: Option<String>,
content_type: String,
bytes: RawBytes,
) -> BoxFuture<'_, Result<ImageRecord, StoreError>>
fn put_image( &self, print_id: PrintId, event_id: EventId, source_url: Option<String>, content_type: String, bytes: RawBytes, ) -> BoxFuture<'_, Result<ImageRecord, StoreError>>
Store one image’s bytes, minting its identifier.
Sourcefn image(
&self,
image_id: ImageId,
) -> BoxFuture<'_, Result<ImageLookup, StoreError>>
fn image( &self, image_id: ImageId, ) -> BoxFuture<'_, Result<ImageLookup, StoreError>>
Read one image by its identifier.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".