pub struct Workbook { /* private fields */ }Expand description
Engine-backed workbook facade.
Implementations§
Source§impl Workbook
impl Workbook
pub fn new_with_config(config: WorkbookConfig) -> Self
pub fn new_with_mode(mode: WorkbookMode) -> Self
pub fn new() -> Self
pub fn register_custom_function( &mut self, name: &str, options: CustomFnOptions, handler: Arc<dyn CustomFnHandler>, ) -> Result<(), ExcelError>
Sourcepub fn inspect_wasm_module_bytes(
&self,
wasm_bytes: &[u8],
) -> Result<WasmModuleInfo, ExcelError>
pub fn inspect_wasm_module_bytes( &self, wasm_bytes: &[u8], ) -> Result<WasmModuleInfo, ExcelError>
Inspect a WASM module manifest and return module metadata without mutating workbook state.
pub fn register_wasm_module_bytes( &mut self, module_id: &str, wasm_bytes: &[u8], ) -> Result<WasmModuleInfo, ExcelError>
Sourcepub fn inspect_wasm_module_file(
&self,
path: impl AsRef<Path>,
) -> Result<WasmModuleInfo, ExcelError>
pub fn inspect_wasm_module_file( &self, path: impl AsRef<Path>, ) -> Result<WasmModuleInfo, ExcelError>
Inspect a WASM module file without mutating workbook state.
Sourcepub fn inspect_wasm_modules_dir(
&self,
dir: impl AsRef<Path>,
) -> Result<Vec<WasmModuleInfo>, ExcelError>
pub fn inspect_wasm_modules_dir( &self, dir: impl AsRef<Path>, ) -> Result<Vec<WasmModuleInfo>, ExcelError>
Inspect all *.wasm files in a directory without mutating workbook state.
Sourcepub fn attach_wasm_module_bytes(
&mut self,
module_id: &str,
wasm_bytes: &[u8],
) -> Result<WasmModuleInfo, ExcelError>
pub fn attach_wasm_module_bytes( &mut self, module_id: &str, wasm_bytes: &[u8], ) -> Result<WasmModuleInfo, ExcelError>
Alias for clearer workbook-local terminology.
Sourcepub fn attach_wasm_module_file(
&mut self,
path: impl AsRef<Path>,
) -> Result<WasmModuleInfo, ExcelError>
pub fn attach_wasm_module_file( &mut self, path: impl AsRef<Path>, ) -> Result<WasmModuleInfo, ExcelError>
Attach a WASM module from a file path using the module id from its manifest.
Sourcepub fn attach_wasm_modules_dir(
&mut self,
dir: impl AsRef<Path>,
) -> Result<Vec<WasmModuleInfo>, ExcelError>
pub fn attach_wasm_modules_dir( &mut self, dir: impl AsRef<Path>, ) -> Result<Vec<WasmModuleInfo>, ExcelError>
Attach all *.wasm modules found in a directory.
pub fn list_wasm_modules(&self) -> Vec<WasmModuleInfo>
pub fn unregister_wasm_module( &mut self, module_id: &str, ) -> Result<(), ExcelError>
pub fn register_wasm_function( &mut self, name: &str, options: CustomFnOptions, spec: WasmFunctionSpec, ) -> Result<(), ExcelError>
Sourcepub fn bind_wasm_function(
&mut self,
name: &str,
options: CustomFnOptions,
spec: WasmFunctionSpec,
) -> Result<(), ExcelError>
pub fn bind_wasm_function( &mut self, name: &str, options: CustomFnOptions, spec: WasmFunctionSpec, ) -> Result<(), ExcelError>
Alias for clearer workbook-local terminology.
pub fn unregister_custom_function( &mut self, name: &str, ) -> Result<(), ExcelError>
pub fn list_custom_functions(&self) -> Vec<CustomFnInfo>
pub fn engine(&self) -> &Engine<WBResolver>
pub fn engine_mut(&mut self) -> &mut Engine<WBResolver>
pub fn eval_config(&self) -> &EvalConfig
pub fn deterministic_mode(&self) -> &DeterministicMode
pub fn set_deterministic_mode( &mut self, mode: DeterministicMode, ) -> Result<(), IoError>
pub fn set_changelog_enabled(&mut self, enabled: bool)
pub fn set_actor_id(&mut self, actor_id: Option<String>)
pub fn set_correlation_id(&mut self, correlation_id: Option<String>)
pub fn set_reason(&mut self, reason: Option<String>)
pub fn begin_action(&mut self, description: impl Into<String>)
pub fn end_action(&mut self)
Sourcepub fn action<T>(
&mut self,
name: &str,
f: impl FnOnce(&mut WorkbookAction<'_>) -> Result<T, IoError>,
) -> Result<T, IoError>
pub fn action<T>( &mut self, name: &str, f: impl FnOnce(&mut WorkbookAction<'_>) -> Result<T, IoError>, ) -> Result<T, IoError>
Execute an atomic workbook action.
When changelog is enabled, this delegates to Engine::action_with_logger and therefore:
- logs changes into the changelog as a compound
- rolls back graph + Arrow-truth value changes on error
- truncates the changelog on rollback
The closure receives a WorkbookAction rather than &mut Workbook to avoid aliasing
&mut Workbook while the Engine transaction is active.
pub fn undo(&mut self) -> Result<(), IoError>
pub fn redo(&mut self) -> Result<(), IoError>
pub fn sheet_names(&self) -> Vec<String>
Sourcepub fn sheet_dimensions(&self, name: &str) -> Option<(u32, u32)>
pub fn sheet_dimensions(&self, name: &str) -> Option<(u32, u32)>
Return (rows, cols) for a sheet if present in the Arrow store
pub fn has_sheet(&self, name: &str) -> bool
pub fn add_sheet(&mut self, name: &str) -> Result<(), ExcelError>
pub fn delete_sheet(&mut self, name: &str) -> Result<(), ExcelError>
pub fn rename_sheet(&mut self, old: &str, new: &str) -> Result<(), ExcelError>
pub fn set_value( &mut self, sheet: &str, row: u32, col: u32, value: LiteralValue, ) -> Result<(), IoError>
pub fn set_formula( &mut self, sheet: &str, row: u32, col: u32, formula: &str, ) -> Result<(), IoError>
pub fn get_value(&self, sheet: &str, row: u32, col: u32) -> Option<LiteralValue>
pub fn get_formula(&self, sheet: &str, row: u32, col: u32) -> Option<String>
pub fn read_range(&self, addr: &RangeAddress) -> Vec<Vec<LiteralValue>>
pub fn write_range( &mut self, sheet: &str, _start: (u32, u32), cells: BTreeMap<(u32, u32), CellData>, ) -> Result<(), IoError>
pub fn set_values( &mut self, sheet: &str, start_row: u32, start_col: u32, rows: &[Vec<LiteralValue>], ) -> Result<(), IoError>
pub fn set_formulas( &mut self, sheet: &str, start_row: u32, start_col: u32, rows: &[Vec<String>], ) -> Result<(), IoError>
pub fn prepare_graph_all(&mut self) -> Result<(), IoError>
pub fn prepare_graph_for_sheets<'a, I: IntoIterator<Item = &'a str>>( &mut self, sheets: I, ) -> Result<(), IoError>
pub fn evaluate_cell( &mut self, sheet: &str, row: u32, col: u32, ) -> Result<LiteralValue, IoError>
pub fn evaluate_cells( &mut self, targets: &[(&str, u32, u32)], ) -> Result<Vec<LiteralValue>, IoError>
pub fn evaluate_cells_cancellable( &mut self, targets: &[(&str, u32, u32)], cancel_flag: Arc<AtomicBool>, ) -> Result<Vec<LiteralValue>, IoError>
pub fn evaluate_all(&mut self) -> Result<EvalResult, IoError>
pub fn evaluate_all_cancellable( &mut self, cancel_flag: Arc<AtomicBool>, ) -> Result<EvalResult, IoError>
pub fn evaluate_with_plan( &mut self, plan: &RecalcPlan, ) -> Result<EvalResult, IoError>
pub fn get_eval_plan( &self, targets: &[(&str, u32, u32)], ) -> Result<EvalPlan, IoError>
pub fn define_named_range( &mut self, name: &str, address: &RangeAddress, scope: NamedRangeScope, ) -> Result<(), IoError>
pub fn update_named_range( &mut self, name: &str, address: &RangeAddress, scope: NamedRangeScope, ) -> Result<(), IoError>
pub fn delete_named_range( &mut self, name: &str, scope: NamedRangeScope, sheet: Option<&str>, ) -> Result<(), IoError>
Sourcepub fn named_range_address(&self, name: &str) -> Option<RangeAddress>
pub fn named_range_address(&self, name: &str) -> Option<RangeAddress>
Resolve a named range (workbook-scoped or unique sheet-scoped) to an absolute address.
pub fn begin_tx<'a, W: SpreadsheetWriter>( &'a mut self, writer: &'a mut W, ) -> WriteTransaction<'a, W>
pub fn from_reader<B>(
backend: B,
_strategy: LoadStrategy,
config: WorkbookConfig,
) -> Result<Self, IoError>where
B: SpreadsheetReader + EngineLoadStream<WBResolver>,
IoError: From<<B as EngineLoadStream<WBResolver>>::Error>,
pub fn from_reader_with_config<B>(
backend: B,
strategy: LoadStrategy,
config: WorkbookConfig,
) -> Result<Self, IoError>where
B: SpreadsheetReader + EngineLoadStream<WBResolver>,
IoError: From<<B as EngineLoadStream<WBResolver>>::Error>,
pub fn from_reader_with_mode<B>(
backend: B,
strategy: LoadStrategy,
mode: WorkbookMode,
) -> Result<Self, IoError>where
B: SpreadsheetReader + EngineLoadStream<WBResolver>,
IoError: From<<B as EngineLoadStream<WBResolver>>::Error>,
Trait Implementations§
Source§impl SpreadsheetWriter for Workbook
impl SpreadsheetWriter for Workbook
type Error = IoError
fn write_cell( &mut self, sheet: &str, row: u32, col: u32, data: CellData, ) -> Result<(), Self::Error>
fn write_range( &mut self, sheet: &str, cells: BTreeMap<(u32, u32), CellData>, ) -> Result<(), Self::Error>
fn clear_range( &mut self, sheet: &str, start: (u32, u32), end: (u32, u32), ) -> Result<(), Self::Error>
fn create_sheet(&mut self, name: &str) -> Result<(), Self::Error>
fn delete_sheet(&mut self, name: &str) -> Result<(), Self::Error>
fn rename_sheet(&mut self, old: &str, new: &str) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
fn save(&mut self) -> Result<(), Self::Error>
Source§fn save_to<'a>(
&mut self,
dest: SaveDestination<'a>,
) -> Result<Option<Vec<u8>>, Self::Error>
fn save_to<'a>( &mut self, dest: SaveDestination<'a>, ) -> Result<Option<Vec<u8>>, Self::Error>
fn save_as_path<P: AsRef<Path>>(&mut self, path: P) -> Result<(), Self::Error>
fn save_to_bytes(&mut self) -> Result<Vec<u8>, Self::Error>
fn write_to<W: Write>(&mut self, writer: &mut W) -> Result<(), Self::Error>
Auto Trait Implementations§
impl !Freeze for Workbook
impl !RefUnwindSafe for Workbook
impl Send for Workbook
impl Sync for Workbook
impl Unpin for Workbook
impl UnsafeUnpin for Workbook
impl !UnwindSafe for Workbook
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more