diff options
| author | Brooks J Rady <b.j.rady@gmail.com> | 2020-12-29 16:28:34 +0000 |
|---|---|---|
| committer | Brooks J Rady <b.j.rady@gmail.com> | 2020-12-29 16:28:34 +0000 |
| commit | b0c7259266f21652944cf1c74eb42682d9c28fa1 (patch) | |
| tree | 1f58fef33d79652ead2f421d8a0d3e71926de77b /src/layout.rs | |
| parent | Move some wasm code to it's own module (diff) | |
| download | sl0ppij-b0c7259266f21652944cf1c74eb42682d9c28fa1.tar.gz sl0ppij-b0c7259266f21652944cf1c74eb42682d9c28fa1.tar.xz sl0ppij-b0c7259266f21652944cf1c74eb42682d9c28fa1.zip | |
It's now possible to load WASM files from layouts!
Diffstat (limited to 'src/layout.rs')
| -rw-r--r-- | src/layout.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/layout.rs b/src/layout.rs index 6f110ee1..1e876532 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -140,6 +140,8 @@ pub struct Layout { pub parts: Vec<Layout>, #[serde(skip_serializing_if = "Option::is_none")] pub split_size: Option<SplitSize>, + #[serde(skip_serializing_if = "Option::is_none")] + pub plugin: Option<PathBuf>, } impl Layout { @@ -171,6 +173,18 @@ impl Layout { } total_panes } + + // FIXME: I probably shouldn't exist, much less with PathBuf (use &Path) + #[cfg(feature = "wasm-wip")] + pub fn list_plugins(&self) -> Vec<&PathBuf> { + dbg!(&self); + let mut plugins: Vec<_> = self.parts.iter().flat_map(Layout::list_plugins).collect(); + if let Some(path) = &self.plugin { + plugins.push(path); + } + plugins + } + pub fn position_panes_in_space(&self, space: &PositionAndSize) -> Vec<PositionAndSize> { split_space(space, &self) } |
