OptrisOptrisDocumentation

Documentation/OTC SDK/optris_sdk — Rust API referencev12.0

AttachmentSink

pub struct AttachmentSink<'a>

The collector an attachment provider adds files to.

Borrowed for the duration of the provider call and invalid after it returns, which is what 'a says. It is deliberately neither Send nor Sync; it holds a raw pointer, which already makes it so, and that is the behaviour wanted: sending one to another thread would let it outlive the call no matter what the lifetime says, because the receiving thread need not finish before the provider returns.

AttachmentSink — methods

pub fn add(&mut self, name: &str, mime: &str, data: &[u8], compress: bool) -> Result<()>

Add one file to the snapshot or recording being written.

The bytes are copied before this returns, so data need not outlive the call. mime empty is written as "application/octet-stream".

compress deflates the payload, which is the right default. Pass false for content that is already compressed (JPEG, ZIP), where it only costs time.

Errors

Returns Status::InvalidArgument for an empty or over-long name, or for a name or MIME type containing an interior NUL.