pub struct SourceRef {
pub uri: String,
pub mime_type: Option<String>,
pub size_bytes: Option<u64>,
pub checksum: Option<String>,
}Expand description
Reference to source content (URL, file path, S3 URI, etc.)
Used when an entity was extracted from multimedia content (images, audio, video, PDFs, web pages). The entity stores the extracted text/summary, while SourceRef points to the original content.
§Example
use umi_memory::storage::SourceRef;
// Image that was analyzed
let image_ref = SourceRef::new("file:///photos/meeting.jpg".to_string())
.with_mime_type("image/jpeg".to_string())
.with_size_bytes(1024 * 500);
// PDF that was extracted
let pdf_ref = SourceRef::new("s3://docs/report.pdf".to_string())
.with_mime_type("application/pdf".to_string())
.with_checksum("sha256:abc123...".to_string());Fields§
§uri: StringURI to the source (file://, https://, s3://, etc.)
mime_type: Option<String>MIME type of the source (image/png, audio/mp3, application/pdf, etc.)
size_bytes: Option<u64>Size in bytes (if known)
checksum: Option<String>Checksum for integrity verification (e.g., “sha256:abc123…”)
Implementations§
Source§impl SourceRef
impl SourceRef
Sourcepub fn with_mime_type(self, mime_type: String) -> Self
pub fn with_mime_type(self, mime_type: String) -> Self
Set the MIME type.
Sourcepub fn with_size_bytes(self, size_bytes: u64) -> Self
pub fn with_size_bytes(self, size_bytes: u64) -> Self
Set the size in bytes.
Sourcepub fn with_checksum(self, checksum: String) -> Self
pub fn with_checksum(self, checksum: String) -> Self
Set the checksum.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SourceRef
impl<'de> Deserialize<'de> for SourceRef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SourceRef
impl StructuralPartialEq for SourceRef
Auto Trait Implementations§
impl Freeze for SourceRef
impl RefUnwindSafe for SourceRef
impl Send for SourceRef
impl Sync for SourceRef
impl Unpin for SourceRef
impl UnwindSafe for SourceRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more