Skip to main content

FileStore

Trait FileStore 

Source
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§

Source

fn list(&self, dir: &str) -> Result<Vec<FileEntry>, String>

List a directory (with dir/size info).

Source

fn upload(&self, remote_path: &str, local: &Path) -> Result<(), String>

Upload the already-staged local file to remote_path.

Source

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.

Source

fn fetch(&self, remote_path: &str) -> Result<Vec<u8>, String>

Fetch a file’s raw bytes (for the 3D viewer). Capped at RAW_MAX.

Source

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.

Source

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".

Implementors§