pub struct SplitOptions { /* private fields */ }Expand description
Options for splitting a window or pane into a new pane.
A bare SplitDirection is accepted wherever this is:
window.split(SplitDirection::Below).
§Examples
use libtmux::{SplitDirection, SplitOptions};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("split").await?;
let window = session.active_window().await?.expect("a session has a window");
// Splitting leaves focus where it was unless asked otherwise, so a caller
// that wants the new pane selected says so.
let pane = window
.split(SplitOptions::new(SplitDirection::Right).select())
.await?;
assert_eq!(window.active_pane().await?.map(|active| active.id().to_string()),
Some(pane.id().to_string()));
guard.shutdown().await?;Implementations§
Source§impl SplitOptions
impl SplitOptions
Sourcepub const fn new(direction: SplitDirection) -> Self
pub const fn new(direction: SplitDirection) -> Self
Describe a split placing the new pane in one direction.
Sourcepub fn start_directory(self, directory: impl Into<PathBuf>) -> Self
pub fn start_directory(self, directory: impl Into<PathBuf>) -> Self
Set the new pane’s working directory.
Sourcepub fn command(self, command: impl Into<OsString>) -> Self
pub fn command(self, command: impl Into<OsString>) -> Self
Run a command instead of the default shell.
Sourcepub const fn size(self, size: PaneSize) -> Self
pub const fn size(self, size: PaneSize) -> Self
Give the new pane a size, in cells or as a share of the space.
Sourcepub fn environment(
self,
name: impl Into<OsString>,
value: impl Into<OsString>,
) -> Self
pub fn environment( self, name: impl Into<OsString>, value: impl Into<OsString>, ) -> Self
Set an environment variable for the process the new pane starts.
Call this more than once for more than one variable. tmux applies these to the new process only, not to the session.
Trait Implementations§
Source§impl Clone for SplitOptions
impl Clone for SplitOptions
Source§fn clone(&self) -> SplitOptions
fn clone(&self) -> SplitOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SplitOptions
impl Debug for SplitOptions
Source§impl From<SplitDirection> for SplitOptions
impl From<SplitDirection> for SplitOptions
Source§fn from(direction: SplitDirection) -> Self
fn from(direction: SplitDirection) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SplitOptions
impl RefUnwindSafe for SplitOptions
impl Send for SplitOptions
impl Sync for SplitOptions
impl Unpin for SplitOptions
impl UnsafeUnpin for SplitOptions
impl UnwindSafe for SplitOptions
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
Mutably borrows from an owned value. Read more