pub struct Assets { /* private fields */ }images only.Expand description
Request-owned association of references and images. Unused images are not sent.
Implementations§
Source§impl Assets
impl Assets
Sourcepub fn attach(&mut self, image: Image) -> String
pub fn attach(&mut self, image: Image) -> String
Retain an image and return its stable reference. Reattaching clones is idempotent.
Sourcepub fn validate(
&self,
state: &State,
questions: &IndexMap<String, Question>,
) -> Result<()>
pub fn validate( &self, state: &State, questions: &IndexMap<String, Question>, ) -> Result<()>
Validate unknown references and repeated-use byte limits before I/O.
§Errors
Returns the same InvalidImage failures as Assets::references for
unknown handles, size/count overflow, or excessive repeated image use.
Sourcepub fn references<'a>(
&'a self,
state: &State,
questions: &IndexMap<String, Question>,
) -> Result<Vec<ImageReference<'a>>>
pub fn references<'a>( &'a self, state: &State, questions: &IndexMap<String, Question>, ) -> Result<Vec<ImageReference<'a>>>
Collect referenced images in first-use order, preserving repeated-use counts.
Object keys are scanned for Python 0.12 parity. The current hosted service does not replace references inside keys; a key is not an image placement.
§Errors
Returns InvalidImage for an unattached UUID-shaped image reference,
reference-count/size overflow, or more than 32 MiB counting every use.
Sourcepub fn validate_service_request(
&self,
state: &State,
questions: &IndexMap<String, Question>,
) -> Result<()>
pub fn validate_service_request( &self, state: &State, questions: &IndexMap<String, Question>, ) -> Result<()>
Apply TypeSafe’s documented 2026-10-17 preflight in addition to baseline limits.
Current service sides start at 280 px and object keys are never image placements. Processed image size and server decoding cannot be proved here.
§Errors
Propagates baseline reference/size errors and returns InvalidImage
for referenced images with a side below 280 px or references in object keys.