pub trait FileStore: Send + Sync {
// Required methods
fn list(&self, dir: &str) -> Result<Vec<FileEntry>, String>;
fn upload(&self, remote_path: &str, local: &Path) -> Result<(), String>;
fn thumbnail(
&self,
remote_path: &str,
plate: u32,
) -> Result<Option<Vec<u8>>, String>;
fn fetch(&self, remote_path: &str) -> Result<Vec<u8>, String>;
fn gcode(
&self,
remote_path: &str,
plate: u32,
) -> Result<Option<Vec<u8>>, String>;
fn models(&self, remote_path: &str) -> Result<Vec<String>, String>;
}Expand description
Something that can list and upload files on the printer, and fetch the plate
preview embedded in a sliced .3mf.
Required Methods§
Sourcefn list(&self, dir: &str) -> Result<Vec<FileEntry>, String>
fn list(&self, dir: &str) -> Result<Vec<FileEntry>, String>
List a directory (with dir/size info).
Sourcefn upload(&self, remote_path: &str, local: &Path) -> Result<(), String>
fn upload(&self, remote_path: &str, local: &Path) -> Result<(), String>
Upload the already-staged local file to remote_path.
Sourcefn thumbnail(
&self,
remote_path: &str,
plate: u32,
) -> Result<Option<Vec<u8>>, String>
fn thumbnail( &self, remote_path: &str, plate: u32, ) -> Result<Option<Vec<u8>>, String>
The embedded plate preview PNG for a sliced .3mf (Metadata/plate_N.png),
or None when the file has no such thumbnail.
Sourcefn fetch(&self, remote_path: &str) -> Result<Vec<u8>, String>
fn fetch(&self, remote_path: &str) -> Result<Vec<u8>, String>
Fetch a file’s raw bytes (for the 3D viewer). Capped at RAW_MAX.
Sourcefn gcode(
&self,
remote_path: &str,
plate: u32,
) -> Result<Option<Vec<u8>>, String>
fn gcode( &self, remote_path: &str, plate: u32, ) -> Result<Option<Vec<u8>>, String>
Extract the plate’s gcode (Metadata/plate_N.gcode) from a .3mf — the
toolpath the 3D viewer renders for a sliced file. None if absent.
Sourcefn models(&self, remote_path: &str) -> Result<Vec<String>, String>
fn models(&self, remote_path: &str) -> Result<Vec<String>, String>
Extract the object mesh model XML(s) from a .3mf — the geometry the 3D
viewer renders as a solid mesh. Bambu stores meshes in external component
files (3D/Objects/*.model) that three’s 3MF loader won’t follow, so we
pull them out ourselves. Empty when the file embeds no mesh.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".