# window.Window.move_to

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/window.rs#L870
- **Page:** https://libtmux.org/reference/rs/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.
