SparseValues
The values one array option holds, by the index tmux stores them under.
Source and package
- Qualified name
-
libtmux::hooks:: Sparse Values - Module
- hooks
- Package
- libtmux
- Source
- crates/libtmux/src/hooks.rs
-
Description#
Indices are sparse, and tmux means it. Setting a value without an index writes slot
0, removing one slot of several leaves the rest where they were, and nothing renumbers, so aSparseValueswith two entries may hold them at0and30. Iteration is by ascending index.Examples#
let guard = libtmux::test::TestServer::new().await?;let server = guard.server();server.set_hook("after-new-window", "display-message built").await?;let hooks = server.hook("after-new-window").await?.expect("the hook is set");assert_eq!(hooks.len(), 1);assert_eq!(hooks.first().map(|value| value.to_string_lossy().into_owned()),Some("display-message built".to_owned()),);guard.shutdown().await?;
Members8#
- first method The value at the lowest index, which is what a write without one sets.
- get method The value stored at one index.
- indices method The indices that hold a value, ascending.
- into_values method The values alone, owned, by ascending index.
- is_empty method Whether this option holds nothing.
- iter method The values and the indices they are stored under, lowest first.
- len method How many values this option holds.
- values method The values alone, by ascending index.
Guides#
Pages that discuss SparseValues.