# window.Window.move_to

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/window.rs#L930
- **Page:** https://libtmux.org/en/rs/latest/reference/window-window-move_to/

```
window.Window.move_to(mut, session: &Session, index: i32) -> Result<&mut Self, Error>
```

Move this window to an index, possibly in another session.

The destination is a session and an index rather than a target string,
because those are the two things tmux needs and a string could express
neither or both.

# Errors

Returns [`Error::ServerMismatch`] when `session` belongs to another
server, or an error when the destination is occupied or absent.
