paxdotdev / pax

User interface engine with an integrated vector design tool, built in Rust
https://www.pax.dev/
Apache License 2.0
466 stars 23 forks source link

Tree Local Storage #187

Closed samuelselleck closed 5 months ago

samuelselleck commented 5 months ago

This adds the ability to store node tree local information, to be used for contextual children.

Use:

// get value:
ctx.peek_local_store::<SomeUserlandType>(|store| {
   /// userland logic here
});

// set value:
ctx.push_local_store(SomeUserlandTyle {});

any object inserted (or looked up) is required to implement the Store Marker trait.