Struct wayland_client::State [] [src]

pub struct State { /* fields omitted */ }

A token store

This struct allows you to store various values in a store and access them back using the provided tokens.

Methods

impl Store
[src]

[src]

Create a new store

[src]

Insert a new value in this store

Returns a clonable token that you can later use to access this value.

[src]

Access value previously inserted in this store

Panics if the provided token corresponds to a value that was removed.

[src]

Mutably access value previously inserted in this store

Panics if the provided token corresponds to a value that was removed.

[src]

Remove a value previously inserted in this store

Panics if the provided token corresponds to a value that was already removed.

[src]

Create a sub-scope with access to a value

In the closure you provide, the value represented by token will be available as an argument, as well as a StoreProxy, which allows you to manipulate the other values of the store while this one is mutably borrowed.

Attempting to access again the same value from its token from within this closure is forbidden, and attempting to do so will result in a panic.

The StoreProxy provides the same access methods as the Store, including with_value, allowing you to create nested sub-scopes accessing multiple store values at the same time.

[src]

See this Store as a StoreProxy with no ongoing borrow

This can be usefull for code requiering access to a store, but wanting to be generic over being called from a value scope or not.

You can also use the From and Into traits to perform this conversion.