n00kii / egui-modal

a simple modal library for egui
MIT License
65 stars 10 forks source link

ModalState should be derived as Deserialize #2

Closed karfield closed 1 year ago

karfield commented 1 year ago

Simple error occurs when egaui serde feature is on:

error[E0277]: the trait bound `for<'a> ModalState: serde::de::Deserialize<'a>` is not satisfied
   --> /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-modal-0.1.6/src/modal.rs:128:20
    |
128 |         ctx.data().get_persisted(id).unwrap_or_default()
    |                    ^^^^^^^^^^^^^ the trait `for<'a> serde::de::Deserialize<'a>` is not implemented for `ModalState`
    |
    = help: the following other types implement trait `serde::de::Deserialize<'de>`:
              &'a [u8]
              &'a std::path::Path
              &'a str
              ()
              (T0, T1)
              (T0, T1, T2)
              (T0, T1, T2, T3)
              (T0, T1, T2, T3, T4)
            and 225 others
    = note: required because of the requirements on the impl of `SerializableAny` for `ModalState`
note: required by a bound in `IdTypeMap::get_persisted`
   --> /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.19.0/src/util/id_type_map.rs:370:29
    |
370 |     pub fn get_persisted<T: SerializableAny>(&mut self, id: Id) -> Option<T> {
    |                             ^^^^^^^^^^^^^^^ required by this bound in `IdTypeMap::get_persisted`
n00kii commented 1 year ago

this is because i used get_persisted when all i needed is get_temp ill push an update.

n00kii commented 1 year ago

fixed in https://github.com/n00kii/egui-modal/commit/886bcd20234013a2b58d1853a86bf9f97802dbbd let me know if its still broken