#[derive(Debug)] pub struct EmbeddedBook { pub title: String, pub author: String, pub summary: String, pub embeddings: [f32; 384], } impl Book { fn to_embedded(self, embeddings: [f32; 384]) -> EmbeddedBook { EmbeddedBook { title: self.title, author: self.author, summary: self.summary, embeddings: embeddings, } } } // convenient to convert a slice to a fixed size array fn to_array(barry: &[f32]) -> [f32; 384] { barry.try_into().expect("slice with incorrect length") }