Skip to main content

LayoutCodec

Trait LayoutCodec 

Source
pub trait LayoutCodec: 'static {
    // Required methods
    fn encode(&self, layout: &GridLayout) -> Result<String, LayoutError>;
    fn decode(&self, text: &str) -> Result<GridLayout, LayoutError>;
}
Expand description

Turns a layout into text and back. Called once per import or export.

The default is JsonLayoutCodec. Another codec can read a foreign format, such as a LiveGrid or Syncfusion XML layout.

Required Methods§

Source

fn encode(&self, layout: &GridLayout) -> Result<String, LayoutError>

Writes a layout.

Source

fn decode(&self, text: &str) -> Result<GridLayout, LayoutError>

Reads a layout. Also migrates older versions of its own format, and refuses versions it does not read with LayoutError::UnsupportedVersion.

Implementors§